mirror of
https://github.com/ultralytics/ultralytics
synced 2026-04-21 14:07:18 +00:00
Fix documentation arg defaults (#23157)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
2ac2c26001
commit
af63df5965
11 changed files with 22 additions and 21 deletions
|
|
@ -29,13 +29,13 @@ Ultralytics YOLO supports the following tracking algorithms:
|
|||
from ultralytics import YOLO
|
||||
|
||||
model = YOLO("yolo11n.pt")
|
||||
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
|
||||
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.7, show=True)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3 iou=0.5 show=True
|
||||
yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.1 iou=0.7 show=True
|
||||
```
|
||||
|
||||
## Persisting Tracks Between Frames
|
||||
|
|
@ -90,13 +90,13 @@ To use Multi-Object Tracking with Ultralytics YOLO, you can start by using the P
|
|||
from ultralytics import YOLO
|
||||
|
||||
model = YOLO("yolo11n.pt") # Load the YOLO11 model
|
||||
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
|
||||
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.7, show=True)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3 iou=0.5 show=True
|
||||
yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.1 iou=0.7 show=True
|
||||
```
|
||||
|
||||
These commands load the YOLO11 model and use it for tracking objects in the given video source with specific confidence (`conf`) and [Intersection over Union](https://www.ultralytics.com/glossary/intersection-over-union-iou) (`iou`) thresholds. For more details, refer to the [track mode documentation](../../modes/track.md).
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ model = YOLO("yolo11n.pt")
|
|||
source = "https://ultralytics.com/images/bus.jpg"
|
||||
|
||||
# Make predictions
|
||||
results = model.predict(source, save=True, imgsz=320, conf=0.5)
|
||||
results = model.predict(source, save=True, imgsz=320, conf=0.25)
|
||||
|
||||
# Extract bounding box dimensions
|
||||
boxes = results[0].boxes.xywh.cpu()
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ Below are code examples for using each source type:
|
|||
model = YOLO("yolo11n.pt")
|
||||
|
||||
# Run inference on 'bus.jpg' with arguments
|
||||
model.predict("https://ultralytics.com/images/bus.jpg", save=True, imgsz=320, conf=0.5)
|
||||
model.predict("https://ultralytics.com/images/bus.jpg", save=True, imgsz=320, conf=0.25)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
|
|
|||
|
|
@ -106,14 +106,14 @@ Tracking configuration shares properties with Predict mode, such as `conf`, `iou
|
|||
|
||||
# Configure the tracking parameters and run the tracker
|
||||
model = YOLO("yolo11n.pt")
|
||||
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
|
||||
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.7, show=True)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
# Configure tracking parameters and run the tracker using the command line interface
|
||||
yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3, iou=0.5 show
|
||||
yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.1 iou=0.7 show
|
||||
```
|
||||
|
||||
### Tracker Selection
|
||||
|
|
|
|||
|
|
@ -115,13 +115,13 @@ The below examples showcase YOLO model validation with custom arguments in Pytho
|
|||
model = YOLO("yolo11n.pt")
|
||||
|
||||
# Customize validation settings
|
||||
metrics = model.val(data="coco8.yaml", imgsz=640, batch=16, conf=0.25, iou=0.6, device="0")
|
||||
metrics = model.val(data="coco8.yaml", imgsz=640, batch=16, conf=0.25, iou=0.7, device="0")
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
yolo val model=yolo11n.pt data=coco8.yaml imgsz=640 batch=16 conf=0.25 iou=0.6 device=0
|
||||
yolo val model=yolo11n.pt data=coco8.yaml imgsz=640 batch=16 conf=0.25 iou=0.7 device=0
|
||||
```
|
||||
|
||||
!!! tip "Export ConfusionMatrix"
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@
|
|||
| `nms` | `bool` | `False` | Adds Non-Maximum Suppression (NMS) to the exported model when supported (see [Export Formats](https://docs.ultralytics.com/modes/export/)), improving detection post-processing efficiency. Not available for end2end models. |
|
||||
| `batch` | `int` | `1` | Specifies export model batch inference size or the maximum number of images the exported model will process concurrently in `predict` mode. For Edge TPU exports, this is automatically set to 1. |
|
||||
| `device` | `str` | `None` | Specifies the device for exporting: GPU (`device=0`), CPU (`device=cpu`), MPS for Apple silicon (`device=mps`) or DLA for NVIDIA Jetson (`device=dla:0` or `device=dla:1`). TensorRT exports automatically use GPU. |
|
||||
| `data` | `str` | `'coco8.yaml'` | Path to the [dataset](https://docs.ultralytics.com/datasets/) configuration file (default: `coco8.yaml`), essential for INT8 quantization calibration. If not specified with INT8 enabled, a default dataset will be assigned. |
|
||||
| `data` | `str` | `'coco8.yaml'` | Path to the [dataset](https://docs.ultralytics.com/datasets/) configuration file, essential for INT8 quantization calibration. If not specified with INT8 enabled, `coco8.yaml` will be used as a fallback for calibration. |
|
||||
| `fraction` | `float` | `1.0` | Specifies the fraction of the dataset to use for INT8 quantization calibration. Allows for calibrating on a subset of the full dataset, useful for experiments or when resources are limited. If not specified with INT8 enabled, the full dataset will be used. |
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
"persist": ["bool", "False", "Enables persistent tracking of objects between frames, maintaining IDs across video sequences."],
|
||||
"stream": ["bool", "False", "Treats the input source as a continuous video stream for real-time processing."],
|
||||
"tracker": ["str", "'botsort.yaml'", "Specifies the tracking algorithm to use, e.g., `bytetrack.yaml` or `botsort.yaml`."],
|
||||
"conf": ["float", "0.3", "Sets the confidence threshold for detections; lower values allow more objects to be tracked but may include false positives."],
|
||||
"iou": ["float", "0.5", "Sets the [Intersection over Union](https://www.ultralytics.com/glossary/intersection-over-union-iou) (IoU) threshold for filtering overlapping detections."],
|
||||
"conf": ["float", "0.1", "Sets the confidence threshold for detections; lower values allow more objects to be tracked but may include false positives."],
|
||||
"iou": ["float", "0.7", "Sets the [Intersection over Union](https://www.ultralytics.com/glossary/intersection-over-union-iou) (IoU) threshold for filtering overlapping detections."],
|
||||
"classes": ["list", "None", "Filters results by class index. For example, `classes=[0, 2, 3]` only tracks the specified classes."],
|
||||
"verbose": ["bool", "True", "Controls the display of tracking results, providing a visual output of tracked objects."],
|
||||
"device": ["str", "None", "Specifies the device for inference (e.g., `cpu`, `cuda:0` or `0`). Allows users to select between CPU, a specific GPU, or other compute devices for model execution."],
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
| `optimizer` | `str` | `'auto'` | Choice of optimizer for training. Options include `SGD`, `Adam`, `AdamW`, `NAdam`, `RAdam`, `RMSProp` etc., or `auto` for automatic selection based on model configuration. Affects convergence speed and stability. |
|
||||
| `seed` | `int` | `0` | Sets the random seed for training, ensuring reproducibility of results across runs with the same configurations. |
|
||||
| `deterministic` | `bool` | `True` | Forces deterministic algorithm use, ensuring reproducibility but may affect performance and speed due to the restriction on non-deterministic algorithms. |
|
||||
| `verbose` | `bool` | `True` | Enables verbose output during training, displaying progress bars, per-epoch metrics, and additional training information in the console. |
|
||||
| `single_cls` | `bool` | `False` | Treats all classes in multi-class datasets as a single class during training. Useful for binary classification tasks or when focusing on object presence rather than classification. |
|
||||
| `classes` | `list[int]` | `None` | Specifies a list of class IDs to train on. Useful for filtering out and focusing only on certain classes during training. |
|
||||
| `rect` | `bool` | `False` | Enables minimum padding strategy—images in a batch are minimally padded to reach a common size, with the longest side equal to `imgsz`. Can improve efficiency and speed but may affect model accuracy. |
|
||||
|
|
@ -41,11 +42,11 @@
|
|||
| `cls` | `float` | `0.5` | Weight of the classification loss in the total loss function, affecting the importance of correct class prediction relative to other components. |
|
||||
| `dfl` | `float` | `1.5` | Weight of the distribution focal loss, used in certain YOLO versions for fine-grained classification. |
|
||||
| `pose` | `float` | `12.0` | Weight of the pose loss in models trained for pose estimation, influencing the emphasis on accurately predicting pose keypoints. |
|
||||
| `kobj` | `float` | `2.0` | Weight of the keypoint objectness loss in pose estimation models, balancing detection confidence with pose accuracy. |
|
||||
| `kobj` | `float` | `1.0` | Weight of the keypoint objectness loss in pose estimation models, balancing detection confidence with pose accuracy. |
|
||||
| `nbs` | `int` | `64` | Nominal batch size for normalization of loss. |
|
||||
| `overlap_mask` | `bool` | `True` | Determines whether object masks should be merged into a single mask for training, or kept separate for each object. In case of overlap, the smaller mask is overlaid on top of the larger mask during merge. |
|
||||
| `mask_ratio` | `int` | `4` | Downsample ratio for segmentation masks, affecting the resolution of masks used during training. |
|
||||
| `dropout` | `float` | `0.0` | Dropout rate for regularization in classification tasks, preventing overfitting by randomly omitting units during training. |
|
||||
| `val` | `bool` | `True` | Enables validation during training, allowing for periodic evaluation of model performance on a separate dataset. |
|
||||
| `plots` | `bool` | `False` | Generates and saves plots of training and validation metrics, as well as prediction examples, providing visual insights into model performance and learning progression. |
|
||||
| `plots` | `bool` | `True` | Generates and saves plots of training and validation metrics, as well as prediction examples, providing visual insights into model performance and learning progression. |
|
||||
| `compile` | `bool` or `str` | `False` | Enables PyTorch 2.x `torch.compile` graph compilation with `backend='inductor'`. Accepts `True` → `"default"`, `False` → disables, or a string mode such as `"default"`, `"reduce-overhead"`, `"max-autotune-no-cudagraphs"`. Falls back to eager with a warning if unsupported. |
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@
|
|||
| `conf` | `float` | `0.001` | Sets the minimum confidence threshold for detections. Lower values increase recall but may introduce more false positives. Used during [validation](https://docs.ultralytics.com/modes/val/) to compute precision-recall curves. |
|
||||
| `iou` | `float` | `0.7` | Sets the [Intersection Over Union](https://www.ultralytics.com/glossary/intersection-over-union-iou) threshold for [Non-Maximum Suppression](https://www.ultralytics.com/glossary/non-maximum-suppression-nms). Controls duplicate detection elimination. |
|
||||
| `max_det` | `int` | `300` | Limits the maximum number of detections per image. Useful in dense scenes to prevent excessive detections and manage computational resources. |
|
||||
| `half` | `bool` | `True` | Enables half-[precision](https://www.ultralytics.com/glossary/precision) (FP16) computation, reducing memory usage and potentially increasing speed with minimal impact on [accuracy](https://www.ultralytics.com/glossary/accuracy). |
|
||||
| `half` | `bool` | `False` | Enables half-[precision](https://www.ultralytics.com/glossary/precision) (FP16) computation, reducing memory usage and potentially increasing speed with minimal impact on [accuracy](https://www.ultralytics.com/glossary/accuracy). |
|
||||
| `device` | `str` | `None` | Specifies the device for validation (`cpu`, `cuda:0`, etc.). When `None`, automatically selects the best available device. Multiple CUDA devices can be specified with comma separation. |
|
||||
| `dnn` | `bool` | `False` | If `True`, uses the [OpenCV](https://www.ultralytics.com/glossary/opencv) DNN module for ONNX model inference, offering an alternative to [PyTorch](https://www.ultralytics.com/glossary/pytorch) inference methods. |
|
||||
| `plots` | `bool` | `False` | When set to `True`, generates and saves plots of predictions versus ground truth, confusion matrices, and PR curves for visual evaluation of model performance. |
|
||||
| `plots` | `bool` | `True` | When set to `True`, generates and saves plots of predictions versus ground truth, confusion matrices, and PR curves for visual evaluation of model performance. |
|
||||
| `classes` | `list[int]` | `None` | Specifies a list of class IDs to evaluate. Useful for filtering out and focusing only on certain classes during evaluation. |
|
||||
| `rect` | `bool` | `True` | If `True`, uses rectangular inference for batching, reducing padding and potentially increasing speed and efficiency by processing images in their original aspect ratio. |
|
||||
| `split` | `str` | `'val'` | Determines the dataset split to use for validation (`val`, `test`, or `train`). Allows flexibility in choosing the data segment for performance evaluation. |
|
||||
| `project` | `str` | `None` | Name of the project directory where validation outputs are saved. Helps organize results from different experiments or models. |
|
||||
| `name` | `str` | `None` | Name of the validation run. Used for creating a subdirectory within the project folder, where validation logs and outputs are stored. |
|
||||
| `verbose` | `bool` | `False` | If `True`, displays detailed information during the validation process, including per-class metrics, batch progress, and additional debugging information. |
|
||||
| `verbose` | `bool` | `True` | If `True`, displays detailed information during the validation process, including per-class metrics, batch progress, and additional debugging information. |
|
||||
| `save_txt` | `bool` | `False` | If `True`, saves detection results in text files, with one file per image, useful for further analysis, custom post-processing, or integration with other systems. |
|
||||
| `save_conf` | `bool` | `False` | If `True`, includes confidence values in the saved text files when `save_txt` is enabled, providing more detailed output for analysis and filtering. |
|
||||
| `workers` | `int` | `8` | Number of worker threads for data loading. Higher values can speed up data preprocessing but may increase CPU usage. Setting to 0 uses main thread, which can be more stable in some environments. |
|
||||
|
|
|
|||
|
|
@ -81,13 +81,13 @@ from ultralytics import YOLO
|
|||
|
||||
# Configure the tracking parameters and run the tracker
|
||||
model = YOLO("yolo11n.pt")
|
||||
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
|
||||
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.1, iou=0.7, show=True)
|
||||
```
|
||||
|
||||
```bash
|
||||
# CLI
|
||||
# Configure tracking parameters and run the tracker using the command line interface
|
||||
yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3 iou=0.5 show
|
||||
yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.1 iou=0.7 show
|
||||
```
|
||||
|
||||
### Tracker Selection
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ def torch2imx(
|
|||
Examples:
|
||||
>>> from ultralytics import YOLO
|
||||
>>> model = YOLO("yolo11n.pt")
|
||||
>>> path, _ = export_imx(model, "model.imx", conf=0.25, iou=0.45, max_det=300)
|
||||
>>> path, _ = export_imx(model, "model.imx", conf=0.25, iou=0.7, max_det=300)
|
||||
|
||||
Notes:
|
||||
- Requires model_compression_toolkit, onnx, edgemdt_tpc, and edge-mdt-cl packages
|
||||
|
|
|
|||
Loading…
Reference in a new issue