Skip to content

Commit

Permalink
Update README.md (#13283)
Browse files Browse the repository at this point in the history
* Update README.md

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Auto-format by https://ultralytics.com/actions

---------

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
  • Loading branch information
glenn-jocher and UltralyticsAssistant authored Aug 26, 2024
1 parent 427cfc4 commit b40781b
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""
Export a YOLOv5 PyTorch model to other formats. TensorFlow exports authored by https://github.com/zldrobit
Export a YOLOv5 PyTorch model to other formats. TensorFlow exports authored by https://github.com/zldrobit.
Format | `export.py --include` | Model
--- | --- | ---
Expand Down Expand Up @@ -141,7 +141,7 @@ def forward(self, x):


def export_formats():
"""
r"""
Returns a DataFrame of supported YOLOv5 model export formats and their properties.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion hubconf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""
PyTorch Hub models https://pytorch.org/hub/ultralytics_yolov5
PyTorch Hub models https://pytorch.org/hub/ultralytics_yolov5.
Usage:
import torch
Expand Down
2 changes: 1 addition & 1 deletion models/tf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""
TensorFlow, Keras and TFLite versions of YOLOv5
Authored by https://github.com/zldrobit in PR https://github.com/ultralytics/yolov5/pull/1127
Authored by https://github.com/zldrobit in PR https://github.com/ultralytics/yolov5/pull/1127.
Usage:
$ python models/tf.py --weights yolov5s.pt
Expand Down
2 changes: 1 addition & 1 deletion segment/val.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def process_batch(detections, labels, iouv, pred_masks=None, gt_masks=None, over
detections (array[N, 6]), x1, y1, x2, y2, conf, class
labels (array[M, 5]), class, x1, y1, x2, y2
Returns:
correct (array[N, 10]), for 10 IoU levels
correct (array[N, 10]), for 10 IoU levels.
"""
if masks:
if overlap:
Expand Down
6 changes: 3 additions & 3 deletions utils/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def exif_size(img):
def exif_transpose(image):
"""
Transpose a PIL image accordingly if it has an EXIF Orientation tag.
Inplace version of https://github.com/python-pillow/Pillow/blob/master/src/PIL/ImageOps.py exif_transpose()
Inplace version of https://github.com/python-pillow/Pillow/blob/master/src/PIL/ImageOps.py exif_transpose().
:param image: The image to transpose.
:return: An image.
Expand Down Expand Up @@ -316,7 +316,7 @@ def __next__(self):


class LoadImages:
"""YOLOv5 image/video dataloader, i.e. `python detect.py --source image.jpg/vid.mp4`"""
"""YOLOv5 image/video dataloader, i.e. `python detect.py --source image.jpg/vid.mp4`."""

def __init__(self, path, img_size=640, stride=32, auto=True, transforms=None, vid_stride=1):
"""Initializes YOLOv5 loader for images/videos, supporting glob patterns, directories, and lists of paths."""
Expand Down Expand Up @@ -1103,7 +1103,7 @@ def extract_boxes(path=DATASETS_DIR / "coco128"):

def autosplit(path=DATASETS_DIR / "coco128/images", weights=(0.9, 0.1, 0.0), annotated_only=False):
"""Autosplit a dataset into train/val/test splits and save path/autosplit_*.txt files
Usage: from utils.dataloaders import *; autosplit()
Usage: from utils.dataloaders import *; autosplit().
Arguments:
path: Path to images directory
Expand Down
2 changes: 1 addition & 1 deletion utils/loggers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def on_params_update(self, params: dict):
class GenericLogger:
"""
YOLOv5 General purpose logger for non-task specific logging
Usage: from utils.loggers import GenericLogger; logger = GenericLogger(...)
Usage: from utils.loggers import GenericLogger; logger = GenericLogger(...).
Arguments:
opt: Run arguments
Expand Down
2 changes: 1 addition & 1 deletion utils/loggers/clearml/clearml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ClearmlLogger:
def __init__(self, opt, hyp):
"""
- Initialize ClearML Task, this object will capture the experiment
- Upload dataset version to ClearML Data if opt.upload_dataset is True
- Upload dataset version to ClearML Data if opt.upload_dataset is True.
Arguments:
opt (namespace) -- Commandline arguments for this run
Expand Down
4 changes: 2 additions & 2 deletions utils/loggers/wandb/wandb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, opt, run_id=None, job_type="Training"):
"""
- Initialize WandbLogger instance
- Upload dataset if opt.upload_dataset is True
- Setup training processes if job_type is 'Training'
- Setup training processes if job_type is 'Training'.
Arguments:
opt (namespace) -- Commandline arguments for this run
Expand Down Expand Up @@ -88,7 +88,7 @@ def setup_training(self, opt):
Setup the necessary processes for training YOLO models:
- Attempt to download model checkpoint and dataset artifacts if opt.resume stats with WANDB_ARTIFACT_PREFIX
- Update data_dict, to contain info of previous run if resumed and the paths of dataset artifact if downloaded
- Setup log_dict, initialize bbox_interval
- Setup log_dict, initialize bbox_interval.
Arguments:
opt (namespace) -- commandline arguments for this run
Expand Down
2 changes: 1 addition & 1 deletion utils/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def smooth_BCE(eps=0.1):
"""Returns label smoothing BCE targets for reducing overfitting; pos: `1.0 - 0.5*eps`, neg: `0.5*eps`. For details see https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441"""
"""Returns label smoothing BCE targets for reducing overfitting; pos: `1.0 - 0.5*eps`, neg: `0.5*eps`. For details see https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441."""
return 1.0 - 0.5 * eps, 0.5 * eps


Expand Down
2 changes: 1 addition & 1 deletion utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def compute_ap(recall, precision):
recall: The recall curve (list)
precision: The precision curve (list)
# Returns
Average precision, precision curve, recall curve
Average precision, precision curve, recall curve.
"""
# Append sentinel values to beginning and end
mrec = np.concatenate(([0.0], recall, [1.0]))
Expand Down
2 changes: 1 addition & 1 deletion utils/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def feature_visualization(x, module_type, stage, n=32, save_dir=Path("runs/detec
module_type: Module type
stage: Module stage within model
n: Maximum number of feature maps to plot
save_dir: Directory to save results
save_dir: Directory to save results.
"""
if ("Detect" not in module_type) and (
"Segment" not in module_type
Expand Down
12 changes: 6 additions & 6 deletions utils/segment/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def process_mask_upsample(protos, masks_in, bboxes, shape):
protos: [mask_dim, mask_h, mask_w]
masks_in: [n, mask_dim], n is number of masks after nms
bboxes: [n, 4], n is number of masks after nms
shape: input_image_size, (h, w)
shape: input_image_size, (h, w).
return: h, w, n
"""
Expand All @@ -45,7 +45,7 @@ def process_mask(protos, masks_in, bboxes, shape, upsample=False):
proto_out: [mask_dim, mask_h, mask_w]
out_masks: [n, mask_dim], n is number of masks after nms
bboxes: [n, 4], n is number of masks after nms
shape:input_image_size, (h, w)
shape:input_image_size, (h, w).
return: h, w, n
"""
Expand All @@ -71,7 +71,7 @@ def process_mask_native(protos, masks_in, bboxes, shape):
protos: [mask_dim, mask_h, mask_w]
masks_in: [n, mask_dim], n is number of masks after nms
bboxes: [n, 4], n is number of masks after nms
shape: input_image_size, (h, w)
shape: input_image_size, (h, w).
return: h, w, n
"""
Expand All @@ -92,7 +92,7 @@ def scale_image(im1_shape, masks, im0_shape, ratio_pad=None):
"""
img1_shape: model input shape, [h, w]
img0_shape: origin pic shape, [h, w, 3]
masks: [h, w, num]
masks: [h, w, num].
"""
# Rescale coordinates (xyxy) from im1_shape to im0_shape
if ratio_pad is None: # calculate from im0_shape
Expand Down Expand Up @@ -120,7 +120,7 @@ def mask_iou(mask1, mask2, eps=1e-7):
"""
mask1: [N, n] m1 means number of predicted objects
mask2: [M, n] m2 means number of gt objects
Note: n means image_w x image_h
Note: n means image_w x image_h.
return: masks iou, [N, M]
"""
Expand All @@ -133,7 +133,7 @@ def masks_iou(mask1, mask2, eps=1e-7):
"""
mask1: [N, n] m1 means number of predicted objects
mask2: [N, n] m2 means number of gt objects
Note: n means image_w x image_h
Note: n means image_w x image_h.
return: masks iou, (N, )
"""
Expand Down
6 changes: 3 additions & 3 deletions utils/segment/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def mean_results(self):
return (self.mp, self.mr, self.map50, self.map)

def class_result(self, i):
"""Class-aware result, return p[i], r[i], ap50[i], ap[i]"""
"""Class-aware result, return p[i], r[i], ap50[i], ap[i]."""
return (self.p[i], self.r[i], self.ap50[i], self.ap[i])

def get_maps(self, nc):
Expand All @@ -140,7 +140,7 @@ def get_maps(self, nc):
def update(self, results):
"""
Args:
results: tuple(p, r, ap, f1, ap_class)
results: tuple(p, r, ap, f1, ap_class).
"""
p, r, all_ap, f1, ap_class_index = results
self.p = p
Expand All @@ -163,7 +163,7 @@ def __init__(self) -> None:
def update(self, results):
"""
Args:
results: Dict{'boxes': Dict{}, 'masks': Dict{}}
results: Dict{'boxes': Dict{}, 'masks': Dict{}}.
"""
self.metric_box.update(list(results["boxes"].values()))
self.metric_mask.update(list(results["masks"].values()))
Expand Down
4 changes: 2 additions & 2 deletions utils/torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def profile(input, ops, n=10, device=None):
input = torch.randn(16, 3, 640, 640)
m1 = lambda x: x * torch.sigmoid(x)
m2 = nn.SiLU()
profile(input, [m1, m2], n=100) # profile over 100 iterations
profile(input, [m1, m2], n=100) # profile over 100 iterations.
"""
results = []
if not isinstance(device, torch.device):
Expand Down Expand Up @@ -449,7 +449,7 @@ def __call__(self, epoch, fitness):
class ModelEMA:
"""Updated Exponential Moving Average (EMA) from https://github.com/rwightman/pytorch-image-models
Keeps a moving average of everything in the model state_dict (parameters and buffers)
For EMA details see https://www.tensorflow.org/api_docs/python/tf/train/ExponentialMovingAverage
For EMA details see https://www.tensorflow.org/api_docs/python/tf/train/ExponentialMovingAverage.
"""

def __init__(self, model, decay=0.9999, tau=2000, updates=0):
Expand Down
2 changes: 1 addition & 1 deletion utils/triton.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TritonRemoteModel:
def __init__(self, url: str):
"""
Keyword Arguments:
url: Fully qualified address of the Triton server - for e.g. grpc://localhost:8000
url: Fully qualified address of the Triton server - for e.g. grpc://localhost:8000.
"""
parsed_url = urlparse(url)
if parsed_url.scheme == "grpc":
Expand Down

0 comments on commit b40781b

Please sign in to comment.