From cf33b64ad4d54daf8e9d0ff8bb28f1f962fa623b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 20 Mar 2025 20:24:06 +0100 Subject: [PATCH] Add bash codeblock formatting (#19804) Signed-off-by: Glenn Jocher Co-authored-by: UltralyticsAssistant --- docs/en/datasets/detect/coco128.md | 28 ++--- docs/en/datasets/detect/sku-110k.md | 16 +-- docs/en/guides/analytics.md | 14 +-- docs/en/guides/azureml-quickstart.md | 6 +- docs/en/guides/conda-quickstart.md | 4 +- .../guides/coral-edge-tpu-on-raspberry-pi.md | 8 +- docs/en/guides/deepstream-nvidia-jetson.md | 12 +- docs/en/guides/distance-calculation.md | 2 +- docs/en/guides/docker-quickstart.md | 20 ++-- docs/en/guides/heatmaps.md | 10 +- .../instance-segmentation-and-tracking.md | 6 +- docs/en/guides/nvidia-jetson.md | 4 +- docs/en/guides/object-blurring.md | 6 +- docs/en/guides/object-counting.md | 6 +- docs/en/guides/object-cropping.md | 4 +- docs/en/guides/parking-management.md | 2 +- docs/en/guides/queue-management.md | 6 +- docs/en/guides/raspberry-pi.md | 4 +- docs/en/guides/region-counting.md | 2 +- docs/en/guides/security-alarm-system.md | 2 +- docs/en/guides/speed-estimation.md | 8 +- docs/en/guides/streamlit-live-inference.md | 8 +- docs/en/guides/trackzone.md | 10 +- docs/en/guides/vision-eye.md | 6 +- docs/en/guides/workouts-monitoring.md | 8 +- docs/en/hub/inference-api.md | 60 +++++----- docs/en/integrations/clearml.md | 2 +- docs/en/integrations/comet.md | 4 +- docs/en/integrations/coreml.md | 2 +- docs/en/integrations/edge-tpu.md | 4 +- docs/en/integrations/mlflow.md | 4 +- docs/en/integrations/mnn.md | 12 +- docs/en/integrations/ncnn.md | 4 +- docs/en/integrations/onnx.md | 4 +- docs/en/integrations/openvino.md | 4 +- docs/en/integrations/paddlepaddle.md | 4 +- docs/en/integrations/ray-tune.md | 2 +- docs/en/integrations/rockchip-rknn.md | 2 +- docs/en/integrations/sony-imx500.md | 10 +- docs/en/integrations/tensorboard.md | 4 +- docs/en/integrations/tensorrt.md | 4 +- docs/en/integrations/tf-graphdef.md | 4 +- docs/en/integrations/tf-savedmodel.md | 4 +- docs/en/integrations/tfjs.md | 4 +- docs/en/integrations/tflite.md | 4 +- docs/en/integrations/torchscript.md | 4 +- docs/en/integrations/weights-biases.md | 6 +- docs/en/models/fast-sam.md | 2 +- docs/en/models/yolo-world.md | 2 +- docs/en/modes/export.md | 10 +- docs/en/modes/track.md | 6 +- docs/en/modes/train.md | 4 +- docs/en/modes/val.md | 4 +- docs/en/quickstart.md | 22 ++-- docs/en/solutions/index.md | 4 +- docs/en/tasks/classify.md | 10 +- docs/en/tasks/detect.md | 12 +- docs/en/tasks/index.md | 2 +- docs/en/tasks/obb.md | 8 +- docs/en/tasks/pose.md | 12 +- docs/en/tasks/segment.md | 6 +- docs/en/usage/cli.md | 14 +-- docs/en/usage/engine.md | 2 +- docs/en/usage/simple-utilities.md | 6 +- .../environments/aws_quickstart_tutorial.md | 14 +-- .../azureml_quickstart_tutorial.md | 2 +- .../google_cloud_quickstart_tutorial.md | 2 +- docs/en/yolov5/quickstart_tutorial.md | 34 +++--- .../tutorials/clearml_logging_integration.md | 6 +- .../tutorials/comet_logging_integration.md | 109 ++++++++---------- .../tutorials/hyperparameter_evolution.md | 30 ++--- docs/en/yolov5/tutorials/model_ensembling.md | 10 +- docs/en/yolov5/tutorials/model_export.md | 54 ++++----- .../tutorials/model_pruning_and_sparsity.md | 8 +- .../en/yolov5/tutorials/multi_gpu_training.md | 4 +- .../neural_magic_pruning_quantization.md | 52 ++++----- .../tutorials/test_time_augmentation.md | 10 +- .../tips_for_best_training_results.md | 14 +-- docs/en/yolov5/tutorials/train_custom_data.md | 14 +-- .../transfer_learning_with_frozen_layers.md | 4 +- examples/YOLOv8-ONNXRuntime-Rust/README.md | 37 +++--- .../YOLOv8-OpenVINO-CPP-Inference/README.md | 4 +- .../README.md | 6 +- examples/heatmaps.ipynb | 2 +- examples/object_counting.ipynb | 2 +- examples/object_tracking.ipynb | 4 +- ultralytics/cfg/__init__.py | 10 +- ultralytics/solutions/queue_management.py | 2 +- ultralytics/trackers/README.md | 6 +- 89 files changed, 459 insertions(+), 461 deletions(-) diff --git a/docs/en/datasets/detect/coco128.md b/docs/en/datasets/detect/coco128.md index 5f7be503..44999a9b 100644 --- a/docs/en/datasets/detect/coco128.md +++ b/docs/en/datasets/detect/coco128.md @@ -99,23 +99,26 @@ The Ultralytics COCO128 dataset is a compact subset containing the first 128 ima To train a YOLO11 model on the COCO128 dataset, you can use either Python or CLI commands. Here's how: -=== "Python" +!!! example "Train Example" -````python -from ultralytics import YOLO + === "Python" - # Load a pretrained model - model = YOLO("yolo11n.pt") + ```python + from ultralytics import YOLO - # Train the model - results = model.train(data="coco128.yaml", epochs=100, imgsz=640) - ``` + # Load a pretrained model + model = YOLO("yolo11n.pt") -=== "CLI" + # Train the model + results = model.train(data="coco128.yaml", epochs=100, imgsz=640) + ``` -`bash - yolo detect train data=coco128.yaml model=yolo11n.pt epochs=100 imgsz=640 - ` + + === "CLI" + + ```bash + yolo detect train data=coco128.yaml model=yolo11n.pt epochs=100 imgsz=640 + ``` For more training options and parameters, refer to the [Training](../../modes/train.md) documentation. @@ -149,4 +152,3 @@ While COCO128 is primarily designed for object detection, the dataset's annotati - **Transfer learning**: As a starting point for fine-tuning models for custom tasks For specialized tasks like [segmentation](../../tasks/segment.md), consider using purpose-built variants like [COCO8-seg](../segment/coco8-seg.md) which include the appropriate annotations. -```` diff --git a/docs/en/datasets/detect/sku-110k.md b/docs/en/datasets/detect/sku-110k.md index f68c3c9c..3d9b2926 100644 --- a/docs/en/datasets/detect/sku-110k.md +++ b/docs/en/datasets/detect/sku-110k.md @@ -102,10 +102,10 @@ If you use the SKU-110k dataset in your research or development work, please cit ```bibtex @inproceedings{goldman2019dense, - author = {Eran Goldman and Roei Herzig and Aviv Eisenschtat and Jacob Goldberger and Tal Hassner}, - title = {Precise Detection in Densely Packed Scenes}, - booktitle = {Proc. Conf. Comput. Vision Pattern Recognition (CVPR)}, - year = {2019} + author = {Eran Goldman and Roei Herzig and Aviv Eisenschtat and Jacob Goldberger and Tal Hassner}, + title = {Precise Detection in Densely Packed Scenes}, + booktitle = {Proc. Conf. Comput. Vision Pattern Recognition (CVPR)}, + year = {2019} } ``` @@ -179,10 +179,10 @@ If you use the SKU-110k dataset in your research or development work, please cit ```bibtex @inproceedings{goldman2019dense, - author = {Eran Goldman and Roei Herzig and Aviv Eisenschtat and Jacob Goldberger and Tal Hassner}, - title = {Precise Detection in Densely Packed Scenes}, - booktitle = {Proc. Conf. Comput. Vision Pattern Recognition (CVPR)}, - year = {2019} + author = {Eran Goldman and Roei Herzig and Aviv Eisenschtat and Jacob Goldberger and Tal Hassner}, + title = {Precise Detection in Densely Packed Scenes}, + booktitle = {Proc. Conf. Comput. Vision Pattern Recognition (CVPR)}, + year = {2019} } ``` diff --git a/docs/en/guides/analytics.md b/docs/en/guides/analytics.md index ae8b5c26..da2dc4b6 100644 --- a/docs/en/guides/analytics.md +++ b/docs/en/guides/analytics.md @@ -38,10 +38,10 @@ This guide provides a comprehensive overview of three fundamental types of [data === "CLI" ```bash - yolo solutions analytics show=True + yolo solutions analytics show=True # Pass the source - yolo solutions analytics source="path/to/video/file.mp4" + yolo solutions analytics source="path/to/video.mp4" # Generate the pie chart yolo solutions analytics analytics_type="pie" show=True @@ -60,7 +60,7 @@ This guide provides a comprehensive overview of three fundamental types of [data from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer @@ -138,7 +138,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("Path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) @@ -188,7 +188,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("Path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) @@ -238,7 +238,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("Path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) @@ -283,7 +283,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("Path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) diff --git a/docs/en/guides/azureml-quickstart.md b/docs/en/guides/azureml-quickstart.md index d13f9812..5e70ca57 100644 --- a/docs/en/guides/azureml-quickstart.md +++ b/docs/en/guides/azureml-quickstart.md @@ -61,7 +61,7 @@ Install the required dependencies: cd ultralytics pip install -r requirements.txt pip install ultralytics -pip install onnx>=1.12.0 +pip install onnx ``` ### Perform YOLO11 tasks @@ -110,7 +110,7 @@ source activate yolo11env cd ultralytics pip install -r requirements.txt pip install ultralytics -pip install onnx>=1.12.0 +pip install onnx ``` Note that we need to use the `source activate yolo11env` for all the %%bash cells, to make sure that the %%bash cell uses environment we want. @@ -166,7 +166,7 @@ Running YOLO11 on AzureML for model training involves several steps: conda create --name yolo11env -y python=3.12 conda activate yolo11env conda install pip -y - pip install ultralytics onnx>=1.12.0 + pip install ultralytics onnx ``` 3. **Run YOLO11 Tasks**: Use the Ultralytics CLI to train your model: diff --git a/docs/en/guides/conda-quickstart.md b/docs/en/guides/conda-quickstart.md index e6095b60..8acbebaf 100644 --- a/docs/en/guides/conda-quickstart.md +++ b/docs/en/guides/conda-quickstart.md @@ -98,8 +98,8 @@ Run the image: ```bash # Run the Ultralytics image in a container with GPU support -sudo docker run -it --ipc=host --gpus all $t # all GPUs -sudo docker run -it --ipc=host --gpus '"device=2,3"' $t # specify GPUs +sudo docker run -it --ipc=host --gpus all $t # all GPUs +sudo docker run -it --ipc=host --gpus '"device=2,3"' $t # specify GPUs ``` ## Speeding Up Installation with Libmamba diff --git a/docs/en/guides/coral-edge-tpu-on-raspberry-pi.md b/docs/en/guides/coral-edge-tpu-on-raspberry-pi.md index 3a445e29..5bac6fef 100644 --- a/docs/en/guides/coral-edge-tpu-on-raspberry-pi.md +++ b/docs/en/guides/coral-edge-tpu-on-raspberry-pi.md @@ -103,7 +103,7 @@ To use the Edge TPU, you need to convert your model into a compatible format. It === "CLI" ```bash - yolo export model=path/to/model.pt format=edgetpu # Export an official model or custom model + yolo export model=path/to/model.pt format=edgetpu # Export an official model or custom model ``` The exported model will be saved in the `_saved_model/` folder with the name `_full_integer_quant_edgetpu.tflite`. It is important that your model ends with the suffix `_edgetpu.tflite`, otherwise ultralytics doesn't know that you're using an Edge TPU model. @@ -143,7 +143,7 @@ Now you can run inference using the following code: === "CLI" ```bash - yolo predict model=path/to/_full_integer_quant_edgetpu.tflite source=path/to/source.png # Load an official model or custom model + yolo predict model=path/to/MODEL_NAME_full_integer_quant_edgetpu.tflite source=path/to/source.png # Load an official model or custom model ``` Find comprehensive information on the [Predict](../modes/predict.md) page for full prediction mode details. @@ -238,7 +238,7 @@ Yes, you can export your Ultralytics YOLO11 model to be compatible with the Cora === "CLI" ```bash - yolo export model=path/to/model.pt format=edgetpu # Export an official model or custom model + yolo export model=path/to/model.pt format=edgetpu # Export an official model or custom model ``` For more information, refer to the [Export Mode](../modes/export.md) documentation. @@ -280,7 +280,7 @@ After exporting your YOLO11 model to an Edge TPU-compatible format, you can run === "CLI" ```bash - yolo predict model=path/to/edgetpu_model.tflite source=path/to/source.png # Load an official model or custom model + yolo predict model=path/to/edgetpu_model.tflite source=path/to/source.png # Load an official model or custom model ``` Comprehensive details on full prediction mode features can be found on the [Predict Page](../modes/predict.md). diff --git a/docs/en/guides/deepstream-nvidia-jetson.md b/docs/en/guides/deepstream-nvidia-jetson.md index fed95023..1d70dbaa 100644 --- a/docs/en/guides/deepstream-nvidia-jetson.md +++ b/docs/en/guides/deepstream-nvidia-jetson.md @@ -245,8 +245,8 @@ If you want to use INT8 precision for inference, you need to follow the steps be 5. Run the following to select 1000 random images from COCO dataset to run calibration ```bash - for jpg in $(ls -1 val2017/*.jpg | sort -R | head -1000); do \ - cp ${jpg} calibration/; \ + for jpg in $(ls -1 val2017/*.jpg | sort -R | head -1000); do + cp ${jpg} calibration/ done ``` @@ -319,10 +319,10 @@ To set up multiple streams under a single deepstream application, you can do the [source0] enable=1 type=3 - uri= - uri= - uri= - uri= + uri=path/to/video1.jpg + uri=path/to/video2.jpg + uri=path/to/video3.jpg + uri=path/to/video4.jpg num-sources=4 ``` diff --git a/docs/en/guides/distance-calculation.md b/docs/en/guides/distance-calculation.md index 5c54b6ea..007f9061 100644 --- a/docs/en/guides/distance-calculation.md +++ b/docs/en/guides/distance-calculation.md @@ -55,7 +55,7 @@ Measuring the gap between two objects is known as distance calculation within a from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer diff --git a/docs/en/guides/docker-quickstart.md b/docs/en/guides/docker-quickstart.md index 3e0b4e9d..756494db 100644 --- a/docs/en/guides/docker-quickstart.md +++ b/docs/en/guides/docker-quickstart.md @@ -175,9 +175,9 @@ Setup and configuration of an X11 or Wayland display server is outside the scope ```bash xhost +local:docker && docker run -e DISPLAY=$DISPLAY \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -v ~/.Xauthority:/root/.Xauthority \ - -it --ipc=host $t + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -v ~/.Xauthority:/root/.Xauthority \ + -it --ipc=host $t ``` This command sets the `DISPLAY` environment variable to the host's display, mounts the X11 socket, and maps the `.Xauthority` file to the container. The `xhost +local:docker` command allows the Docker container to access the X11 server. @@ -189,8 +189,8 @@ Setup and configuration of an X11 or Wayland display server is outside the scope ```bash xhost +local:docker && docker run -e DISPLAY=$DISPLAY \ - -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \ - --net=host -it --ipc=host $t + -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \ + --net=host -it --ipc=host $t ``` This command sets the `DISPLAY` environment variable to the host's display, mounts the Wayland socket, and allows the Docker container to access the Wayland server. @@ -257,17 +257,17 @@ To visualize YOLO prediction results with a GUI in a Docker container, you need ```bash xhost +local:docker && docker run -e DISPLAY=$DISPLAY \ --v /tmp/.X11-unix:/tmp/.X11-unix \ --v ~/.Xauthority:/root/.Xauthority \ --it --ipc=host ultralytics/ultralytics:latest + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -v ~/.Xauthority:/root/.Xauthority \ + -it --ipc=host ultralytics/ultralytics:latest ``` For systems running Wayland, use: ```bash xhost +local:docker && docker run -e DISPLAY=$DISPLAY \ --v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \ ---net=host -it --ipc=host ultralytics/ultralytics:latest + -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \ + --net=host -it --ipc=host ultralytics/ultralytics:latest ``` More information can be found in the [Run graphical user interface (GUI) applications in a Docker Container](#run-graphical-user-interface-gui-applications-in-a-docker-container) section. diff --git a/docs/en/guides/heatmaps.md b/docs/en/guides/heatmaps.md index 617d0424..0c71e19c 100644 --- a/docs/en/guides/heatmaps.md +++ b/docs/en/guides/heatmaps.md @@ -45,13 +45,13 @@ A heatmap generated with [Ultralytics YOLO11](https://github.com/ultralytics/ult yolo solutions heatmap show=True # Pass a source video - yolo solutions heatmap source="path/to/video/file.mp4" + yolo solutions heatmap source="path/to/video.mp4" # Pass a custom colormap yolo solutions heatmap colormap=cv2.COLORMAP_INFERNO # Heatmaps + object counting - yolo solutions heatmap region=[(20, 400), (1080, 400), (1080, 360), (20, 360)] + yolo solutions heatmap region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" ``` === "Python" @@ -61,7 +61,7 @@ A heatmap generated with [Ultralytics YOLO11](https://github.com/ultralytics/ult from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer @@ -175,7 +175,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") heatmap = solutions.Heatmap(colormap=cv2.COLORMAP_PARULA, show=True, model="yolo11n.pt") while cap.isOpened(): @@ -202,7 +202,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") heatmap = solutions.Heatmap(show=True, model="yolo11n.pt", classes=[0, 2]) while cap.isOpened(): diff --git a/docs/en/guides/instance-segmentation-and-tracking.md b/docs/en/guides/instance-segmentation-and-tracking.md index 22b02338..013b7d6b 100644 --- a/docs/en/guides/instance-segmentation-and-tracking.md +++ b/docs/en/guides/instance-segmentation-and-tracking.md @@ -45,7 +45,7 @@ There are two types of instance segmentation tracking available in the Ultralyti yolo solutions isegment show=True # Pass a source video - yolo solutions isegment source="path/to/video/file.mp4" + yolo solutions isegment source="path/to/video.mp4" # Monitor the specific classes yolo solutions isegment classes=[0, 5] @@ -58,7 +58,7 @@ There are two types of instance segmentation tracking available in the Ultralyti from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer @@ -143,7 +143,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("Path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer diff --git a/docs/en/guides/nvidia-jetson.md b/docs/en/guides/nvidia-jetson.md index 0c989727..2be67670 100644 --- a/docs/en/guides/nvidia-jetson.md +++ b/docs/en/guides/nvidia-jetson.md @@ -273,7 +273,7 @@ The YOLO11n model in PyTorch format is converted to TensorRT to run inference wi ```bash # Export a YOLO11n PyTorch model to TensorRT format - yolo export model=yolo11n.pt format=engine # creates 'yolo11n.engine' + yolo export model=yolo11n.pt format=engine # creates 'yolo11n.engine' # Run inference with the exported model yolo predict model=yolo11n.engine source='https://ultralytics.com/images/bus.jpg' @@ -322,7 +322,7 @@ The following Jetson devices are equipped with DLA hardware: ```bash # Export a YOLO11n PyTorch model to TensorRT format with DLA enabled (only works with FP16 or INT8) # Once DLA core number is specified at export, it will use the same core at inference - yolo export model=yolo11n.pt format=engine device="dla:0" half=True # dla:0 or dla:1 corresponds to the DLA cores + yolo export model=yolo11n.pt format=engine device="dla:0" half=True # dla:0 or dla:1 corresponds to the DLA cores # Run inference with the exported model on the DLA yolo predict model=yolo11n.engine source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/guides/object-blurring.md b/docs/en/guides/object-blurring.md index c5ce7952..b77657d5 100644 --- a/docs/en/guides/object-blurring.md +++ b/docs/en/guides/object-blurring.md @@ -38,7 +38,7 @@ Object blurring with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly yolo solutions blur show=True # Pass a source video - yolo solutions blur source="path/to/video/file.mp4" + yolo solutions blur source="path/to/video.mp4" # Blur the specific classes yolo solutions blur classes=[0, 5] @@ -51,7 +51,7 @@ Object blurring with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer @@ -136,7 +136,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("Path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) diff --git a/docs/en/guides/object-counting.md b/docs/en/guides/object-counting.md index 2d151e82..8edccc8e 100644 --- a/docs/en/guides/object-counting.md +++ b/docs/en/guides/object-counting.md @@ -45,10 +45,10 @@ Object counting with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly yolo solutions count show=True # Pass a source video - yolo solutions count source="path/to/video/file.mp4" + yolo solutions count source="path/to/video.mp4" # Pass region coordinates - yolo solutions count region=[(20, 400), (1080, 400), (1080, 360), (20, 360)] + yolo solutions count region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" ``` === "Python" @@ -58,7 +58,7 @@ Object counting with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly from ultralytics import solutions - cap = cv2.VideoCapture("path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # region_points = [(20, 400), (1080, 400)] # line counting diff --git a/docs/en/guides/object-cropping.md b/docs/en/guides/object-cropping.md index 85b4fa72..1098ded0 100644 --- a/docs/en/guides/object-cropping.md +++ b/docs/en/guides/object-cropping.md @@ -43,7 +43,7 @@ Object cropping with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly yolo solutions crop show=True # Pass a source video - yolo solutions crop source="path/to/video/file.mp4" + yolo solutions crop source="path/to/video.mp4" # Crop specific classes yolo solutions crop classes=[0, 2] @@ -56,7 +56,7 @@ Object cropping with [Ultralytics YOLO11](https://github.com/ultralytics/ultraly from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Initialize object cropper object diff --git a/docs/en/guides/parking-management.md b/docs/en/guides/parking-management.md index 088c384b..cb933d7f 100644 --- a/docs/en/guides/parking-management.md +++ b/docs/en/guides/parking-management.md @@ -80,7 +80,7 @@ Parking management with [Ultralytics YOLO11](https://github.com/ultralytics/ultr from ultralytics import solutions # Video capture - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer diff --git a/docs/en/guides/queue-management.md b/docs/en/guides/queue-management.md index 17c68dc7..28ef70c1 100644 --- a/docs/en/guides/queue-management.md +++ b/docs/en/guides/queue-management.md @@ -44,10 +44,10 @@ Queue management using [Ultralytics YOLO11](https://github.com/ultralytics/ultra yolo solutions queue show=True # Pass a source video - yolo solutions queue source="path/to/video/file.mp4" + yolo solutions queue source="path/to/video.mp4" # Pass queue coordinates - yolo solutions queue region=[(20, 400), (1080, 400), (1080, 360), (20, 360)] + yolo solutions queue region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" ``` === "Python" @@ -57,7 +57,7 @@ Queue management using [Ultralytics YOLO11](https://github.com/ultralytics/ultra from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer diff --git a/docs/en/guides/raspberry-pi.md b/docs/en/guides/raspberry-pi.md index e90e7219..a717bdd0 100644 --- a/docs/en/guides/raspberry-pi.md +++ b/docs/en/guides/raspberry-pi.md @@ -125,7 +125,7 @@ The YOLO11n model in PyTorch format is converted to NCNN to run inference with t ```bash # Export a YOLO11n PyTorch model to NCNN format - yolo export model=yolo11n.pt format=ncnn # creates 'yolo11n_ncnn_model' + yolo export model=yolo11n.pt format=ncnn # creates 'yolo11n_ncnn_model' # Run inference with the exported model yolo predict model='yolo11n_ncnn_model' source='https://ultralytics.com/images/bus.jpg' @@ -400,7 +400,7 @@ You can convert a PyTorch YOLO11 model to NCNN format using either Python or CLI ```bash # Export a YOLO11n PyTorch model to NCNN format - yolo export model=yolo11n.pt format=ncnn # creates 'yolo11n_ncnn_model' + yolo export model=yolo11n.pt format=ncnn # creates 'yolo11n_ncnn_model' # Run inference with the exported model yolo predict model='yolo11n_ncnn_model' source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/guides/region-counting.md b/docs/en/guides/region-counting.md index 7e7e8575..0d2ac443 100644 --- a/docs/en/guides/region-counting.md +++ b/docs/en/guides/region-counting.md @@ -43,7 +43,7 @@ keywords: object counting, regions, YOLO11, computer vision, Ultralytics, effici from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Pass region as list diff --git a/docs/en/guides/security-alarm-system.md b/docs/en/guides/security-alarm-system.md index 186814c5..2ae224d9 100644 --- a/docs/en/guides/security-alarm-system.md +++ b/docs/en/guides/security-alarm-system.md @@ -40,7 +40,7 @@ The Security Alarm System Project utilizing Ultralytics YOLO11 integrates advanc from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer diff --git a/docs/en/guides/speed-estimation.md b/docs/en/guides/speed-estimation.md index 89e5396e..bc576d56 100644 --- a/docs/en/guides/speed-estimation.md +++ b/docs/en/guides/speed-estimation.md @@ -51,10 +51,10 @@ keywords: Ultralytics YOLO11, speed estimation, object tracking, computer vision yolo solutions speed show=True # Pass a source video - yolo solutions speed source="path/to/video/file.mp4" + yolo solutions speed source="path/to/video.mp4" # Pass region coordinates - yolo solutions speed region=[(20, 400), (1080, 400), (1080, 360), (20, 360)] + yolo solutions speed region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" ``` === "Python" @@ -64,7 +64,7 @@ keywords: Ultralytics YOLO11, speed estimation, object tracking, computer vision from ultralytics import solutions - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer @@ -132,7 +132,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) video_writer = cv2.VideoWriter("speed_estimation.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h)) diff --git a/docs/en/guides/streamlit-live-inference.md b/docs/en/guides/streamlit-live-inference.md index 8e27304a..1eecb3a6 100644 --- a/docs/en/guides/streamlit-live-inference.md +++ b/docs/en/guides/streamlit-live-inference.md @@ -59,7 +59,7 @@ Streamlit makes it simple to build and deploy interactive web applications. Comb inf.inference() - ### Make sure to run the file using command `streamlit run ` + # Make sure to run the file using command `streamlit run path/to/file.py` ``` This will launch the Streamlit application in your default web browser. You will see the main title, subtitle, and the sidebar with configuration options. Select your desired YOLO11 model, set the confidence and [NMS thresholds](https://www.ultralytics.com/glossary/non-maximum-suppression-nms), and click the "Start" button to begin the real-time object detection. @@ -79,7 +79,7 @@ You can optionally supply a specific model in Python: inf.inference() - ### Make sure to run the file using command `streamlit run ` + # Make sure to run the file using command `streamlit run path/to/file.py` ``` ## How It Works @@ -138,7 +138,7 @@ Then, you can create a basic Streamlit application to run live inference: inf.inference() - ### Make sure to run the file using command `streamlit run ` + # Make sure to run the file using command `streamlit run path/to/file.py` ``` === "CLI" @@ -164,7 +164,7 @@ Discover more about these advantages [here](#advantages-of-live-inference). After coding your Streamlit application integrating Ultralytics YOLO11, you can deploy it by running: ```bash -streamlit run +streamlit run path/to/file.py ``` This command will launch the application in your default web browser, enabling you to select YOLO11 models, set confidence and NMS thresholds, and start real-time object detection with a simple click. For a detailed guide, refer to the [Streamlit Application Code](#streamlit-application-code) section. diff --git a/docs/en/guides/trackzone.md b/docs/en/guides/trackzone.md index 52076333..de07ff6f 100644 --- a/docs/en/guides/trackzone.md +++ b/docs/en/guides/trackzone.md @@ -46,10 +46,10 @@ TrackZone specializes in monitoring objects within designated areas of a frame i yolo solutions trackzone show=True # Pass a source video - yolo solutions trackzone show=True source="path/to/video/file.mp4" + yolo solutions trackzone show=True source="path/to/video.mp4" # Pass region coordinates - yolo solutions trackzone show=True region=[(150, 150), (1130, 150), (1130, 570), (150, 570)] + yolo solutions trackzone show=True region="[(150, 150), (1130, 150), (1130, 570), (150, 570)]" ``` === "Python" @@ -59,7 +59,7 @@ TrackZone specializes in monitoring objects within designated areas of a frame i from ultralytics import solutions - cap = cv2.VideoCapture("path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Define region points @@ -119,7 +119,7 @@ Moreover, the following visualization options are available: Tracking objects in a defined area or zone of a video frame is straightforward with Ultralytics YOLO11. Simply use the command provided below to initiate tracking. This approach ensures efficient analysis and accurate results, making it ideal for applications like surveillance, crowd management, or any scenario requiring zonal tracking. ```bash -yolo solutions trackzone source="path/to/video/file.mp4" show=True +yolo solutions trackzone source="path/to/video.mp4" show=True ``` ### How can I use TrackZone in Python with Ultralytics YOLO11? @@ -131,7 +131,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) diff --git a/docs/en/guides/vision-eye.md b/docs/en/guides/vision-eye.md index 2df9f237..ada840d2 100644 --- a/docs/en/guides/vision-eye.md +++ b/docs/en/guides/vision-eye.md @@ -23,7 +23,7 @@ keywords: VisionEye, YOLO11, Ultralytics, object mapping, object tracking, dista yolo solutions visioneye show=True # Pass a source video - yolo solutions visioneye source="path/to/video/file.mp4" + yolo solutions visioneye source="path/to/video.mp4" # Monitor the specific classes yolo solutions visioneye classes=[0, 5] @@ -36,7 +36,7 @@ keywords: VisionEye, YOLO11, Ultralytics, object mapping, object tracking, dista from ultralytics import solutions - cap = cv2.VideoCapture("path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer @@ -127,7 +127,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer diff --git a/docs/en/guides/workouts-monitoring.md b/docs/en/guides/workouts-monitoring.md index 1a7e58ef..660bb0c1 100644 --- a/docs/en/guides/workouts-monitoring.md +++ b/docs/en/guides/workouts-monitoring.md @@ -45,7 +45,7 @@ Monitoring workouts through pose estimation with [Ultralytics YOLO11](https://gi yolo solutions workout show=True # Pass a source video - yolo solutions workout source="path/to/video/file.mp4" + yolo solutions workout source="path/to/video.mp4" # Use keypoints for pushups yolo solutions workout kpts=[6, 8, 10] @@ -58,7 +58,7 @@ Monitoring workouts through pose estimation with [Ultralytics YOLO11](https://gi from ultralytics import solutions - cap = cv2.VideoCapture("path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" # Video writer @@ -124,7 +124,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) @@ -187,7 +187,7 @@ import cv2 from ultralytics import solutions -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") assert cap.isOpened(), "Error reading video file" w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) diff --git a/docs/en/hub/inference-api.md b/docs/en/hub/inference-api.md index 545c9e6d..04df3745 100644 --- a/docs/en/hub/inference-api.md +++ b/docs/en/hub/inference-api.md @@ -141,12 +141,12 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J ```bash curl -X POST "https://predict.ultralytics.com" \ - -H "x-api-key: API_KEY" \ - -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ - -F "file=@/path/to/image.jpg" \ - -F "imgsz=640" \ - -F "conf=0.25" \ - -F "iou=0.45" + -H "x-api-key: API_KEY" \ + -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ + -F "file=@/path/to/image.jpg" \ + -F "imgsz=640" \ + -F "conf=0.25" \ + -F "iou=0.45" ``` === "Python" @@ -222,12 +222,12 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J ```bash curl -X POST "https://predict.ultralytics.com" \ - -H "x-api-key: API_KEY" \ - -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ - -F "file=@/path/to/image.jpg" \ - -F "imgsz=640" \ - -F "conf=0.25" \ - -F "iou=0.45" + -H "x-api-key: API_KEY" \ + -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ + -F "file=@/path/to/image.jpg" \ + -F "imgsz=640" \ + -F "conf=0.25" \ + -F "iou=0.45" ``` === "Python" @@ -309,12 +309,12 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J ```bash curl -X POST "https://predict.ultralytics.com" \ - -H "x-api-key: API_KEY" \ - -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ - -F "file=@/path/to/image.jpg" \ - -F "imgsz=640" \ - -F "conf=0.25" \ - -F "iou=0.45" + -H "x-api-key: API_KEY" \ + -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ + -F "file=@/path/to/image.jpg" \ + -F "imgsz=640" \ + -F "conf=0.25" \ + -F "iou=0.45" ``` === "Python" @@ -400,12 +400,12 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J ```bash curl -X POST "https://predict.ultralytics.com" \ - -H "x-api-key: API_KEY" \ - -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ - -F "file=@/path/to/image.jpg" \ - -F "imgsz=640" \ - -F "conf=0.25" \ - -F "iou=0.45" + -H "x-api-key: API_KEY" \ + -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ + -F "file=@/path/to/image.jpg" \ + -F "imgsz=640" \ + -F "conf=0.25" \ + -F "iou=0.45" ``` === "Python" @@ -501,12 +501,12 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J ```bash curl -X POST "https://predict.ultralytics.com" \ - -H "x-api-key: API_KEY" \ - -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ - -F "file=@/path/to/image.jpg" \ - -F "imgsz=640" \ - -F "conf=0.25" \ - -F "iou=0.45" + -H "x-api-key: API_KEY" \ + -F "model=https://hub.ultralytics.com/models/MODEL_ID" \ + -F "file=@/path/to/image.jpg" \ + -F "imgsz=640" \ + -F "conf=0.25" \ + -F "iou=0.45" ``` === "Python" diff --git a/docs/en/integrations/clearml.md b/docs/en/integrations/clearml.md index 8454b42f..a6b8a5fc 100644 --- a/docs/en/integrations/clearml.md +++ b/docs/en/integrations/clearml.md @@ -165,7 +165,7 @@ ClearML's remote execution feature facilitates the reproduction and manipulation Deploying a ClearML Agent is straightforward and can be done on various machines using the following command: ```bash -clearml-agent daemon --queue [--docker] +clearml-agent daemon --queue QUEUES_TO_LISTEN_TO [--docker] ``` This setup is applicable to cloud VMs, local GPUs, or laptops. [ClearML Autoscalers](https://clear.ml/docs/latest/docs/cloud_autoscaling/autoscaling_overview/) help manage cloud workloads on platforms like AWS, GCP, and Azure, automating the deployment of agents and adjusting resources based on your resource budget. diff --git a/docs/en/integrations/comet.md b/docs/en/integrations/comet.md index 24d69c04..cbc00455 100644 --- a/docs/en/integrations/comet.md +++ b/docs/en/integrations/comet.md @@ -45,7 +45,7 @@ After installing the required packages, you'll need to sign up, get a [Comet API ```bash # Set your Comet Api Key - export COMET_API_KEY= + export COMET_API_KEY=YOUR_API_KEY ``` Then, you can initialize your Comet project. Comet will automatically detect the API key and proceed with the setup. @@ -196,7 +196,7 @@ To integrate Comet ML with Ultralytics YOLO11, follow these steps: 2. **Set up your Comet API Key**: ```bash - export COMET_API_KEY= + export COMET_API_KEY=YOUR_API_KEY ``` 3. **Initialize your Comet project in your Python code**: diff --git a/docs/en/integrations/coreml.md b/docs/en/integrations/coreml.md index d0845fa7..db2ea6f1 100644 --- a/docs/en/integrations/coreml.md +++ b/docs/en/integrations/coreml.md @@ -99,7 +99,7 @@ Before diving into the usage instructions, be sure to check out the range of [YO ```bash # Export a YOLO11n PyTorch model to CoreML format - yolo export model=yolo11n.pt format=coreml # creates 'yolo11n.mlpackage'' + yolo export model=yolo11n.pt format=coreml # creates 'yolo11n.mlpackage'' # Run inference with the exported model yolo predict model=yolo11n.mlpackage source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/integrations/edge-tpu.md b/docs/en/integrations/edge-tpu.md index b5a6e8b8..ceef5930 100644 --- a/docs/en/integrations/edge-tpu.md +++ b/docs/en/integrations/edge-tpu.md @@ -89,7 +89,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to TFLite Edge TPU format - yolo export model=yolo11n.pt format=edgetpu # creates 'yolo11n_full_integer_quant_edgetpu.tflite' + yolo export model=yolo11n.pt format=edgetpu # creates 'yolo11n_full_integer_quant_edgetpu.tflite' # Run inference with the exported model yolo predict model=yolo11n_full_integer_quant_edgetpu.tflite source='https://ultralytics.com/images/bus.jpg' @@ -154,7 +154,7 @@ To export a YOLO11 model to TFLite Edge TPU format, you can follow these steps: ```bash # Export a YOLO11n PyTorch model to TFLite Edge TPU format - yolo export model=yolo11n.pt format=edgetpu # creates 'yolo11n_full_integer_quant_edgetpu.tflite' + yolo export model=yolo11n.pt format=edgetpu # creates 'yolo11n_full_integer_quant_edgetpu.tflite' # Run inference with the exported model yolo predict model=yolo11n_full_integer_quant_edgetpu.tflite source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/integrations/mlflow.md b/docs/en/integrations/mlflow.md index 40663132..1e6a2e6b 100644 --- a/docs/en/integrations/mlflow.md +++ b/docs/en/integrations/mlflow.md @@ -67,7 +67,7 @@ Make sure that MLflow logging is enabled in Ultralytics settings. Usually, this 1. **Set a Project Name**: You can set the project name via an environment variable: ```bash - export MLFLOW_EXPERIMENT_NAME= + export MLFLOW_EXPERIMENT_NAME=YOUR_EXPERIMENT_NAME ``` Or use the `project=` argument when training a YOLO model, i.e. `yolo train project=my_project`. @@ -75,7 +75,7 @@ Make sure that MLflow logging is enabled in Ultralytics settings. Usually, this 2. **Set a Run Name**: Similar to setting a project name, you can set the run name via an environment variable: ```bash - export MLFLOW_RUN= + export MLFLOW_RUN=YOUR_RUN_NAME ``` Or use the `name=` argument when training a YOLO model, i.e. `yolo train project=my_project name=my_name`. diff --git a/docs/en/integrations/mnn.md b/docs/en/integrations/mnn.md index 69f0982f..9b404d45 100644 --- a/docs/en/integrations/mnn.md +++ b/docs/en/integrations/mnn.md @@ -60,7 +60,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to MNN format - yolo export model=yolo11n.pt format=mnn # creates 'yolo11n.mnn' + yolo export model=yolo11n.pt format=mnn # creates 'yolo11n.mnn' # Run inference with the exported model yolo predict model='yolo11n.mnn' source='https://ultralytics.com/images/bus.jpg' @@ -311,9 +311,9 @@ To export your Ultralytics YOLO11 model to MNN format, follow these steps: === "CLI" ```bash - yolo export model=yolo11n.pt format=mnn # creates 'yolo11n.mnn' with fp32 weight - yolo export model=yolo11n.pt format=mnn half=True # creates 'yolo11n.mnn' with fp16 weight - yolo export model=yolo11n.pt format=mnn int8=True # creates 'yolo11n.mnn' with int8 weight + yolo export model=yolo11n.pt format=mnn # creates 'yolo11n.mnn' with fp32 weight + yolo export model=yolo11n.pt format=mnn half=True # creates 'yolo11n.mnn' with fp16 weight + yolo export model=yolo11n.pt format=mnn int8=True # creates 'yolo11n.mnn' with int8 weight ``` For detailed export options, check the [Export](../modes/export.md) page in the documentation. @@ -344,8 +344,8 @@ To predict with an exported YOLO11 MNN model, use the `predict` function from th === "CLI" ```bash - yolo predict model='yolo11n.mnn' source='https://ultralytics.com/images/bus.jpg' # predict with `fp32` - yolo predict model='yolo11n.mnn' source='https://ultralytics.com/images/bus.jpg' --half=True # predict with `fp16` if device support + yolo predict model='yolo11n.mnn' source='https://ultralytics.com/images/bus.jpg' # predict with `fp32` + yolo predict model='yolo11n.mnn' source='https://ultralytics.com/images/bus.jpg' --half=True # predict with `fp16` if device support ``` ### What platforms are supported for MNN? diff --git a/docs/en/integrations/ncnn.md b/docs/en/integrations/ncnn.md index 366999c8..855cf4e6 100644 --- a/docs/en/integrations/ncnn.md +++ b/docs/en/integrations/ncnn.md @@ -91,7 +91,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to NCNN format - yolo export model=yolo11n.pt format=ncnn # creates '/yolo11n_ncnn_model' + yolo export model=yolo11n.pt format=ncnn # creates '/yolo11n_ncnn_model' # Run inference with the exported model yolo predict model='./yolo11n_ncnn_model' source='https://ultralytics.com/images/bus.jpg' @@ -148,7 +148,7 @@ To export your Ultralytics YOLO11 model to NCNN format, follow these steps: - **CLI**: Use the `yolo` command with the `export` argument. ```bash - yolo export model=yolo11n.pt format=ncnn # creates '/yolo11n_ncnn_model' + yolo export model=yolo11n.pt format=ncnn # creates '/yolo11n_ncnn_model' ``` For detailed export options, check the [Export](../modes/export.md) page in the documentation. diff --git a/docs/en/integrations/onnx.md b/docs/en/integrations/onnx.md index c34e695c..464704d6 100644 --- a/docs/en/integrations/onnx.md +++ b/docs/en/integrations/onnx.md @@ -107,7 +107,7 @@ Before diving into the usage instructions, be sure to check out the range of [YO ```bash # Export a YOLO11n PyTorch model to ONNX format - yolo export model=yolo11n.pt format=onnx # creates 'yolo11n.onnx' + yolo export model=yolo11n.pt format=onnx # creates 'yolo11n.onnx' # Run inference with the exported model yolo predict model=yolo11n.onnx source='https://ultralytics.com/images/bus.jpg' @@ -182,7 +182,7 @@ To export your YOLO11 models to ONNX format using Ultralytics, follow these step ```bash # Export a YOLO11n PyTorch model to ONNX format - yolo export model=yolo11n.pt format=onnx # creates 'yolo11n.onnx' + yolo export model=yolo11n.pt format=onnx # creates 'yolo11n.onnx' # Run inference with the exported model yolo predict model=yolo11n.onnx source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/integrations/openvino.md b/docs/en/integrations/openvino.md index 5af93a84..63b9f27f 100644 --- a/docs/en/integrations/openvino.md +++ b/docs/en/integrations/openvino.md @@ -51,7 +51,7 @@ Export a YOLOv8n model to OpenVINO format and run inference with the exported mo ```bash # Export a YOLOv8n PyTorch model to OpenVINO format - yolo export model=yolov8n.pt format=openvino # creates 'yolov8n_openvino_model/' + yolo export model=yolov8n.pt format=openvino # creates 'yolov8n_openvino_model/' # Run inference with the exported model yolo predict model=yolov8n_openvino_model source='https://ultralytics.com/images/bus.jpg' @@ -402,7 +402,7 @@ Exporting YOLOv8 models to the OpenVINO format can significantly enhance CPU spe ```bash # Export a YOLOv8n PyTorch model to OpenVINO format - yolo export model=yolov8n.pt format=openvino # creates 'yolov8n_openvino_model/' + yolo export model=yolov8n.pt format=openvino # creates 'yolov8n_openvino_model/' ``` For more information, refer to the [export formats documentation](../modes/export.md). diff --git a/docs/en/integrations/paddlepaddle.md b/docs/en/integrations/paddlepaddle.md index 225aab84..53c7c4a8 100644 --- a/docs/en/integrations/paddlepaddle.md +++ b/docs/en/integrations/paddlepaddle.md @@ -104,7 +104,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to PaddlePaddle format - yolo export model=yolo11n.pt format=paddle # creates '/yolo11n_paddle_model' + yolo export model=yolo11n.pt format=paddle # creates '/yolo11n_paddle_model' # Run inference with the exported model yolo predict model='./yolo11n_paddle_model' source='https://ultralytics.com/images/bus.jpg' @@ -170,7 +170,7 @@ Exporting Ultralytics YOLO11 models to PaddlePaddle format is straightforward. Y ```bash # Export a YOLO11n PyTorch model to PaddlePaddle format - yolo export model=yolo11n.pt format=paddle # creates '/yolo11n_paddle_model' + yolo export model=yolo11n.pt format=paddle # creates '/yolo11n_paddle_model' # Run inference with the exported model yolo predict model='./yolo11n_paddle_model' source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/integrations/ray-tune.md b/docs/en/integrations/ray-tune.md index 5497c347..c7782587 100644 --- a/docs/en/integrations/ray-tune.md +++ b/docs/en/integrations/ray-tune.md @@ -196,7 +196,7 @@ To tune the hyperparameters of your Ultralytics YOLO11 model using Ray Tune, fol ```bash pip install -U ultralytics "ray[tune]" - pip install wandb # optional for logging + pip install wandb # optional for logging ``` 2. **Load your YOLO11 model and start tuning:** diff --git a/docs/en/integrations/rockchip-rknn.md b/docs/en/integrations/rockchip-rknn.md index fa984f8b..b67dbf12 100644 --- a/docs/en/integrations/rockchip-rknn.md +++ b/docs/en/integrations/rockchip-rknn.md @@ -89,7 +89,7 @@ For detailed instructions and best practices related to the installation process ```bash # Export a YOLO11n PyTorch model to RKNN format # 'name' can be one of rk3588, rk3576, rk3566, rk3568, rk3562, rv1103, rv1106, rv1103b, rv1106b, rk2118 - yolo export model=yolo11n.pt format=rknn name=rk3588 # creates '/yolo11n_rknn_model' + yolo export model=yolo11n.pt format=rknn name=rk3588 # creates '/yolo11n_rknn_model' ``` ### Export Arguments diff --git a/docs/en/integrations/sony-imx500.md b/docs/en/integrations/sony-imx500.md index ba93fe7e..60c85b44 100644 --- a/docs/en/integrations/sony-imx500.md +++ b/docs/en/integrations/sony-imx500.md @@ -146,7 +146,7 @@ After obtaining `packerOut.zip` from the IMX500 conversion process, you can pass Step 1: Package the model into RPK file ```bash -imx500-package -i -o +imx500-package -i path/to/packerOut.zip -o path/to/output/folder ``` The above will generate a `network.rpk` file inside the specified output folder. @@ -156,14 +156,14 @@ Step 2: Clone `picamera2` repository, install it and navigate to the imx500 exam ```bash git clone https://github.com/raspberrypi/picamera2 cd picamera2 -pip install -e . --break-system-packages +pip install -e . --break-system-packages cd examples/imx500 ``` Step 3: Run YOLOv8 object detection, using the labels.txt file that has been generated during the IMX500 export. ```bash -python imx500_object_detection_demo.py --model --fps 17 --bbox-normalization --ignore-dash-labels --bbox-order xy --labels +python imx500_object_detection_demo.py --model path/to/network.rpk --fps 17 --bbox-normalization --ignore-dash-labels --bbox-order xy --labels path/to/labels.txt ``` Then you will be able to see live inference output as follows @@ -309,7 +309,7 @@ After exporting to IMX500 format: 1. Use the packager tool to create an RPK file: ```bash - imx500-package -i -o + imx500-package -i path/to/packerOut.zip -o path/to/output/folder ``` 2. Clone and install picamera2: @@ -322,5 +322,5 @@ After exporting to IMX500 format: 3. Run inference using the generated RPK file: ```bash - python imx500_object_detection_demo.py --model --fps 17 --bbox-normalization --labels + python imx500_object_detection_demo.py --model path/to/network.rpk --fps 17 --bbox-normalization --labels path/to/labels.txt ``` diff --git a/docs/en/integrations/tensorboard.md b/docs/en/integrations/tensorboard.md index 26a1eb4e..3303c749 100644 --- a/docs/en/integrations/tensorboard.md +++ b/docs/en/integrations/tensorboard.md @@ -47,7 +47,7 @@ When using Google Colab, it's important to set up TensorBoard before starting yo === "Python" - ```python + ```bash %load_ext tensorboard %tensorboard --logdir path/to/runs ``` @@ -193,7 +193,7 @@ Yes, you can use TensorBoard in a Google Colab environment to train YOLO11 model === "Python" - ```python + ```bash %load_ext tensorboard %tensorboard --logdir path/to/runs ``` diff --git a/docs/en/integrations/tensorrt.md b/docs/en/integrations/tensorrt.md index 4b6b40aa..7509e850 100644 --- a/docs/en/integrations/tensorrt.md +++ b/docs/en/integrations/tensorrt.md @@ -101,7 +101,7 @@ Before diving into the usage instructions, be sure to check out the range of [YO ```bash # Export a YOLO11n PyTorch model to TensorRT format - yolo export model=yolo11n.pt format=engine # creates 'yolo11n.engine'' + yolo export model=yolo11n.pt format=engine # creates 'yolo11n.engine'' # Run inference with the exported model yolo predict model=yolo11n.engine source='https://ultralytics.com/images/bus.jpg' @@ -192,7 +192,7 @@ Experimentation by NVIDIA led them to recommend using at least 500 calibration i ```bash # Export a YOLO11n PyTorch model to TensorRT format with INT8 quantization - yolo export model=yolo11n.pt format=engine batch=8 workspace=4 int8=True data=coco.yaml # creates 'yolov8n.engine'' + yolo export model=yolo11n.pt format=engine batch=8 workspace=4 int8=True data=coco.yaml # creates 'yolov8n.engine'' # Run inference with the exported TensorRT quantized model yolo predict model=yolov8n.engine source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/integrations/tf-graphdef.md b/docs/en/integrations/tf-graphdef.md index 4087af0f..4939b5ca 100644 --- a/docs/en/integrations/tf-graphdef.md +++ b/docs/en/integrations/tf-graphdef.md @@ -97,7 +97,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to TF GraphDef format - yolo export model=yolo11n.pt format=pb # creates 'yolo11n.pb' + yolo export model=yolo11n.pt format=pb # creates 'yolo11n.pb' # Run inference with the exported model yolo predict model='yolo11n.pb' source='https://ultralytics.com/images/bus.jpg' @@ -163,7 +163,7 @@ Ultralytics YOLO11 models can be exported to TensorFlow GraphDef (TF GraphDef) f ```bash # Export a YOLO11n PyTorch model to TF GraphDef format - yolo export model="yolo11n.pt" format="pb" # creates 'yolo11n.pb' + yolo export model="yolo11n.pt" format="pb" # creates 'yolo11n.pb' # Run inference with the exported model yolo predict model="yolo11n.pb" source="https://ultralytics.com/images/bus.jpg" diff --git a/docs/en/integrations/tf-savedmodel.md b/docs/en/integrations/tf-savedmodel.md index a59b2008..4a122fcf 100644 --- a/docs/en/integrations/tf-savedmodel.md +++ b/docs/en/integrations/tf-savedmodel.md @@ -91,7 +91,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to TF SavedModel format - yolo export model=yolo11n.pt format=saved_model # creates '/yolo11n_saved_model' + yolo export model=yolo11n.pt format=saved_model # creates '/yolo11n_saved_model' # Run inference with the exported model yolo predict model='./yolo11n_saved_model' source='https://ultralytics.com/images/bus.jpg' @@ -158,7 +158,7 @@ Exporting an Ultralytics YOLO model to the TensorFlow SavedModel format is strai ```bash # Export the YOLO11 model to TF SavedModel format - yolo export model=yolo11n.pt format=saved_model # creates '/yolo11n_saved_model' + yolo export model=yolo11n.pt format=saved_model # creates '/yolo11n_saved_model' # Run inference with the exported model yolo predict model='./yolo11n_saved_model' source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/integrations/tfjs.md b/docs/en/integrations/tfjs.md index 0e6e3138..e7bc273b 100644 --- a/docs/en/integrations/tfjs.md +++ b/docs/en/integrations/tfjs.md @@ -89,7 +89,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to TF.js format - yolo export model=yolo11n.pt format=tfjs # creates '/yolo11n_web_model' + yolo export model=yolo11n.pt format=tfjs # creates '/yolo11n_web_model' # Run inference with the exported model yolo predict model='./yolo11n_web_model' source='https://ultralytics.com/images/bus.jpg' @@ -158,7 +158,7 @@ Exporting Ultralytics YOLO11 models to TensorFlow.js (TF.js) format is straightf ```bash # Export a YOLO11n PyTorch model to TF.js format - yolo export model=yolo11n.pt format=tfjs # creates '/yolo11n_web_model' + yolo export model=yolo11n.pt format=tfjs # creates '/yolo11n_web_model' # Run inference with the exported model yolo predict model='./yolo11n_web_model' source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/integrations/tflite.md b/docs/en/integrations/tflite.md index b68d5dd3..f2f50ba6 100644 --- a/docs/en/integrations/tflite.md +++ b/docs/en/integrations/tflite.md @@ -95,7 +95,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to TFLite format - yolo export model=yolo11n.pt format=tflite # creates 'yolo11n_float32.tflite' + yolo export model=yolo11n.pt format=tflite # creates 'yolo11n_float32.tflite' # Run inference with the exported model yolo predict model='yolo11n_float32.tflite' source='https://ultralytics.com/images/bus.jpg' @@ -158,7 +158,7 @@ model.export(format="tflite") # creates 'yolo11n_float32.tflite' For CLI users, you can achieve this with: ```bash -yolo export model=yolo11n.pt format=tflite # creates 'yolo11n_float32.tflite' +yolo export model=yolo11n.pt format=tflite # creates 'yolo11n_float32.tflite' ``` For more details, visit the [Ultralytics export guide](../modes/export.md). diff --git a/docs/en/integrations/torchscript.md b/docs/en/integrations/torchscript.md index f80e8bd1..74452737 100644 --- a/docs/en/integrations/torchscript.md +++ b/docs/en/integrations/torchscript.md @@ -99,7 +99,7 @@ Before diving into the usage instructions, it's important to note that while all ```bash # Export a YOLO11n PyTorch model to TorchScript format - yolo export model=yolo11n.pt format=torchscript # creates 'yolo11n.torchscript' + yolo export model=yolo11n.pt format=torchscript # creates 'yolo11n.torchscript' # Run inference with the exported model yolo predict model=yolo11n.torchscript source='https://ultralytics.com/images/bus.jpg' @@ -169,7 +169,7 @@ To export a YOLO11 model to TorchScript, you can use the following example code: ```bash # Export a YOLO11n PyTorch model to TorchScript format - yolo export model=yolo11n.pt format=torchscript # creates 'yolo11n.torchscript' + yolo export model=yolo11n.pt format=torchscript # creates 'yolo11n.torchscript' # Run inference with the exported model yolo predict model=yolo11n.torchscript source='https://ultralytics.com/images/bus.jpg' diff --git a/docs/en/integrations/weights-biases.md b/docs/en/integrations/weights-biases.md index 433520ac..887f3ab7 100644 --- a/docs/en/integrations/weights-biases.md +++ b/docs/en/integrations/weights-biases.md @@ -65,14 +65,14 @@ Start by initializing the Weights & Biases environment in your workspace. You ca import wandb # Initialize your Weights & Biases environment - wandb.login(key="") + wandb.login(key="YOUR_API_KEY") ``` === "CLI" ```bash # Initialize your Weights & Biases environment - wandb login + wandb login YOUR_API_KEY ``` Navigate to the [Weights & Biases authorization page](https://wandb.ai/authorize) to create and retrieve your API key. Use this key to authenticate your environment with W&B. @@ -181,7 +181,7 @@ To integrate Weights & Biases with Ultralytics YOLO11: ```python import wandb - wandb.login(key="") + wandb.login(key="YOUR_API_KEY") ``` 3. Train your YOLO11 model with W&B logging enabled: diff --git a/docs/en/models/fast-sam.md b/docs/en/models/fast-sam.md index 2309d05f..59699dc4 100644 --- a/docs/en/models/fast-sam.md +++ b/docs/en/models/fast-sam.md @@ -215,7 +215,7 @@ To perform object tracking on an image, use the `track` method as shown below: === "CLI" ```bash - yolo segment track model=FastSAM-s.pt source="path/to/video/file.mp4" imgsz=640 + yolo segment track model=FastSAM-s.pt source="path/to/video.mp4" imgsz=640 ``` ## FastSAM official Usage diff --git a/docs/en/models/yolo-world.md b/docs/en/models/yolo-world.md index 033a73a2..799d0d9c 100644 --- a/docs/en/models/yolo-world.md +++ b/docs/en/models/yolo-world.md @@ -190,7 +190,7 @@ Model validation on a dataset is streamlined as follows: ```bash # Track with a YOLO-World model on the video with a specified image size - yolo track model=yolov8s-world.pt imgsz=640 source="path/to/video/file.mp4" + yolo track model=yolov8s-world.pt imgsz=640 source="path/to/video.mp4" ``` !!! note diff --git a/docs/en/modes/export.md b/docs/en/modes/export.md index 38213400..451fc80e 100644 --- a/docs/en/modes/export.md +++ b/docs/en/modes/export.md @@ -66,8 +66,8 @@ Export a YOLO11n model to a different format like ONNX or TensorRT. See the Argu === "CLI" ```bash - yolo export model=yolo11n.pt format=onnx # export official model - yolo export model=path/to/best.pt format=onnx # export custom trained model + yolo export model=yolo11n.pt format=onnx # export official model + yolo export model=path/to/best.pt format=onnx # export custom trained model ``` ## Arguments @@ -108,8 +108,8 @@ Exporting a YOLO11 model to ONNX format is straightforward with Ultralytics. It === "CLI" ```bash - yolo export model=yolo11n.pt format=onnx # export official model - yolo export model=path/to/best.pt format=onnx # export custom trained model + yolo export model=yolo11n.pt format=onnx # export official model + yolo export model=path/to/best.pt format=onnx # export custom trained model ``` For more details on the process, including advanced options like handling different input sizes, refer to the [ONNX integration guide](../integrations/onnx.md). @@ -142,7 +142,7 @@ INT8 quantization is an excellent way to compress the model and speed up inferen === "CLI" ```bash - yolo export model=yolo11n.pt format=engine int8=True # export TensorRT model with INT8 quantization + yolo export model=yolo11n.pt format=engine int8=True # export TensorRT model with INT8 quantization ``` INT8 quantization can be applied to various formats, such as [TensorRT](../integrations/tensorrt.md), [OpenVINO](../integrations/openvino.md), and [CoreML](../integrations/coreml.md). For optimal quantization results, provide a representative [dataset](https://docs.ultralytics.com/datasets/) using the `data` parameter. diff --git a/docs/en/modes/track.md b/docs/en/modes/track.md index 1283af7d..39049aad 100644 --- a/docs/en/modes/track.md +++ b/docs/en/modes/track.md @@ -84,10 +84,10 @@ To run the tracker on video streams, use a trained Detect, Segment or Pose model ```bash # Perform tracking with various models using the command line interface - yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" # Official Detect model + yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" # Official Detect model yolo track model=yolo11n-seg.pt source="https://youtu.be/LNwODJXcvt4" # Official Segment model - yolo track model=yolo11n-pose.pt source="https://youtu.be/LNwODJXcvt4" # Official Pose model - yolo track model=path/to/best.pt source="https://youtu.be/LNwODJXcvt4" # Custom trained model + yolo track model=yolo11n-pose.pt source="https://youtu.be/LNwODJXcvt4" # Official Pose model + yolo track model=path/to/best.pt source="https://youtu.be/LNwODJXcvt4" # Custom trained model # Track using ByteTrack tracker yolo track model=path/to/best.pt tracker="bytetrack.yaml" diff --git a/docs/en/modes/train.md b/docs/en/modes/train.md index 941ef147..2f3845d6 100644 --- a/docs/en/modes/train.md +++ b/docs/en/modes/train.md @@ -257,7 +257,7 @@ To use TensorBoard in [Google Colab](https://colab.research.google.com/github/ul ```bash load_ext tensorboard - tensorboard --logdir ultralytics/runs # replace with 'runs' directory + tensorboard --logdir ultralytics/runs # replace with 'runs' directory ``` To use TensorBoard locally run the below command and view results at . @@ -267,7 +267,7 @@ To use TensorBoard locally run the below command and view results at @@ -200,7 +200,7 @@ Export a YOLO11n-obb model to a different format like ONNX, CoreML, etc. ```bash yolo export model=yolo11n-obb.pt format=onnx # export official model - yolo export model=path/to/best.pt format=onnx # export custom trained model + yolo export model=path/to/best.pt format=onnx # export custom trained model ``` Available YOLO11-obb export formats are in the table below. You can export to any format using the `format` argument, i.e. `format='onnx'` or `format='engine'`. You can predict or validate directly on exported models, i.e. `yolo predict model=yolo11n-obb.onnx`. Usage examples are shown for your model after export completes. diff --git a/docs/en/tasks/pose.md b/docs/en/tasks/pose.md index 08ce1170..1acbe55d 100644 --- a/docs/en/tasks/pose.md +++ b/docs/en/tasks/pose.md @@ -124,8 +124,8 @@ Validate trained YOLO11n-pose model [accuracy](https://www.ultralytics.com/gloss === "CLI" ```bash - yolo pose val model=yolo11n-pose.pt # val official model - yolo pose val model=path/to/best.pt # val custom model + yolo pose val model=yolo11n-pose.pt # val official model + yolo pose val model=path/to/best.pt # val custom model ``` ## Predict @@ -156,8 +156,8 @@ Use a trained YOLO11n-pose model to run predictions on images. The [predict mode === "CLI" ```bash - yolo pose predict model=yolo11n-pose.pt source='https://ultralytics.com/images/bus.jpg' # predict with official model - yolo pose predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model + yolo pose predict model=yolo11n-pose.pt source='https://ultralytics.com/images/bus.jpg' # predict with official model + yolo pose predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model ``` See full `predict` mode details in the [Predict](../modes/predict.md) page. @@ -184,8 +184,8 @@ Export a YOLO11n Pose model to a different format like ONNX, CoreML, etc. This a === "CLI" ```bash - yolo export model=yolo11n-pose.pt format=onnx # export official model - yolo export model=path/to/best.pt format=onnx # export custom trained model + yolo export model=yolo11n-pose.pt format=onnx # export official model + yolo export model=path/to/best.pt format=onnx # export custom trained model ``` Available YOLO11-pose export formats are in the table below. You can export to any format using the `format` argument, i.e. `format='onnx'` or `format='engine'`. You can predict or validate directly on exported models, i.e. `yolo predict model=yolo11n-pose.onnx`. Usage examples are shown for your model after export completes. diff --git a/docs/en/tasks/segment.md b/docs/en/tasks/segment.md index e4f024ae..3757b860 100644 --- a/docs/en/tasks/segment.md +++ b/docs/en/tasks/segment.md @@ -107,7 +107,7 @@ Validate trained YOLO11n-seg model [accuracy](https://www.ultralytics.com/glossa ```bash yolo segment val model=yolo11n-seg.pt # val official model - yolo segment val model=path/to/best.pt # val custom model + yolo segment val model=path/to/best.pt # val custom model ``` ## Predict @@ -139,7 +139,7 @@ Use a trained YOLO11n-seg model to run predictions on images. ```bash yolo segment predict model=yolo11n-seg.pt source='https://ultralytics.com/images/bus.jpg' # predict with official model - yolo segment predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model + yolo segment predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model ``` See full `predict` mode details in the [Predict](../modes/predict.md) page. @@ -167,7 +167,7 @@ Export a YOLO11n-seg model to a different format like ONNX, CoreML, etc. ```bash yolo export model=yolo11n-seg.pt format=onnx # export official model - yolo export model=path/to/best.pt format=onnx # export custom trained model + yolo export model=path/to/best.pt format=onnx # export custom trained model ``` Available YOLO11-seg export formats are in the table below. You can export to any format using the `format` argument, i.e. `format='onnx'` or `format='engine'`. You can predict or validate directly on exported models, i.e. `yolo predict model=yolo11n-seg.onnx`. Usage examples are shown for your model after export completes. diff --git a/docs/en/usage/cli.md b/docs/en/usage/cli.md index dab01c8e..aa802159 100644 --- a/docs/en/usage/cli.md +++ b/docs/en/usage/cli.md @@ -247,7 +247,7 @@ Ultralytics provides ready-to-use solutions for common computer vision applicati ```bash yolo solutions count show=True - yolo solutions count source="path/to/video/file.mp4" # specify video file path + yolo solutions count source="path/to/video.mp4" # specify video file path ``` === "Workout" @@ -256,11 +256,11 @@ Ultralytics provides ready-to-use solutions for common computer vision applicati ```bash yolo solutions workout show=True - yolo solutions workout source="path/to/video/file.mp4" # specify video file path + yolo solutions workout source="path/to/video.mp4" # specify video file path # Use keypoints for ab-workouts - yolo solutions workout kpts=[5, 11, 13] # left side - yolo solutions workout kpts=[6, 12, 14] # right side + yolo solutions workout kpts=[5, 11, 13] # left side + yolo solutions workout kpts=[6, 12, 14] # right side ``` === "Queue" @@ -269,8 +269,8 @@ Ultralytics provides ready-to-use solutions for common computer vision applicati ```bash yolo solutions queue show=True - yolo solutions queue source="path/to/video/file.mp4" # specify video file path - yolo solutions queue region=[(20, 400), (1080, 400), (1080, 360), (20, 360)] # configure queue coordinates + yolo solutions queue source="path/to/video.mp4" # specify video file path + yolo solutions queue region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" # configure queue coordinates ``` === "Inference" @@ -279,7 +279,7 @@ Ultralytics provides ready-to-use solutions for common computer vision applicati ```bash yolo solutions inference - yolo solutions inference model="path/to/model.pt" # use custom model + yolo solutions inference model="path/to/model.pt" # use custom model ``` === "Help" diff --git a/docs/en/usage/engine.md b/docs/en/usage/engine.md index c1985a2a..97b0b50b 100644 --- a/docs/en/usage/engine.md +++ b/docs/en/usage/engine.md @@ -107,7 +107,7 @@ from ultralytics.models.yolo.detect import DetectionTrainer # Create a custom trainer class MyCustomTrainer(DetectionTrainer): def get_model(self, cfg, weights): - # Custom model implementation + """Custom code implementation.""" ... diff --git a/docs/en/usage/simple-utilities.md b/docs/en/usage/simple-utilities.md index 21427225..7d0bdea6 100644 --- a/docs/en/usage/simple-utilities.md +++ b/docs/en/usage/simple-utilities.md @@ -397,7 +397,7 @@ Ultralytics includes an `Annotator` class for annotating various data types. It' from ultralytics.utils.plotting import colors # User defined video path and model file - cap = cv2.VideoCapture("Path/to/video/file.mp4") + cap = cv2.VideoCapture("path/to/video.mp4") model = YOLO(model="yolo11s-seg.pt") # Model file i.e. yolo11s.pt or yolo11m-seg.pt if not cap.isOpened(): @@ -573,7 +573,7 @@ from ultralytics.utils.plotting import colors model = YOLO("yolo11s.pt") names = model.names -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) writer = cv2.VideoWriter("Ultralytics circle annotation.avi", cv2.VideoWriter_fourcc(*"MJPG"), fps, (w, h)) @@ -613,7 +613,7 @@ from ultralytics.utils.plotting import colors model = YOLO("yolo11s.pt") names = model.names -cap = cv2.VideoCapture("path/to/video/file.mp4") +cap = cv2.VideoCapture("path/to/video.mp4") w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS)) writer = cv2.VideoWriter("Ultralytics text annotation.avi", cv2.VideoWriter_fourcc(*"MJPG"), fps, (w, h)) diff --git a/docs/en/yolov5/environments/aws_quickstart_tutorial.md b/docs/en/yolov5/environments/aws_quickstart_tutorial.md index 263c7e97..551eb5bd 100644 --- a/docs/en/yolov5/environments/aws_quickstart_tutorial.md +++ b/docs/en/yolov5/environments/aws_quickstart_tutorial.md @@ -59,9 +59,9 @@ Once your instance is running, select its checkbox and click Connect to access t Logged into your instance, you're now ready to clone the YOLOv5 repository and install dependencies within a Python 3.8 or later environment. YOLOv5's models and datasets will automatically download from the latest [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone repository +git clone https://github.com/ultralytics/yolov5 # clone repository cd yolov5 -pip install -r requirements.txt # install dependencies +pip install -r requirements.txt # install dependencies ``` With your environment set up, you can begin [training](https://docs.ultralytics.com/modes/train/), [validating](https://docs.ultralytics.com/modes/val/), performing [inference](https://docs.ultralytics.com/modes/predict/), and [exporting](https://docs.ultralytics.com/modes/export/) your YOLOv5 models: @@ -85,11 +85,11 @@ python export.py --weights yolov5s.pt --include onnx coreml tflite To add more swap memory, which can be a savior for large datasets, run: ```bash -sudo fallocate -l 64G /swapfile # allocate 64GB swap file -sudo chmod 600 /swapfile # modify permissions -sudo mkswap /swapfile # set up a Linux swap area -sudo swapon /swapfile # activate swap file -free -h # verify swap memory +sudo fallocate -l 64G /swapfile # allocate 64GB swap file +sudo chmod 600 /swapfile # modify permissions +sudo mkswap /swapfile # set up a Linux swap area +sudo swapon /swapfile # activate swap file +free -h # verify swap memory ``` And that's it! ๐ŸŽ‰ You've successfully created an AWS Deep Learning instance and run YOLOv5. Whether you're just starting with [object detection](https://www.ultralytics.com/glossary/object-detection) or scaling up for production, this setup can help you achieve your machine learning goals. Happy training, validating, and deploying! If you encounter any hiccups along the way, the robust AWS documentation and the active Ultralytics community are here to support you. diff --git a/docs/en/yolov5/environments/azureml_quickstart_tutorial.md b/docs/en/yolov5/environments/azureml_quickstart_tutorial.md index e2992f10..c2e73aa5 100644 --- a/docs/en/yolov5/environments/azureml_quickstart_tutorial.md +++ b/docs/en/yolov5/environments/azureml_quickstart_tutorial.md @@ -58,7 +58,7 @@ Install the required dependencies: ```bash pip install -r requirements.txt -pip install onnx>=1.12.0 +pip install onnx ``` ### Perform YOLOv5 tasks diff --git a/docs/en/yolov5/environments/google_cloud_quickstart_tutorial.md b/docs/en/yolov5/environments/google_cloud_quickstart_tutorial.md index d497d82f..699f4027 100644 --- a/docs/en/yolov5/environments/google_cloud_quickstart_tutorial.md +++ b/docs/en/yolov5/environments/google_cloud_quickstart_tutorial.md @@ -75,7 +75,7 @@ sudo fallocate -l 64G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile -free -h # confirm the memory increment +free -h # confirm the memory increment ``` ## Training Custom Datasets diff --git a/docs/en/yolov5/quickstart_tutorial.md b/docs/en/yolov5/quickstart_tutorial.md index 1a6fa8ea..30c2095f 100644 --- a/docs/en/yolov5/quickstart_tutorial.md +++ b/docs/en/yolov5/quickstart_tutorial.md @@ -13,9 +13,9 @@ Embark on your journey into the dynamic realm of real-time [object detection](ht Prepare for launch by cloning the repository and establishing the environment. This ensures that all the necessary [requirements](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) are installed. Check that you have [**Python>=3.8.0**](https://www.python.org/) and [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/) ready for takeoff. ```bash -git clone https://github.com/ultralytics/yolov5 # clone repository +git clone https://github.com/ultralytics/yolov5 # clone repository cd yolov5 -pip install -r requirements.txt # install dependencies +pip install -r requirements.txt # install dependencies ``` ## Inference with [PyTorch](https://www.ultralytics.com/glossary/pytorch) Hub @@ -43,16 +43,16 @@ results.print() # Other options: .show(), .save(), .crop(), .pandas(), etc. Harness `detect.py` for versatile inference on various sources. It automatically fetches [models](https://github.com/ultralytics/yolov5/tree/master/models) from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases) and saves results with ease. ```bash -python detect.py --weights yolov5s.pt --source 0 # webcam - image.jpg # image - video.mp4 # video - screen # screenshot - path/ # directory - list.txt # list of images - list.streams # list of streams - 'path/*.jpg' # glob - 'https://youtu.be/LNwODJXcvt4' # YouTube - 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream +python detect.py --weights yolov5s.pt --source 0 # webcam +python detect.py --weights yolov5s.pt --sourceimage.jpg # image +python detect.py --weights yolov5s.pt --sourcevideo.mp4 # video +python detect.py --weights yolov5s.pt --sourcescreen # screenshot +python detect.py --weights yolov5s.pt --sourcepath/ # directory +python detect.py --weights yolov5s.pt --sourcelist.txt # list of images +python detect.py --weights yolov5s.pt --sourcelist.streams # list of streams +python detect.py --weights yolov5s.pt --source'path/*.jpg' # glob +python detect.py --weights yolov5s.pt --source'https://youtu.be/LNwODJXcvt4' # YouTube +python detect.py --weights yolov5s.pt --source'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream ``` ## Training @@ -60,11 +60,11 @@ python detect.py --weights yolov5s.pt --source 0 # Replicate the YOLOv5 [COCO](https://github.com/ultralytics/yolov5/blob/master/data/scripts/get_coco.sh) benchmarks with the instructions below. The necessary [models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) are pulled directly from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). Training YOLOv5n/s/m/l/x on a V100 GPU should typically take 1/2/4/6/8 days respectively (note that [Multi-GPU](./tutorials/multi_gpu_training.md) setups work faster). Maximize performance by using the highest possible `--batch-size` or use `--batch-size -1` for the YOLOv5 [AutoBatch](https://github.com/ultralytics/yolov5/pull/5092) feature. The following [batch sizes](https://www.ultralytics.com/glossary/batch-size) are ideal for V100-16GB GPUs. ```bash -python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5n.yaml --batch-size 128 - yolov5s 64 - yolov5m 40 - yolov5l 24 - yolov5x 16 +python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5n.yaml --batch-size 128 +python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5s.yaml --batch-size 64 +python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5m.yaml --batch-size 40 +python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5l.yaml --batch-size 24 +python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5x.yaml --batch-size 16 ``` YOLO training curves diff --git a/docs/en/yolov5/tutorials/clearml_logging_integration.md b/docs/en/yolov5/tutorials/clearml_logging_integration.md index cf275e92..5b50dfa8 100644 --- a/docs/en/yolov5/tutorials/clearml_logging_integration.md +++ b/docs/en/yolov5/tutorials/clearml_logging_integration.md @@ -59,7 +59,7 @@ That's it! You're done ๐Ÿ˜Ž To enable ClearML experiment tracking, simply install the ClearML pip package. ```bash -pip install clearml>=1.2.0 +pip install clearml ``` This will enable integration with the YOLOv5 training script. Every training run from now on will be captured and stored by the ClearML [experiment manager](https://docs.ultralytics.com/integrations/clearml/). @@ -157,7 +157,7 @@ clearml-data close Now that you have a ClearML dataset, you can very simply use it to train custom YOLOv5 ๐Ÿš€ models! ```bash -python train.py --img 640 --batch 16 --epochs 3 --data clearml:// --weights yolov5s.pt --cache +python train.py --img 640 --batch 16 --epochs 3 --data clearml://YOUR_DATASET_ID --weights yolov5s.pt --cache ```
@@ -192,7 +192,7 @@ In short: every experiment tracked by the experiment manager contains enough inf You can turn any machine (a cloud VM, a local GPU machine, your own laptop...) into a ClearML agent by simply running: ```bash -clearml-agent daemon --queue [--docker] +clearml-agent daemon --queue QUEUES_TO_LISTEN_TO [--docker] ``` ### Cloning, Editing And Enqueuing diff --git a/docs/en/yolov5/tutorials/comet_logging_integration.md b/docs/en/yolov5/tutorials/comet_logging_integration.md index 77f9edc1..0f1edf42 100644 --- a/docs/en/yolov5/tutorials/comet_logging_integration.md +++ b/docs/en/yolov5/tutorials/comet_logging_integration.md @@ -33,8 +33,8 @@ You can either set your credentials through environment variables: **Environment Variables** ```shell -export COMET_API_KEY= -export COMET_PROJECT_NAME= # This will default to 'yolov5' +export COMET_API_KEY=YOUR_API_KEY +export COMET_PROJECT_NAME=YOUR_COMET_PROJECT_NAME # This will default to 'yolov5' ``` Or create a `.comet.config` file in your working directory and set your credentials there: @@ -43,8 +43,8 @@ Or create a `.comet.config` file in your working directory and set your credenti ``` [comet] -api_key= -project_name= # This will default to 'yolov5' +api_key=YOUR_API_KEY +project_name=YOUR_COMET_PROJECT_NAME # This will default to 'yolov5' ``` ### Run the Training Script @@ -92,14 +92,14 @@ By default, Comet will log the following items: Comet can be configured to log additional data either through command line flags passed to the training script or through environment variables: ```shell -export COMET_MODE=online # Set whether to run Comet in 'online' or 'offline' mode. Defaults to online -export COMET_MODEL_NAME= #Set the name for the saved model. Defaults to yolov5 -export COMET_LOG_CONFUSION_MATRIX=false # Set to disable logging a Comet Confusion Matrix. Defaults to true -export COMET_MAX_IMAGE_UPLOADS= # Controls how many total image predictions to log to Comet. Defaults to 100. -export COMET_LOG_PER_CLASS_METRICS=true # Set to log evaluation metrics for each detected class at the end of training. Defaults to false -export COMET_DEFAULT_CHECKPOINT_FILENAME= # Set this if you would like to resume training from a different checkpoint. Defaults to 'last.pt' -export COMET_LOG_BATCH_LEVEL_METRICS=true # Set this if you would like to log training metrics at the batch level. Defaults to false. -export COMET_LOG_PREDICTIONS=true # Set this to false to disable logging model predictions +export COMET_MODE=online # Set whether to run Comet in 'online' or 'offline' mode. Defaults to online +export COMET_MODEL_NAME="yolov5" # Set the name for the saved model. Defaults to yolov5 +export COMET_LOG_CONFUSION_MATRIX=false # Set to disable logging a Comet Confusion Matrix. Defaults to true +export COMET_MAX_IMAGE_UPLOADS=30 # Controls how many total image predictions to log to Comet. Defaults to 100. +export COMET_LOG_PER_CLASS_METRICS=true # Set to log evaluation metrics for each detected class at the end of training. Defaults to false +export COMET_DEFAULT_CHECKPOINT_FILENAME="last.pt" # Set this if you would like to resume training from a different checkpoint. Defaults to 'last.pt' +export COMET_LOG_BATCH_LEVEL_METRICS=true # Set this if you would like to log training metrics at the batch level. Defaults to false. +export COMET_LOG_PREDICTIONS=true # Set this to false to disable logging model predictions ``` ## Logging Checkpoints with Comet @@ -108,12 +108,12 @@ Logging Models to Comet is disabled by default. To enable it, pass the `save-per ```shell python train.py \ ---img 640 \ ---batch 16 \ ---epochs 5 \ ---data coco128.yaml \ ---weights yolov5s.pt \ ---save-period 1 + --img 640 \ + --batch 16 \ + --epochs 5 \ + --data coco128.yaml \ + --weights yolov5s.pt \ + --save-period 1 ``` ## Logging Model Predictions @@ -128,12 +128,12 @@ Here is an [example project using the Panel](https://www.comet.com/examples/come ```shell python train.py \ ---img 640 \ ---batch 16 \ ---epochs 5 \ ---data coco128.yaml \ ---weights yolov5s.pt \ ---bbox_interval 2 + --img 640 \ + --batch 16 \ + --epochs 5 \ + --data coco128.yaml \ + --weights yolov5s.pt \ + --bbox_interval 2 ``` ### Controlling the number of Prediction Images logged to Comet @@ -142,12 +142,12 @@ When logging predictions from YOLOv5, Comet will log the images associated with ```shell env COMET_MAX_IMAGE_UPLOADS=200 python train.py \ ---img 640 \ ---batch 16 \ ---epochs 5 \ ---data coco128.yaml \ ---weights yolov5s.pt \ ---bbox_interval 1 + --img 640 \ + --batch 16 \ + --epochs 5 \ + --data coco128.yaml \ + --weights yolov5s.pt \ + --bbox_interval 1 ``` ### Logging Class Level Metrics @@ -156,11 +156,11 @@ Use the `COMET_LOG_PER_CLASS_METRICS` environment variable to log mAP, precision ```shell env COMET_LOG_PER_CLASS_METRICS=true python train.py \ ---img 640 \ ---batch 16 \ ---epochs 5 \ ---data coco128.yaml \ ---weights yolov5s.pt + --img 640 \ + --batch 16 \ + --epochs 5 \ + --data coco128.yaml \ + --weights yolov5s.pt ``` ## Uploading a Dataset to Comet Artifacts @@ -171,12 +171,12 @@ The dataset should be organized as described in the [YOLOv5 documentation](train ```shell python train.py \ ---img 640 \ ---batch 16 \ ---epochs 5 \ ---data coco128.yaml \ ---weights yolov5s.pt \ ---upload_dataset + --img 640 \ + --batch 16 \ + --epochs 5 \ + --data coco128.yaml \ + --weights yolov5s.pt \ + --upload_dataset ``` You can find the uploaded dataset in the Artifacts tab in your Comet Workspace: @@ -195,20 +195,20 @@ Artifacts are versioned and also support adding metadata about the dataset. Come If you would like to use a dataset from Comet Artifacts, set the `path` variable in your dataset `yaml` file to point to the following Artifact resource URL: -``` -# contents of artifact.yaml file -path: "comet:///:" +```yaml +# Contents of artifact.yaml file +path: "comet://WORKSPACE_NAME>/ARTIFACT_NAME:ARTIFACT_VERSION_OR_ALIAS" ``` Then pass this file to your training script in the following way: ```shell python train.py \ ---img 640 \ ---batch 16 \ ---epochs 5 \ ---data artifact.yaml \ ---weights yolov5s.pt + --img 640 \ + --batch 16 \ + --epochs 5 \ + --data artifact.yaml \ + --weights yolov5s.pt ``` Artifacts also allow you to track the lineage of data as it flows through your experimentation workflow. Here you can see a graph that shows you all the experiments that have used your uploaded dataset: @@ -219,13 +219,13 @@ Artifacts also allow you to track the lineage of data as it flows through your e If your training run is interrupted for any reason, e.g., disrupted internet connection, you can resume the run using the `resume` flag and the Comet Run Path. -The Run Path has the following format `comet:////`. +The Run Path has the following format `comet://WORKSPACE_NAME/PROJECT_NAME/EXPERIMENT_ID`. This will restore the run to its state before the interruption, which includes restoring the model from a checkpoint, restoring all hyperparameters and training arguments, and downloading Comet dataset Artifacts if they were used in the original run. The resumed run will continue logging to the existing Experiment in the Comet UI: ```shell python train.py \ ---resume "comet://" + --resume "comet://YOUR_RUN_PATH" ``` ## Hyperparameter Search with the Comet Optimizer @@ -250,13 +250,6 @@ python utils/loggers/comet/hpo.py \ --bbox_interval 1 ``` -### Running a Sweep in Parallel - -```shell -comet optimizer -j utils/loggers/comet/hpo.py \ - utils/loggers/comet/optimizer_config.json" -``` - ## Visualizing Results Comet provides a number of ways to visualize the results of your sweep. Take a look at a [project with a completed sweep here](https://www.comet.com/examples/comet-example-yolov5/view/PrlArHGuuhDTKC1UuBmTtOSXD/panels?utm_source=yolov5&utm_medium=partner&utm_campaign=partner_yolov5_2022&utm_content=github). diff --git a/docs/en/yolov5/tutorials/hyperparameter_evolution.md b/docs/en/yolov5/tutorials/hyperparameter_evolution.md index a0b83f37..68af0844 100644 --- a/docs/en/yolov5/tutorials/hyperparameter_evolution.md +++ b/docs/en/yolov5/tutorials/hyperparameter_evolution.md @@ -21,9 +21,9 @@ This makes genetic algorithms a suitable candidate for hyperparameter searches. Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a [**Python>=3.8.0**](https://www.python.org/) environment, including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). [Models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone +git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 -pip install -r requirements.txt # install +pip install -r requirements.txt # install ``` ## 1. Initialize Hyperparameters @@ -92,19 +92,23 @@ To evolve hyperparameters **specific to this scenario**, starting from our initi # Single-GPU python train.py --epochs 10 --data coco128.yaml --weights yolov5s.pt --cache --evolve -# Multi-GPU -for i in 0 1 2 3 4 5 6 7; do - sleep $(expr 30 \* $i) && # 30-second delay (optional) - echo 'Starting GPU '$i'...' && - nohup python train.py --epochs 10 --data coco128.yaml --weights yolov5s.pt --cache --device $i --evolve > evolve_gpu_$i.log & +# Multi-GPU with delay +for i in {0..7}; do + sleep $((30 * i)) # 30-second delay (optional) + echo "Starting GPU $i..." + nohup python train.py --epochs 10 --data coco128.yaml --weights yolov5s.pt --cache --device $i --evolve > "evolve_gpu_$i.log" & done -# Multi-GPU bash-while (not recommended) -for i in 0 1 2 3 4 5 6 7; do - sleep $(expr 30 \* $i) && # 30-second delay (optional) - echo 'Starting GPU '$i'...' && - "$(while true; do nohup python train.py... --device $i --evolve 1 > evolve_gpu_$i.log; done)" & -done +# Continuous training (use with caution) +# for i in {0..7}; do +# sleep $((30 * i)) # 30-second delay (optional) +# echo "Starting continuous training on GPU $i..." +# ( +# while true; do +# python train.py --epochs 10 --data coco128.yaml --weights yolov5s.pt --cache --device $i --evolve > "evolve_gpu_$i.log" +# done +# ) & +# done ``` The default evolution settings will run the base scenario 300 times, i.e. for 300 generations. You can modify generations via the `--evolve` argument, i.e. `python train.py --evolve 1000`. diff --git a/docs/en/yolov5/tutorials/model_ensembling.md b/docs/en/yolov5/tutorials/model_ensembling.md index 0d324271..0a60ccb9 100644 --- a/docs/en/yolov5/tutorials/model_ensembling.md +++ b/docs/en/yolov5/tutorials/model_ensembling.md @@ -17,9 +17,9 @@ From [ensemble learning](https://en.wikipedia.org/wiki/Ensemble_learning): Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a [**Python>=3.8.0**](https://www.python.org/) environment, including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). [Models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone +git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 -pip install -r requirements.txt # install +pip install -r requirements.txt # install ``` ## Test Normally @@ -32,7 +32,7 @@ python val.py --weights yolov5x.pt --data coco.yaml --img 640 --half Output: -```shell +```output val: data=./data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True YOLOv5 ๐Ÿš€ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB) @@ -74,7 +74,7 @@ python val.py --weights yolov5x.pt yolov5l6.pt --data coco.yaml --img 640 --half Output: -```shell +```output val: data=./data/coco.yaml, weights=['yolov5x.pt', 'yolov5l6.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.6, task=val, device=, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True YOLOv5 ๐Ÿš€ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB) @@ -115,7 +115,7 @@ python detect.py --weights yolov5x.pt yolov5l6.pt --img 640 --source data/images Output: -```bash +```output YOLOv5 ๐Ÿš€ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB) Fusing layers... diff --git a/docs/en/yolov5/tutorials/model_export.md b/docs/en/yolov5/tutorials/model_export.md index 59a3a679..6e784a5d 100644 --- a/docs/en/yolov5/tutorials/model_export.md +++ b/docs/en/yolov5/tutorials/model_export.md @@ -13,9 +13,9 @@ keywords: YOLOv5 export, TFLite, ONNX, CoreML, TensorRT, model conversion, YOLOv Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a [**Python>=3.8.0**](https://www.python.org/) environment, including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). [Models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone +git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 -pip install -r requirements.txt # install +pip install -r requirements.txt # install ``` For [TensorRT](https://developer.nvidia.com/tensorrt) export example (requires GPU) see our Colab [notebook](https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb#scrollTo=VTRwsvA9u7ln&line=2&uniqifier=1) appendix section. Open In Colab @@ -112,7 +112,7 @@ python export.py --weights yolov5s.pt --include torchscript onnx Output: -```bash +```output export: data=data/coco128.yaml, weights=['yolov5s.pt'], imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, train=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=12, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['torchscript', 'onnx'] YOLOv5 ๐Ÿš€ v6.2-104-ge3e5122 Python-3.8.0 torch-1.12.1+cu113 CPU @@ -151,33 +151,33 @@ The 3 exported models will be saved alongside the original PyTorch model: `detect.py` runs inference on exported models: ```bash -python detect.py --weights yolov5s.pt # PyTorch - yolov5s.torchscript # TorchScript - yolov5s.onnx # ONNX Runtime or OpenCV DNN with dnn=True - yolov5s_openvino_model # OpenVINO - yolov5s.engine # TensorRT - yolov5s.mlmodel # CoreML (macOS only) - yolov5s_saved_model # TensorFlow SavedModel - yolov5s.pb # TensorFlow GraphDef - yolov5s.tflite # TensorFlow Lite - yolov5s_edgetpu.tflite # TensorFlow Edge TPU - yolov5s_paddle_model # PaddlePaddle +python detect.py --weights yolov5s.pt # PyTorch +python detect.py --weights yolov5s.torchscript # TorchScript +python detect.py --weights yolov5s.onnx # ONNX Runtime or OpenCV DNN with dnn=True +python detect.py --weights yolov5s_openvino_model # OpenVINO +python detect.py --weights yolov5s.engine # TensorRT +python detect.py --weights yolov5s.mlmodel # CoreML (macOS only) +python detect.py --weights yolov5s_saved_model # TensorFlow SavedModel +python detect.py --weights yolov5s.pb # TensorFlow GraphDef +python detect.py --weights yolov5s.tflite # TensorFlow Lite +python detect.py --weights yolov5s_edgetpu.tflite # TensorFlow Edge TPU +python detect.py --weights yolov5s_paddle_model # PaddlePaddle ``` `val.py` runs validation on exported models: ```bash -python val.py --weights yolov5s.pt # PyTorch - yolov5s.torchscript # TorchScript - yolov5s.onnx # ONNX Runtime or OpenCV DNN with dnn=True - yolov5s_openvino_model # OpenVINO - yolov5s.engine # TensorRT - yolov5s.mlmodel # CoreML (macOS Only) - yolov5s_saved_model # TensorFlow SavedModel - yolov5s.pb # TensorFlow GraphDef - yolov5s.tflite # TensorFlow Lite - yolov5s_edgetpu.tflite # TensorFlow Edge TPU - yolov5s_paddle_model # PaddlePaddle +python val.py --weights yolov5s.pt # PyTorch +python val.py --weights yolov5s.torchscript # TorchScript +python val.py --weights yolov5s.onnx # ONNX Runtime or OpenCV DNN with dnn=True +python val.py --weights yolov5s_openvino_model # OpenVINO +python val.py --weights yolov5s.engine # TensorRT +python val.py --weights yolov5s.mlmodel # CoreML (macOS Only) +python val.py --weights yolov5s_saved_model # TensorFlow SavedModel +python val.py --weights yolov5s.pb # TensorFlow GraphDef +python val.py --weights yolov5s.tflite # TensorFlow Lite +python val.py --weights yolov5s_edgetpu.tflite # TensorFlow Edge TPU +python val.py --weights yolov5s_paddle_model # PaddlePaddle ``` Use PyTorch Hub with exported YOLOv5 models: @@ -215,8 +215,8 @@ results.print() # or .show(), .save(), .crop(), .pandas(), etc. ```bash python export.py --weights yolov5s.pt --include onnx -python detect.py --weights yolov5s.onnx --dnn # detect -python val.py --weights yolov5s.onnx --dnn # validate +python detect.py --weights yolov5s.onnx --dnn # detect +python val.py --weights yolov5s.onnx --dnn # validate ``` ## C++ Inference diff --git a/docs/en/yolov5/tutorials/model_pruning_and_sparsity.md b/docs/en/yolov5/tutorials/model_pruning_and_sparsity.md index 36b524cb..39c4e412 100644 --- a/docs/en/yolov5/tutorials/model_pruning_and_sparsity.md +++ b/docs/en/yolov5/tutorials/model_pruning_and_sparsity.md @@ -24,9 +24,9 @@ Pruning works by identifying and removing parameters that contribute minimally t Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a [**Python>=3.8.0**](https://www.python.org/) environment, including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). [Models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone +git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 -pip install -r requirements.txt # install +pip install -r requirements.txt # install ``` ## Test Baseline Performance @@ -39,7 +39,7 @@ python val.py --weights yolov5x.pt --data coco.yaml --img 640 --half Output: -```shell +```output val: data=/content/yolov5/data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True, dnn=False YOLOv5 ๐Ÿš€ v6.0-224-g4c40933 torch 1.10.0+cu111 CUDA:0 (Tesla V100-SXM2-16GB, 16160MiB) @@ -75,7 +75,7 @@ We can apply pruning to the model using the `torch_utils.prune()` command. To te 30% pruned output: -```bash +```output val: data=/content/yolov5/data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True, dnn=False YOLOv5 ๐Ÿš€ v6.0-224-g4c40933 torch 1.10.0+cu111 CUDA:0 (Tesla V100-SXM2-16GB, 16160MiB) diff --git a/docs/en/yolov5/tutorials/multi_gpu_training.md b/docs/en/yolov5/tutorials/multi_gpu_training.md index cbe51b71..86b4b528 100644 --- a/docs/en/yolov5/tutorials/multi_gpu_training.md +++ b/docs/en/yolov5/tutorials/multi_gpu_training.md @@ -13,9 +13,9 @@ This guide explains how to properly use **multiple** GPUs to train a dataset wit Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a [**Python>=3.8.0**](https://www.python.org/) environment, including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). [Models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone +git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 -pip install -r requirements.txt # install +pip install -r requirements.txt # install ``` !!! tip "ProTip!" diff --git a/docs/en/yolov5/tutorials/neural_magic_pruning_quantization.md b/docs/en/yolov5/tutorials/neural_magic_pruning_quantization.md index 61c9d20a..e8a30476 100644 --- a/docs/en/yolov5/tutorials/neural_magic_pruning_quantization.md +++ b/docs/en/yolov5/tutorials/neural_magic_pruning_quantization.md @@ -130,8 +130,8 @@ Spin up the Server with the pruned-quantized YOLOv5s: ```bash deepsparse.server \ - --task yolo \ - --model_path zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned65_quant-none + --task yolo \ + --model_path zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned65_quant-none ``` An example request, using Python's `requests` package: @@ -184,10 +184,10 @@ At batch 32, ONNX Runtime achieves 42 images/sec with the standard dense YOLOv5s ```bash deepsparse.benchmark zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none -s sync -b 32 -nstreams 1 -e onnxruntime -> Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none -> Batch Size: 32 -> Scenario: sync -> Throughput (items/sec): 41.9025 +# Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none +# Batch Size: 32 +# Scenario: sync +# Throughput (items/sec): 41.9025 ``` #### DeepSparse Dense Performance @@ -199,10 +199,10 @@ At batch 32, DeepSparse achieves 70 images/sec with the standard dense YOLOv5s, ```bash deepsparse.benchmark zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none -s sync -b 32 -nstreams 1 -> Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none -> Batch Size: 32 -> Scenario: sync -> Throughput (items/sec): 69.5546 +# Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none +# Batch Size: 32 +# Scenario: sync +# Throughput (items/sec): 69.5546 ``` #### DeepSparse Sparse Performance @@ -214,10 +214,10 @@ At batch 32, DeepSparse achieves 241 images/sec with the pruned-quantized YOLOv5 ```bash deepsparse.benchmark zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned65_quant-none -s sync -b 32 -nstreams 1 -> Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned65_quant-none -> Batch Size: 32 -> Scenario: sync -> Throughput (items/sec): 241.2452 +# Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned65_quant-none +# Batch Size: 32 +# Scenario: sync +# Throughput (items/sec): 241.2452 ``` ### Batch 1 Performance Comparison @@ -231,10 +231,10 @@ At batch 1, ONNX Runtime achieves 48 images/sec with the standard, dense YOLOv5s ```bash deepsparse.benchmark zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none -s sync -b 1 -nstreams 1 -e onnxruntime -> Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none -> Batch Size: 1 -> Scenario: sync -> Throughput (items/sec): 48.0921 +# Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none +# Batch Size: 1 +# Scenario: sync +# Throughput (items/sec): 48.0921 ``` #### DeepSparse Sparse Performance @@ -244,10 +244,10 @@ At batch 1, DeepSparse achieves 135 items/sec with a pruned-quantized YOLOv5s, * ```bash deepsparse.benchmark zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned65_quant-none -s sync -b 1 -nstreams 1 -> Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned65_quant-none -> Batch Size: 1 -> Scenario: sync -> Throughput (items/sec): 134.9468 +# Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned65_quant-none +# Batch Size: 1 +# Scenario: sync +# Throughput (items/sec): 134.9468 ``` Since `c6i.8xlarge` instances have VNNI instructions, DeepSparse's throughput can be pushed further if weights are pruned in blocks of 4. @@ -257,10 +257,10 @@ At batch 1, DeepSparse achieves 180 items/sec with a 4-block pruned-quantized YO ```bash deepsparse.benchmark zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned35_quant-none-vnni -s sync -b 1 -nstreams 1 -> Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned35_quant-none-vnni -> Batch Size: 1 -> Scenario: sync -> Throughput (items/sec): 179.7375 +# Original Model Path: zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/pruned35_quant-none-vnni +# Batch Size: 1 +# Scenario: sync +# Throughput (items/sec): 179.7375 ``` ## Get Started With DeepSparse diff --git a/docs/en/yolov5/tutorials/test_time_augmentation.md b/docs/en/yolov5/tutorials/test_time_augmentation.md index fe04b7ff..ba67e8ae 100644 --- a/docs/en/yolov5/tutorials/test_time_augmentation.md +++ b/docs/en/yolov5/tutorials/test_time_augmentation.md @@ -13,9 +13,9 @@ keywords: YOLOv5, Test-Time Augmentation, TTA, machine learning, deep learning, Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a [**Python>=3.8.0**](https://www.python.org/) environment, including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). [Models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone +git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 -pip install -r requirements.txt # install +pip install -r requirements.txt # install ``` ## Test Normally @@ -28,7 +28,7 @@ python val.py --weights yolov5x.pt --data coco.yaml --img 640 --half Output: -```shell +```output val: data=./data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True YOLOv5 ๐Ÿš€ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB) @@ -67,7 +67,7 @@ python val.py --weights yolov5x.pt --data coco.yaml --img 832 --augment --half Output: -```shell +```output val: data=./data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=832, conf_thres=0.001, iou_thres=0.6, task=val, device=, single_cls=False, augment=True, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True YOLOv5 ๐Ÿš€ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB) @@ -107,7 +107,7 @@ python detect.py --weights yolov5s.pt --img 832 --source data/images --augment Output: -```bash +```output YOLOv5 ๐Ÿš€ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB) Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt to yolov5s.pt... diff --git a/docs/en/yolov5/tutorials/tips_for_best_training_results.md b/docs/en/yolov5/tutorials/tips_for_best_training_results.md index 8da0f487..5b25aa41 100644 --- a/docs/en/yolov5/tutorials/tips_for_best_training_results.md +++ b/docs/en/yolov5/tutorials/tips_for_best_training_results.md @@ -36,19 +36,19 @@ Larger models like YOLOv5x and [YOLOv5x6](https://github.com/ultralytics/yolov5/ ```shell python train.py --data custom.yaml --weights yolov5s.pt - yolov5m.pt - yolov5l.pt - yolov5x.pt - custom_pretrained.pt +python train.py --data custom.yaml --weights yolov5m.pt +python train.py --data custom.yaml --weights yolov5l.pt +python train.py --data custom.yaml --weights yolov5x.pt +python train.py --data custom.yaml --weights custom_pretrained.pt ``` - **Start from Scratch.** Recommended for large datasets (i.e. [COCO](https://github.com/ultralytics/yolov5/blob/master/data/coco.yaml), [Objects365](https://github.com/ultralytics/yolov5/blob/master/data/Objects365.yaml), [OIv6](https://storage.googleapis.com/openimages/web/index.html)). Pass the model architecture YAML you are interested in, along with an empty `--weights ''` argument: ```bash python train.py --data custom.yaml --weights '' --cfg yolov5s.yaml - yolov5m.yaml - yolov5l.yaml - yolov5x.yaml +python train.py --data custom.yaml --weights '' --cfg yolov5m.yaml +python train.py --data custom.yaml --weights '' --cfg yolov5l.yaml +python train.py --data custom.yaml --weights '' --cfg yolov5x.yaml ``` ## Training Settings diff --git a/docs/en/yolov5/tutorials/train_custom_data.md b/docs/en/yolov5/tutorials/train_custom_data.md index 5ef91fce..ef95e412 100644 --- a/docs/en/yolov5/tutorials/train_custom_data.md +++ b/docs/en/yolov5/tutorials/train_custom_data.md @@ -13,9 +13,9 @@ keywords: YOLOv5, custom dataset, model training, object detection, machine lear Clone repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a [**Python>=3.8.0**](https://www.python.org/) environment, including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). [Models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone +git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 -pip install -r requirements.txt # install +pip install -r requirements.txt # install ``` ## Train On Custom Data @@ -119,8 +119,8 @@ The label file corresponding to the above image contains 2 persons (class `0`) a Organize your train and val images and labels according to the example below. YOLOv5 assumes `/coco128` is inside a `/datasets` directory **next to** the `/yolov5` directory. **YOLOv5 locates labels automatically for each image** by replacing the last instance of `/images/` in each image path with `/labels/`. For example: ```bash -../datasets/coco128/images/im0.jpg # image -../datasets/coco128/labels/im0.txt # label +../datasets/coco128/images/im0.jpg # image +../datasets/coco128/labels/im0.txt # label ```

YOLOv5 dataset structure

@@ -158,9 +158,9 @@ All training results are saved to `runs/train/` with incrementing run directorie Getting started is easy: ```shell -pip install comet_ml # 1. install -export COMET_API_KEY= # 2. paste API key -python train.py --img 640 --epochs 3 --data coco128.yaml --weights yolov5s.pt # 3. train +pip install comet_ml # 1. install +export COMET_API_KEY=YOUR_API_KEY # 2. paste API key +python train.py --img 640 --epochs 3 --data coco128.yaml --weights yolov5s.pt # 3. train ``` To learn more about all the supported Comet features for this integration, check out the [Comet Tutorial](./comet_logging_integration.md). If you'd like to learn more about Comet, head over to our [documentation](https://bit.ly/yolov5-colab-comet-docs). Get started by trying out the Comet Colab Notebook: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1RG0WOQyxlDlo5Km8GogJpIEJlg_5lyYO?usp=sharing) diff --git a/docs/en/yolov5/tutorials/transfer_learning_with_frozen_layers.md b/docs/en/yolov5/tutorials/transfer_learning_with_frozen_layers.md index 8e3d0eff..ddb4853f 100644 --- a/docs/en/yolov5/tutorials/transfer_learning_with_frozen_layers.md +++ b/docs/en/yolov5/tutorials/transfer_learning_with_frozen_layers.md @@ -13,9 +13,9 @@ keywords: YOLOv5, transfer learning, freeze layers, machine learning, deep learn Clone the repo and install [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) in a [**Python>=3.8.0**](https://www.python.org/) environment, including [**PyTorch>=1.8**](https://pytorch.org/get-started/locally/). [Models](https://github.com/ultralytics/yolov5/tree/master/models) and [datasets](https://github.com/ultralytics/yolov5/tree/master/data) download automatically from the latest YOLOv5 [release](https://github.com/ultralytics/yolov5/releases). ```bash -git clone https://github.com/ultralytics/yolov5 # clone +git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 -pip install -r requirements.txt # install +pip install -r requirements.txt # install ``` ## How Layer Freezing Works diff --git a/examples/YOLOv8-ONNXRuntime-Rust/README.md b/examples/YOLOv8-ONNXRuntime-Rust/README.md index ec09edbf..ccde061e 100644 --- a/examples/YOLOv8-ONNXRuntime-Rust/README.md +++ b/examples/YOLOv8-ONNXRuntime-Rust/README.md @@ -46,17 +46,16 @@ Please follow the Rust official installation. (https://www.rust-lang.org/tools/i pip install -U ultralytics # export onnx model with dynamic shapes -yolo export model=yolov8m.pt format=onnx simplify dynamic -yolo export model=yolov8m-cls.pt format=onnx simplify dynamic -yolo export model=yolov8m-pose.pt format=onnx simplify dynamic -yolo export model=yolov8m-seg.pt format=onnx simplify dynamic - +yolo export model=yolov8m.pt format=onnx simplify dynamic +yolo export model=yolov8m-cls.pt format=onnx simplify dynamic +yolo export model=yolov8m-pose.pt format=onnx simplify dynamic +yolo export model=yolov8m-seg.pt format=onnx simplify dynamic # export onnx model with constant shapes -yolo export model=yolov8m.pt format=onnx simplify -yolo export model=yolov8m-cls.pt format=onnx simplify -yolo export model=yolov8m-pose.pt format=onnx simplify -yolo export model=yolov8m-seg.pt format=onnx simplify +yolo export model=yolov8m.pt format=onnx simplify +yolo export model=yolov8m-cls.pt format=onnx simplify +yolo export model=yolov8m-pose.pt format=onnx simplify +yolo export model=yolov8m-seg.pt format=onnx simplify ``` ### 2. Run Inference @@ -64,25 +63,25 @@ yolo export model=yolov8m-seg.pt format=onnx simplify It will perform inference with the ONNX model on the source image. ```bash -cargo run --release -- --model --source +cargo run --release -- --model MODEL --source SOURCE ``` Set `--cuda` to use CUDA execution provider to speed up inference. ```bash -cargo run --release -- --cuda --model --source +cargo run --release -- --cuda --model MODEL --source SOURCE ``` Set `--trt` to use TensorRT execution provider, and you can set `--fp16` at the same time to use TensorRT FP16 engine. ```bash -cargo run --release -- --trt --fp16 --model --source +cargo run --release -- --trt --fp16 --model MODEL --source SOURCE ``` Set `--device_id` to select which device to run. When you have only one GPU, and you set `device_id` to 1 will not cause program panic, the `ort` would automatically fall back to `CPU` EP. ```bash -cargo run --release -- --cuda --device_id 0 --model --source +cargo run --release -- --cuda --device_id 0 --model MODEL --source SOURCE ``` Set `--batch` to do multi-batch-size inference. @@ -90,24 +89,24 @@ Set `--batch` to do multi-batch-size inference. If you're using `--trt`, you can also set `--batch-min` and `--batch-max` to explicitly specify min/max/opt batch for dynamic batch input.(https://onnxruntime.ai/docs/execution-providers/TensorRT-ExecutionProvider.html#explicit-shape-range-for-dynamic-shape-input).(Note that the ONNX model should be exported with dynamic shapes.) ```bash -cargo run --release -- --cuda --batch 2 --model --source +cargo run --release -- --cuda --batch 2 --model MODEL --source SOURCE ``` Set `--height` and `--width` to do dynamic image size inference. (Note that the ONNX model should be exported with dynamic shapes.) ```bash -cargo run --release -- --cuda --width 480 --height 640 --model --source +cargo run --release -- --cuda --width 480 --height 640 --model MODEL --source SOURCE ``` Set `--profile` to check time consumed in each stage.(Note that the model usually needs to take 1~3 times dry run to warmup. Make sure to run enough times to evaluate the result.) ```bash -cargo run --release -- --trt --fp16 --profile --model --source +cargo run --release -- --trt --fp16 --profile --model MODEL --source SOURCE ``` Results: (yolov8m.onnx, batch=1, 3 times, trt, fp16, RTX 3060Ti) -```bash +```output ==> 0 [Model Preprocess]: 12.75788ms [ORT H2D]: 237.118ยตs @@ -163,7 +162,7 @@ cargo run --release -- --model ../assets/weights/yolov8m-cls-dyn.onnx --source . You will see result like: -```bash +```output Summary: > Task: Classify (Ultralytics 8.0.217) > EP: Cpu @@ -208,5 +207,5 @@ cargo run --release -- --trt --model ../assets/weights/yolov8m-pose.onnx --sourc using `TensorRT` EP and FP16 model `--fp16` ```bash -cargo run --release -- --trt --fp16 --model ../assets/weights/yolov8m-seg.onnx --source ../assets/images/0172.jpg --plot +cargo run --release -- --trt --fp16 --model ../assets/weights/yolov8m-seg.onnx --source ../assets/images/0172.jpg --plot ``` diff --git a/examples/YOLOv8-OpenVINO-CPP-Inference/README.md b/examples/YOLOv8-OpenVINO-CPP-Inference/README.md index 6c6c794d..cb292886 100644 --- a/examples/YOLOv8-OpenVINO-CPP-Inference/README.md +++ b/examples/YOLOv8-OpenVINO-CPP-Inference/README.md @@ -40,10 +40,10 @@ Follow these steps to build the project: ## ๐Ÿ› ๏ธ Usage -Once built, you can run inference on an image using the following command: +Once built, you can run inference on an image using the following command with an XML or ONNX model: ```bash -./detect +./detect path/to/model.xml path/to/image.jpg ``` ## ๐Ÿ”„ Exporting YOLOv8 Models diff --git a/examples/YOLOv8-Segmentation-ONNXRuntime-Python/README.md b/examples/YOLOv8-Segmentation-ONNXRuntime-Python/README.md index b647700c..d756fcc5 100644 --- a/examples/YOLOv8-Segmentation-ONNXRuntime-Python/README.md +++ b/examples/YOLOv8-Segmentation-ONNXRuntime-Python/README.md @@ -15,8 +15,8 @@ Install the required packages using pip. You will need `ultralytics` for exporti ```bash pip install ultralytics -pip install onnxruntime-gpu # For GPU support -# pip install onnxruntime # Use this instead if you don't have an NVIDIA GPU +pip install onnxruntime-gpu # For GPU support +# pip install onnxruntime # For CPU-only support pip install numpy pip install opencv-python ``` @@ -36,7 +36,7 @@ yolo export model=yolov8s-seg.pt imgsz=640 format=onnx opset=12 simplify Perform inference with the exported ONNX model on your images. ```bash -python main.py --model --source +python main.py --model MODEL_PATH --source IMAGE_PATH ``` ### Example Output diff --git a/examples/heatmaps.ipynb b/examples/heatmaps.ipynb index 4f34da35..0b104ee0 100644 --- a/examples/heatmaps.ipynb +++ b/examples/heatmaps.ipynb @@ -99,7 +99,7 @@ "from ultralytics import solutions\n", "\n", "# Open video file\n", - "cap = cv2.VideoCapture(\"path/to/video/file.mp4\")\n", + "cap = cv2.VideoCapture(\"path/to/video.mp4\")\n", "assert cap.isOpened(), \"Error reading video file\"\n", "\n", "# Get video properties\n", diff --git a/examples/object_counting.ipynb b/examples/object_counting.ipynb index b1f0c523..5b10c527 100644 --- a/examples/object_counting.ipynb +++ b/examples/object_counting.ipynb @@ -107,7 +107,7 @@ "from ultralytics import solutions\n", "\n", "# Open the video file\n", - "cap = cv2.VideoCapture(\"path/to/video/file.mp4\")\n", + "cap = cv2.VideoCapture(\"path/to/video.mp4\")\n", "assert cap.isOpened(), \"Error reading video file\"\n", "\n", "# Get video properties: width, height, and frames per second (fps)\n", diff --git a/examples/object_tracking.ipynb b/examples/object_tracking.ipynb index f89c34dd..5c4897f7 100644 --- a/examples/object_tracking.ipynb +++ b/examples/object_tracking.ipynb @@ -111,7 +111,7 @@ }, "outputs": [], "source": [ - "!yolo track source=\"/path/to/video/file.mp4\" save=True" + "!yolo track source=\"/path/to/video.mp4\" save=True" ] }, { @@ -147,7 +147,7 @@ "model = YOLO(\"yolo11n-seg.pt\")\n", "\n", "# Open the video file\n", - "cap = cv2.VideoCapture(\"path/to/video/file.mp4\")\n", + "cap = cv2.VideoCapture(\"path/to/video.mp4\")\n", "\n", "# Retrieve video properties: width, height, and frames per second\n", "w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))\n", diff --git a/ultralytics/cfg/__init__.py b/ultralytics/cfg/__init__.py index 2fc78fb1..49445ec5 100644 --- a/ultralytics/cfg/__init__.py +++ b/ultralytics/cfg/__init__.py @@ -87,13 +87,13 @@ SOLUTIONS_HELP_MSG = f""" at https://docs.ultralytics.com/usage/cfg 1. Call object counting solution - yolo solutions count source="path/to/video/file.mp4" region=[(20, 400), (1080, 400), (1080, 360), (20, 360)] + yolo solutions count source="path/to/video.mp4" region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" 2. Call heatmaps solution yolo solutions heatmap colormap=cv2.COLORMAP_PARULA model=yolo11n.pt 3. Call queue management solution - yolo solutions queue region=[(20, 400), (1080, 400), (1080, 360), (20, 360)] model=yolo11n.pt + yolo solutions queue region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" model=yolo11n.pt 4. Call workouts monitoring solution for push-ups yolo solutions workout model=yolo11n-pose.pt kpts=[6, 8, 10] @@ -102,7 +102,7 @@ SOLUTIONS_HELP_MSG = f""" yolo solutions analytics analytics_type="pie" 6. Track objects within specific zones - yolo solutions trackzone source="path/to/video/file.mp4" region=[(150, 150), (1130, 150), (1130, 570), (150, 570)] + yolo solutions trackzone source="path/to/video.mp4" region="[(150, 150), (1130, 150), (1130, 570), (150, 570)]" 7. Streamlit real-time webcam inference GUI yolo streamlit-predict @@ -130,7 +130,7 @@ CLI_HELP_MSG = f""" yolo export model=yolo11n-cls.pt format=onnx imgsz=224,128 5. Ultralytics solutions usage - yolo solutions count or in {list(SOLUTION_MAP.keys())[1:-1]} source="path/to/video/file.mp4" + yolo solutions count or in {list(SOLUTION_MAP.keys())[1:-1]} source="path/to/video.mp4" 6. Run special commands: yolo help @@ -643,7 +643,7 @@ def handle_yolo_solutions(args: List[str]) -> None: >>> handle_yolo_solutions(["count"]) Run analytics with custom configuration: - >>> handle_yolo_solutions(["analytics", "conf=0.25", "source=path/to/video/file.mp4"]) + >>> handle_yolo_solutions(["analytics", "conf=0.25", "source=path/to/video.mp4"]) Run inference with custom configuration, requires Streamlit version 1.29.0 or higher. >>> handle_yolo_solutions(["inference", "model=yolo11n.pt"]) diff --git a/ultralytics/solutions/queue_management.py b/ultralytics/solutions/queue_management.py index 2952f459..c0234aa9 100644 --- a/ultralytics/solutions/queue_management.py +++ b/ultralytics/solutions/queue_management.py @@ -26,7 +26,7 @@ class QueueManager(BaseSolution): display_output: Displays the processed output. Examples: - >>> cap = cv2.VideoCapture("Path/to/video/file.mp4") + >>> cap = cv2.VideoCapture("path/to/video.mp4") >>> queue_manager = QueueManager(region=[100, 100, 200, 200, 300, 300]) >>> while cap.isOpened(): >>> success, im0 = cap.read() diff --git a/ultralytics/trackers/README.md b/ultralytics/trackers/README.md index 3743d537..18d45e8c 100644 --- a/ultralytics/trackers/README.md +++ b/ultralytics/trackers/README.md @@ -58,10 +58,10 @@ results = model.track( ```bash # Perform tracking with various models using the command line interface -yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" # Official Detect model +yolo track model=yolo11n.pt source="https://youtu.be/LNwODJXcvt4" # Official Detect model yolo track model=yolo11n-seg.pt source="https://youtu.be/LNwODJXcvt4" # Official Segment model -yolo track model=yolo11n-pose.pt source="https://youtu.be/LNwODJXcvt4" # Official Pose model -yolo track model=path/to/best.pt source="https://youtu.be/LNwODJXcvt4" # Custom trained model +yolo track model=yolo11n-pose.pt source="https://youtu.be/LNwODJXcvt4" # Official Pose model +yolo track model=path/to/best.pt source="https://youtu.be/LNwODJXcvt4" # Custom trained model # Track using ByteTrack tracker yolo track model=path/to/best.pt tracker="bytetrack.yaml"