Standardize headers and docstrings (#4417)

* Implement new headers

* Reformat 1

* Reformat 2

* Reformat 3 - math

* Reformat 4 - yaml
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-08-14 21:17:51 +02:00
1 parent bb0aed1ba6
commit 24bea5e4b7
64 files changed
+164 -54

No files matched your search

+4 -1
View File
@@ -1,4 +1,7 @@
# Activation functions
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Activation functions
"""
import torch
import torch.nn as nn
+5 -2
View File
@@ -1,10 +1,13 @@
# YOLOv5 image augmentation functions
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Image augmentation functions
"""
import logging
import math
import random
import cv2
import math
import numpy as np
from utils.general import colorstr, segment2box, resample_segments, check_version
+4 -1
View File
@@ -1,4 +1,7 @@
# Auto-anchor utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Auto-anchor utils
"""
import random
+5 -1
View File
@@ -1,4 +1,8 @@
#!/usr/bin/env python
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Callback utils
"""
class Callbacks:
""""
+4 -1
View File
@@ -1,4 +1,7 @@
# YOLOv5 dataset utils and dataloaders
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Dataloaders and dataset utils
"""
import glob
import hashlib
+4 -1
View File
@@ -1,4 +1,7 @@
# Download utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Download utils
"""
import os
import platform
+7 -2
View File
@@ -1,9 +1,13 @@
# Flask REST API
[REST](https://en.wikipedia.org/wiki/Representational_state_transfer) [API](https://en.wikipedia.org/wiki/API)s are commonly used to expose Machine Learning (ML) models to other services. This folder contains an example REST API created using Flask to expose the YOLOv5s model from [PyTorch Hub](https://pytorch.org/hub/ultralytics_yolov5/).
[REST](https://en.wikipedia.org/wiki/Representational_state_transfer) [API](https://en.wikipedia.org/wiki/API)s are
commonly used to expose Machine Learning (ML) models to other services. This folder contains an example REST API
created using Flask to expose the YOLOv5s model from [PyTorch Hub](https://pytorch.org/hub/ultralytics_yolov5/).
## Requirements
[Flask](https://palletsprojects.com/p/flask/) is required. Install with:
```shell
$ pip install Flask
```
@@ -65,4 +69,5 @@ The model inference results are returned as a JSON response:
]
```
An example python script to perform inference using [requests](https://docs.python-requests.org/en/master/) is given in `example_request.py`
An example python script to perform inference using [requests](https://docs.python-requests.org/en/master/) is given
in `example_request.py`
+5 -2
View File
@@ -1,8 +1,12 @@
# YOLOv5 general utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
General utils
"""
import contextlib
import glob
import logging
import math
import os
import platform
import random
@@ -16,7 +20,6 @@ from pathlib import Path
from subprocess import check_output
import cv2
import math
import numpy as np
import pandas as pd
import pkg_resources as pkg
+5 -1
View File
@@ -1,4 +1,8 @@
# YOLOv5 experiment logging utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Logging utils
"""
import warnings
from threading import Thread
+1 -1
View File
@@ -507,4 +507,4 @@ def all_logging_disabled(highest_level=logging.CRITICAL):
try:
yield
finally:
logging.disable(previous_level)
logging.disable(previous_level)
+4 -1
View File
@@ -1,4 +1,7 @@
# Loss functions
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Loss functions
"""
import torch
import torch.nn as nn
+5 -2
View File
@@ -1,9 +1,12 @@
# Model validation metrics
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Model validation metrics
"""
import math
import warnings
from pathlib import Path
import math
import matplotlib.pyplot as plt
import numpy as np
import torch
+4 -1
View File
@@ -1,4 +1,7 @@
# Plotting utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Plotting utils
"""
import math
from copy import copy
+5 -2
View File
@@ -1,7 +1,11 @@
# YOLOv5 PyTorch utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
PyTorch utils
"""
import datetime
import logging
import math
import os
import platform
import subprocess
@@ -10,7 +14,6 @@ from contextlib import contextmanager
from copy import deepcopy
from pathlib import Path
import math
import torch
import torch.backends.cudnn as cudnn
import torch.distributed as dist