Update README.md (#13283)
* 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>
This commit is contained in:
1 parent
427cfc4f73
commit
b40781b3e3
15 files changed
+27
-27
No files matched your search
@@ -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
|
||||
--- | --- | ---
|
||||
@@ -141,7 +141,7 @@ class iOSModel(torch.nn.Module):
|
||||
|
||||
|
||||
def export_formats():
|
||||
"""
|
||||
r"""
|
||||
Returns a DataFrame of supported YOLOv5 model export formats and their properties.
|
||||
|
||||
Returns:
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
@@ -316,7 +316,7 @@ class LoadScreenshots:
|
||||
|
||||
|
||||
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."""
|
||||
@@ -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
|
||||
|
||||
@@ -349,7 +349,7 @@ class Loggers:
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -47,7 +47,7 @@ class WandbLogger:
|
||||
"""
|
||||
- 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
|
||||
@@ -88,7 +88,7 @@ class WandbLogger:
|
||||
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
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ from utils.torch_utils import de_parallel
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -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]))
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
"""
|
||||
@@ -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
|
||||
"""
|
||||
@@ -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
|
||||
"""
|
||||
@@ -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
|
||||
@@ -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]
|
||||
"""
|
||||
@@ -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, )
|
||||
"""
|
||||
|
||||
@@ -127,7 +127,7 @@ class Metric:
|
||||
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):
|
||||
@@ -140,7 +140,7 @@ class Metric:
|
||||
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
|
||||
@@ -163,7 +163,7 @@ class Metrics:
|
||||
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()))
|
||||
|
||||
@@ -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):
|
||||
@@ -449,7 +449,7 @@ class EarlyStopping:
|
||||
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):
|
||||
|
||||
+1
-1
@@ -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":
|
||||
|
||||
Reference in new issue
Block a user