mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
Mkdocs annotations fixes (#7600)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
22651d01cf
commit
b1282544d2
@ -23,6 +23,7 @@ Measuring the gap between two objects is known as distance calculation within a
|
||||
!!! Example "Distance Calculation using YOLOv8 Example"
|
||||
|
||||
=== "Video Stream"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import distance_calculation
|
||||
@ -69,12 +70,12 @@ Measuring the gap between two objects is known as distance calculation within a
|
||||
### Optional Arguments `set_args`
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|----------------|--------|-----------------|--------------------------------------------------------|
|
||||
| names | `dict` | `None` | Classes names |
|
||||
| view_img | `bool` | `False` | Display frames with counts |
|
||||
| line_thickness | `int` | `2` | Increase bounding boxes thickness |
|
||||
| line_color | `RGB` | `(255, 255, 0)` | Line Color for centroids mapping on two bounding boxes |
|
||||
| centroid_color | `RGB` | `(255, 0, 255)` | Centroid color for each bounding box |
|
||||
|------------------|--------|-----------------|--------------------------------------------------------|
|
||||
| `names` | `dict` | `None` | Classes names |
|
||||
| `view_img` | `bool` | `False` | Display frames with counts |
|
||||
| `line_thickness` | `int` | `2` | Increase bounding boxes thickness |
|
||||
| `line_color` | `RGB` | `(255, 255, 0)` | Line Color for centroids mapping on two bounding boxes |
|
||||
| `centroid_color` | `RGB` | `(255, 0, 255)` | Centroid color for each bounding box |
|
||||
|
||||
### Arguments `model.track`
|
||||
|
||||
|
@ -42,6 +42,7 @@ A heatmap generated with [Ultralytics YOLOv8](https://github.com/ultralytics/ult
|
||||
!!! Example "Heatmaps using Ultralytics YOLOv8 Example"
|
||||
|
||||
=== "Heatmap"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import heatmap
|
||||
@ -83,6 +84,7 @@ A heatmap generated with [Ultralytics YOLOv8](https://github.com/ultralytics/ult
|
||||
```
|
||||
|
||||
=== "Line Counting"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import heatmap
|
||||
@ -126,6 +128,7 @@ A heatmap generated with [Ultralytics YOLOv8](https://github.com/ultralytics/ult
|
||||
```
|
||||
|
||||
=== "Region Counting"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import heatmap
|
||||
@ -170,6 +173,7 @@ A heatmap generated with [Ultralytics YOLOv8](https://github.com/ultralytics/ult
|
||||
```
|
||||
|
||||
=== "Im0"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import heatmap
|
||||
@ -194,6 +198,7 @@ A heatmap generated with [Ultralytics YOLOv8](https://github.com/ultralytics/ult
|
||||
```
|
||||
|
||||
=== "Specific Classes"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import heatmap
|
||||
@ -239,21 +244,21 @@ A heatmap generated with [Ultralytics YOLOv8](https://github.com/ultralytics/ult
|
||||
### Arguments `set_args`
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|---------------------|----------------|-------------------|-----------------------------------------------------------|
|
||||
| view_img | `bool` | `False` | Display the frame with heatmap |
|
||||
| colormap | `cv2.COLORMAP` | `None` | cv2.COLORMAP for heatmap |
|
||||
| imw | `int` | `None` | Width of Heatmap |
|
||||
| imh | `int` | `None` | Height of Heatmap |
|
||||
| heatmap_alpha | `float` | `0.5` | Heatmap alpha value |
|
||||
| count_reg_pts | `list` | `None` | Object counting region points |
|
||||
| count_txt_thickness | `int` | `2` | Count values text size |
|
||||
| count_txt_color | `RGB Color` | `(0, 0, 0)` | Foreground color for Object counts text |
|
||||
| count_color | `RGB Color` | `(255, 255, 255)` | Background color for Object counts text |
|
||||
| count_reg_color | `RGB Color` | `(255, 0, 255)` | Counting region color |
|
||||
| region_thickness | `int` | `5` | Counting region thickness value |
|
||||
| decay_factor | `float` | `0.99` | Decay factor for heatmap area removal after specific time |
|
||||
| shape | `str` | `circle` | Heatmap shape for display "rect" or "circle" supported |
|
||||
| line_dist_thresh | `int` | `15` | Euclidean Distance threshold for line counter |
|
||||
|-----------------------|----------------|-------------------|-----------------------------------------------------------|
|
||||
| `view_img` | `bool` | `False` | Display the frame with heatmap |
|
||||
| `colormap` | `cv2.COLORMAP` | `None` | cv2.COLORMAP for heatmap |
|
||||
| `imw` | `int` | `None` | Width of Heatmap |
|
||||
| `imh` | `int` | `None` | Height of Heatmap |
|
||||
| `heatmap_alpha` | `float` | `0.5` | Heatmap alpha value |
|
||||
| `count_reg_pts` | `list` | `None` | Object counting region points |
|
||||
| `count_txt_thickness` | `int` | `2` | Count values text size |
|
||||
| `count_txt_color` | `RGB Color` | `(0, 0, 0)` | Foreground color for Object counts text |
|
||||
| `count_color` | `RGB Color` | `(255, 255, 255)` | Background color for Object counts text |
|
||||
| `count_reg_color` | `RGB Color` | `(255, 0, 255)` | Counting region color |
|
||||
| `region_thickness` | `int` | `5` | Counting region thickness value |
|
||||
| `decay_factor` | `float` | `0.99` | Decay factor for heatmap area removal after specific time |
|
||||
| `shape` | `str` | `circle` | Heatmap shape for display "rect" or "circle" supported |
|
||||
| `line_dist_thresh` | `int` | `15` | Euclidean Distance threshold for line counter |
|
||||
|
||||
### Arguments `model.track`
|
||||
|
||||
|
@ -26,6 +26,7 @@ There are two types of instance segmentation tracking available in the Ultralyti
|
||||
!!! Example "Instance Segmentation and Tracking"
|
||||
|
||||
=== "Instance Segmentation"
|
||||
|
||||
```python
|
||||
import cv2
|
||||
from ultralytics import YOLO
|
||||
@ -68,6 +69,7 @@ There are two types of instance segmentation tracking available in the Ultralyti
|
||||
```
|
||||
|
||||
=== "Instance Segmentation with Object Tracking"
|
||||
|
||||
```python
|
||||
import cv2
|
||||
from ultralytics import YOLO
|
||||
|
@ -19,6 +19,7 @@ Object blurring with [Ultralytics YOLOv8](https://github.com/ultralytics/ultraly
|
||||
!!! Example "Object Blurring using YOLOv8 Example"
|
||||
|
||||
=== "Object Blurring"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.utils.plotting import Annotator, colors
|
||||
|
@ -37,6 +37,7 @@ Object counting with [Ultralytics YOLOv8](https://github.com/ultralytics/ultraly
|
||||
!!! Example "Object Counting using YOLOv8 Example"
|
||||
|
||||
=== "Region"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import object_counter
|
||||
@ -76,10 +77,10 @@ Object counting with [Ultralytics YOLOv8](https://github.com/ultralytics/ultraly
|
||||
cap.release()
|
||||
video_writer.release()
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
```
|
||||
|
||||
=== "Line"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import object_counter
|
||||
@ -122,6 +123,7 @@ Object counting with [Ultralytics YOLOv8](https://github.com/ultralytics/ultraly
|
||||
```
|
||||
|
||||
=== "Specific Classes"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import object_counter
|
||||
|
@ -19,6 +19,7 @@ Object cropping with [Ultralytics YOLOv8](https://github.com/ultralytics/ultraly
|
||||
!!! Example "Object Cropping using YOLOv8 Example"
|
||||
|
||||
=== "Object Cropping"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.utils.plotting import Annotator, colors
|
||||
|
@ -26,6 +26,7 @@ Speed estimation is the process of calculating the rate of movement of an object
|
||||
!!! Example "Speed Estimation using YOLOv8 Example"
|
||||
|
||||
=== "Speed Estimation"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import speed_estimation
|
||||
@ -77,13 +78,13 @@ Speed estimation is the process of calculating the rate of movement of an object
|
||||
### Optional Arguments `set_args`
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|------------------|--------|----------------------------|---------------------------------------------------|
|
||||
| reg_pts | `list` | `[(20, 400), (1260, 400)]` | Points defining the Region Area |
|
||||
| names | `dict` | `None` | Classes names |
|
||||
| view_img | `bool` | `False` | Display frames with counts |
|
||||
| line_thickness | `int` | `2` | Increase bounding boxes thickness |
|
||||
| region_thickness | `int` | `5` | Thickness for object counter region or line |
|
||||
| spdl_dist_thresh | `int` | `10` | Euclidean Distance threshold for speed check line |
|
||||
|--------------------|--------|----------------------------|---------------------------------------------------|
|
||||
| `reg_pts` | `list` | `[(20, 400), (1260, 400)]` | Points defining the Region Area |
|
||||
| `names` | `dict` | `None` | Classes names |
|
||||
| `view_img` | `bool` | `False` | Display frames with counts |
|
||||
| `line_thickness` | `int` | `2` | Increase bounding boxes thickness |
|
||||
| `region_thickness` | `int` | `5` | Thickness for object counter region or line |
|
||||
| `spdl_dist_thresh` | `int` | `10` | Euclidean Distance threshold for speed check line |
|
||||
|
||||
### Arguments `model.track`
|
||||
|
||||
|
@ -20,6 +20,7 @@ keywords: Ultralytics, YOLOv8, Object Detection, Object Tracking, IDetection, Vi
|
||||
!!! Example "VisionEye Object Mapping using YOLOv8"
|
||||
|
||||
=== "VisionEye Object Mapping"
|
||||
|
||||
```python
|
||||
import cv2
|
||||
from ultralytics import YOLO
|
||||
@ -62,6 +63,7 @@ keywords: Ultralytics, YOLOv8, Object Detection, Object Tracking, IDetection, Vi
|
||||
```
|
||||
|
||||
=== "VisionEye Object Mapping with Object Tracking"
|
||||
|
||||
```python
|
||||
import cv2
|
||||
from ultralytics import YOLO
|
||||
|
@ -26,6 +26,7 @@ Monitoring workouts through pose estimation with [Ultralytics YOLOv8](https://gi
|
||||
!!! Example "Workouts Monitoring Example"
|
||||
|
||||
=== "Workouts Monitoring"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import ai_gym
|
||||
@ -56,6 +57,7 @@ Monitoring workouts through pose estimation with [Ultralytics YOLOv8](https://gi
|
||||
```
|
||||
|
||||
=== "Workouts Monitoring with Save Output"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from ultralytics.solutions import ai_gym
|
||||
@ -103,13 +105,13 @@ Monitoring workouts through pose estimation with [Ultralytics YOLOv8](https://gi
|
||||
### Arguments `set_args`
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|-----------------|--------|----------|----------------------------------------------------------------------------------------|
|
||||
| kpts_to_check | `list` | `None` | List of three keypoints index, for counting specific workout, followed by keypoint Map |
|
||||
| view_img | `bool` | `False` | Display the frame with counts |
|
||||
| line_thickness | `int` | `2` | Increase the thickness of count value |
|
||||
| pose_type | `str` | `pushup` | Pose that need to be monitored, "pullup" and "abworkout" also supported |
|
||||
| pose_up_angle | `int` | `145` | Pose Up Angle value |
|
||||
| pose_down_angle | `int` | `90` | Pose Down Angle value |
|
||||
|-------------------|--------|----------|----------------------------------------------------------------------------------------|
|
||||
| `kpts_to_check` | `list` | `None` | List of three keypoints index, for counting specific workout, followed by keypoint Map |
|
||||
| `view_img` | `bool` | `False` | Display the frame with counts |
|
||||
| `line_thickness` | `int` | `2` | Increase the thickness of count value |
|
||||
| `pose_type` | `str` | `pushup` | Pose that need to be monitored, "pullup" and "abworkout" also supported |
|
||||
| `pose_up_angle` | `int` | `145` | Pose Up Angle value |
|
||||
| `pose_down_angle` | `int` | `90` | Pose Down Angle value |
|
||||
|
||||
### Arguments `model.predict`
|
||||
|
||||
|
@ -108,6 +108,7 @@ YOLO detection models, such as `yolov8n.pt`, can return JSON responses from loca
|
||||
!!! Example "Detect Model JSON Response"
|
||||
|
||||
=== "Local"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -122,6 +123,7 @@ YOLO detection models, such as `yolov8n.pt`, can return JSON responses from loca
|
||||
```
|
||||
|
||||
=== "CLI API"
|
||||
|
||||
```bash
|
||||
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
|
||||
-H "x-api-key: API_KEY" \
|
||||
@ -132,6 +134,7 @@ YOLO detection models, such as `yolov8n.pt`, can return JSON responses from loca
|
||||
```
|
||||
|
||||
=== "Python API"
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
@ -153,6 +156,7 @@ YOLO detection models, such as `yolov8n.pt`, can return JSON responses from loca
|
||||
```
|
||||
|
||||
=== "JSON Response"
|
||||
|
||||
```json
|
||||
{
|
||||
"success": True,
|
||||
@ -202,6 +206,7 @@ YOLO segmentation models, such as `yolov8n-seg.pt`, can return JSON responses fr
|
||||
!!! Example "Segment Model JSON Response"
|
||||
|
||||
=== "Local"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -216,6 +221,7 @@ YOLO segmentation models, such as `yolov8n-seg.pt`, can return JSON responses fr
|
||||
```
|
||||
|
||||
=== "CLI API"
|
||||
|
||||
```bash
|
||||
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
|
||||
-H "x-api-key: API_KEY" \
|
||||
@ -226,6 +232,7 @@ YOLO segmentation models, such as `yolov8n-seg.pt`, can return JSON responses fr
|
||||
```
|
||||
|
||||
=== "Python API"
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
@ -247,6 +254,7 @@ YOLO segmentation models, such as `yolov8n-seg.pt`, can return JSON responses fr
|
||||
```
|
||||
|
||||
=== "JSON Response"
|
||||
|
||||
Note `segments` `x` and `y` lengths may vary from one object to another. Larger or more complex objects may have more segment points.
|
||||
```json
|
||||
{
|
||||
@ -339,6 +347,7 @@ YOLO pose models, such as `yolov8n-pose.pt`, can return JSON responses from loca
|
||||
!!! Example "Pose Model JSON Response"
|
||||
|
||||
=== "Local"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -353,6 +362,7 @@ YOLO pose models, such as `yolov8n-pose.pt`, can return JSON responses from loca
|
||||
```
|
||||
|
||||
=== "CLI API"
|
||||
|
||||
```bash
|
||||
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
|
||||
-H "x-api-key: API_KEY" \
|
||||
@ -363,6 +373,7 @@ YOLO pose models, such as `yolov8n-pose.pt`, can return JSON responses from loca
|
||||
```
|
||||
|
||||
=== "Python API"
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
@ -384,6 +395,7 @@ YOLO pose models, such as `yolov8n-pose.pt`, can return JSON responses from loca
|
||||
```
|
||||
|
||||
=== "JSON Response"
|
||||
|
||||
Note COCO-keypoints pretrained models will have 17 human keypoints. The `visible` part of the keypoints indicates whether a keypoint is visible or obscured. Obscured keypoints may be outside the image or may not be visible, i.e. a person's eyes facing away from the camera.
|
||||
```json
|
||||
{
|
||||
|
@ -46,6 +46,7 @@ Start by initializing the Weights & Biases environment in your workspace. You ca
|
||||
!!! Tip "Initial SDK Setup"
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
# Initialize your Weights & Biases environment
|
||||
import wandb
|
||||
|
@ -50,6 +50,7 @@ To perform object detection on an image, use the `predict` method as shown below
|
||||
!!! Example
|
||||
|
||||
=== "Python"
|
||||
|
||||
```python
|
||||
from ultralytics import FastSAM
|
||||
from ultralytics.models.fastsam import FastSAMPrompt
|
||||
@ -83,6 +84,7 @@ To perform object detection on an image, use the `predict` method as shown below
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
# Load a FastSAM model and segment everything with it
|
||||
yolo segment predict model=FastSAM-s.pt source=path/to/bus.jpg imgsz=640
|
||||
@ -97,6 +99,7 @@ Validation of the model on a dataset can be done as follows:
|
||||
!!! Example
|
||||
|
||||
=== "Python"
|
||||
|
||||
```python
|
||||
from ultralytics import FastSAM
|
||||
|
||||
@ -108,6 +111,7 @@ Validation of the model on a dataset can be done as follows:
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
# Load a FastSAM model and validate it on the COCO8 example dataset at image size 640
|
||||
yolo segment val model=FastSAM-s.pt data=coco8.yaml imgsz=640
|
||||
|
@ -72,6 +72,7 @@ You can download the model [here](https://github.com/ChaoningZhang/MobileSAM/blo
|
||||
!!! Example
|
||||
|
||||
=== "Python"
|
||||
|
||||
```python
|
||||
from ultralytics import SAM
|
||||
|
||||
@ -87,6 +88,7 @@ You can download the model [here](https://github.com/ChaoningZhang/MobileSAM/blo
|
||||
!!! Example
|
||||
|
||||
=== "Python"
|
||||
|
||||
```python
|
||||
from ultralytics import SAM
|
||||
|
||||
|
@ -148,6 +148,7 @@ Tests run on a 2023 Apple M2 Macbook with 16GB of RAM. To reproduce this test:
|
||||
!!! Example
|
||||
|
||||
=== "Python"
|
||||
|
||||
```python
|
||||
from ultralytics import FastSAM, SAM, YOLO
|
||||
|
||||
@ -183,6 +184,7 @@ To auto-annotate your dataset with the Ultralytics framework, use the `auto_anno
|
||||
!!! Example
|
||||
|
||||
=== "Python"
|
||||
|
||||
```python
|
||||
from ultralytics.data.annotator import auto_annotate
|
||||
|
||||
|
@ -97,6 +97,7 @@ If you use YOLOv5 or YOLOv5u in your research, please cite the Ultralytics YOLOv
|
||||
!!! Quote ""
|
||||
|
||||
=== "BibTeX"
|
||||
|
||||
```bibtex
|
||||
@software{yolov5,
|
||||
title = {Ultralytics YOLOv5},
|
||||
|
@ -62,6 +62,7 @@ Run YOLOv8n benchmarks on all supported export formats including ONNX, TensorRT
|
||||
# Benchmark on GPU
|
||||
benchmark(model='yolov8n.pt', data='coco8.yaml', imgsz=640, half=False, device=0)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
|
@ -62,6 +62,7 @@ Export a YOLOv8n model to a different format like ONNX or TensorRT. See Argument
|
||||
# Export the model
|
||||
model.export(format='onnx')
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
|
@ -53,6 +53,7 @@ Ultralytics YOLO models return either a Python list of `Results` objects, or a m
|
||||
!!! Example "Predict"
|
||||
|
||||
=== "Return a list with `stream=False`"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -71,6 +72,7 @@ Ultralytics YOLO models return either a Python list of `Results` objects, or a m
|
||||
```
|
||||
|
||||
=== "Return a generator with `stream=True`"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -118,6 +120,7 @@ Below are code examples for using each source type:
|
||||
!!! Example "Prediction sources"
|
||||
|
||||
=== "image"
|
||||
|
||||
Run inference on an image file.
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
@ -133,6 +136,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "screenshot"
|
||||
|
||||
Run inference on the current screen content as a screenshot.
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
@ -148,6 +152,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "URL"
|
||||
|
||||
Run inference on an image or video hosted remotely via URL.
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
@ -163,6 +168,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "PIL"
|
||||
|
||||
Run inference on an image opened with Python Imaging Library (PIL).
|
||||
```python
|
||||
from PIL import Image
|
||||
@ -179,6 +185,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "OpenCV"
|
||||
|
||||
Run inference on an image read with OpenCV.
|
||||
```python
|
||||
import cv2
|
||||
@ -195,6 +202,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "numpy"
|
||||
|
||||
Run inference on an image represented as a numpy array.
|
||||
```python
|
||||
import numpy as np
|
||||
@ -211,6 +219,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "torch"
|
||||
|
||||
Run inference on an image represented as a PyTorch tensor.
|
||||
```python
|
||||
import torch
|
||||
@ -227,6 +236,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "CSV"
|
||||
|
||||
Run inference on a collection of images, URLs, videos and directories listed in a CSV file.
|
||||
```python
|
||||
import torch
|
||||
@ -243,6 +253,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "video"
|
||||
|
||||
Run inference on a video file. By using `stream=True`, you can create a generator of Results objects to reduce memory usage.
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
@ -258,6 +269,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "directory"
|
||||
|
||||
Run inference on all images and videos in a directory. To also capture images and videos in subdirectories use a glob pattern, i.e. `path/to/dir/**/*`.
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
@ -273,6 +285,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "glob"
|
||||
|
||||
Run inference on all images and videos that match a glob expression with `*` characters.
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
@ -291,6 +304,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "YouTube"
|
||||
|
||||
Run inference on a YouTube video. By using `stream=True`, you can create a generator of Results objects to reduce memory usage for long videos.
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
@ -306,6 +320,7 @@ Below are code examples for using each source type:
|
||||
```
|
||||
|
||||
=== "Streams"
|
||||
|
||||
Run inference on remote streaming sources using RTSP, RTMP, TCP and IP address protocols. If multiple streams are provided in a `*.streams` text file then batched inference will run, i.e. 8 streams will run at batch-size 8, otherwise single streams will run at batch-size 1.
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
@ -384,16 +399,16 @@ The below table contains valid Ultralytics image formats.
|
||||
|
||||
| Image Suffixes | Example Predict Command | Reference |
|
||||
|----------------|----------------------------------|-------------------------------------------------------------------------------|
|
||||
| .bmp | `yolo predict source=image.bmp` | [Microsoft BMP File Format](https://en.wikipedia.org/wiki/BMP_file_format) |
|
||||
| .dng | `yolo predict source=image.dng` | [Adobe DNG](https://www.adobe.com/products/photoshop/extend.displayTab2.html) |
|
||||
| .jpeg | `yolo predict source=image.jpeg` | [JPEG](https://en.wikipedia.org/wiki/JPEG) |
|
||||
| .jpg | `yolo predict source=image.jpg` | [JPEG](https://en.wikipedia.org/wiki/JPEG) |
|
||||
| .mpo | `yolo predict source=image.mpo` | [Multi Picture Object](https://fileinfo.com/extension/mpo) |
|
||||
| .png | `yolo predict source=image.png` | [Portable Network Graphics](https://en.wikipedia.org/wiki/PNG) |
|
||||
| .tif | `yolo predict source=image.tif` | [Tag Image File Format](https://en.wikipedia.org/wiki/TIFF) |
|
||||
| .tiff | `yolo predict source=image.tiff` | [Tag Image File Format](https://en.wikipedia.org/wiki/TIFF) |
|
||||
| .webp | `yolo predict source=image.webp` | [WebP](https://en.wikipedia.org/wiki/WebP) |
|
||||
| .pfm | `yolo predict source=image.pfm` | [Portable FloatMap](https://en.wikipedia.org/wiki/Netpbm#File_formats) |
|
||||
| `.bmp` | `yolo predict source=image.bmp` | [Microsoft BMP File Format](https://en.wikipedia.org/wiki/BMP_file_format) |
|
||||
| `.dng` | `yolo predict source=image.dng` | [Adobe DNG](https://www.adobe.com/products/photoshop/extend.displayTab2.html) |
|
||||
| `.jpeg` | `yolo predict source=image.jpeg` | [JPEG](https://en.wikipedia.org/wiki/JPEG) |
|
||||
| `.jpg` | `yolo predict source=image.jpg` | [JPEG](https://en.wikipedia.org/wiki/JPEG) |
|
||||
| `.mpo` | `yolo predict source=image.mpo` | [Multi Picture Object](https://fileinfo.com/extension/mpo) |
|
||||
| `.png` | `yolo predict source=image.png` | [Portable Network Graphics](https://en.wikipedia.org/wiki/PNG) |
|
||||
| `.tif` | `yolo predict source=image.tif` | [Tag Image File Format](https://en.wikipedia.org/wiki/TIFF) |
|
||||
| `.tiff` | `yolo predict source=image.tiff` | [Tag Image File Format](https://en.wikipedia.org/wiki/TIFF) |
|
||||
| `.webp` | `yolo predict source=image.webp` | [WebP](https://en.wikipedia.org/wiki/WebP) |
|
||||
| `.pfm` | `yolo predict source=image.pfm` | [Portable FloatMap](https://en.wikipedia.org/wiki/Netpbm#File_formats) |
|
||||
|
||||
### Videos
|
||||
|
||||
@ -401,18 +416,18 @@ The below table contains valid Ultralytics video formats.
|
||||
|
||||
| Video Suffixes | Example Predict Command | Reference |
|
||||
|----------------|----------------------------------|----------------------------------------------------------------------------------|
|
||||
| .asf | `yolo predict source=video.asf` | [Advanced Systems Format](https://en.wikipedia.org/wiki/Advanced_Systems_Format) |
|
||||
| .avi | `yolo predict source=video.avi` | [Audio Video Interleave](https://en.wikipedia.org/wiki/Audio_Video_Interleave) |
|
||||
| .gif | `yolo predict source=video.gif` | [Graphics Interchange Format](https://en.wikipedia.org/wiki/GIF) |
|
||||
| .m4v | `yolo predict source=video.m4v` | [MPEG-4 Part 14](https://en.wikipedia.org/wiki/M4V) |
|
||||
| .mkv | `yolo predict source=video.mkv` | [Matroska](https://en.wikipedia.org/wiki/Matroska) |
|
||||
| .mov | `yolo predict source=video.mov` | [QuickTime File Format](https://en.wikipedia.org/wiki/QuickTime_File_Format) |
|
||||
| .mp4 | `yolo predict source=video.mp4` | [MPEG-4 Part 14 - Wikipedia](https://en.wikipedia.org/wiki/MPEG-4_Part_14) |
|
||||
| .mpeg | `yolo predict source=video.mpeg` | [MPEG-1 Part 2](https://en.wikipedia.org/wiki/MPEG-1) |
|
||||
| .mpg | `yolo predict source=video.mpg` | [MPEG-1 Part 2](https://en.wikipedia.org/wiki/MPEG-1) |
|
||||
| .ts | `yolo predict source=video.ts` | [MPEG Transport Stream](https://en.wikipedia.org/wiki/MPEG_transport_stream) |
|
||||
| .wmv | `yolo predict source=video.wmv` | [Windows Media Video](https://en.wikipedia.org/wiki/Windows_Media_Video) |
|
||||
| .webm | `yolo predict source=video.webm` | [WebM Project](https://en.wikipedia.org/wiki/WebM) |
|
||||
| `.asf` | `yolo predict source=video.asf` | [Advanced Systems Format](https://en.wikipedia.org/wiki/Advanced_Systems_Format) |
|
||||
| `.avi` | `yolo predict source=video.avi` | [Audio Video Interleave](https://en.wikipedia.org/wiki/Audio_Video_Interleave) |
|
||||
| `.gif` | `yolo predict source=video.gif` | [Graphics Interchange Format](https://en.wikipedia.org/wiki/GIF) |
|
||||
| `.m4v` | `yolo predict source=video.m4v` | [MPEG-4 Part 14](https://en.wikipedia.org/wiki/M4V) |
|
||||
| `.mkv` | `yolo predict source=video.mkv` | [Matroska](https://en.wikipedia.org/wiki/Matroska) |
|
||||
| `.mov` | `yolo predict source=video.mov` | [QuickTime File Format](https://en.wikipedia.org/wiki/QuickTime_File_Format) |
|
||||
| `.mp4` | `yolo predict source=video.mp4` | [MPEG-4 Part 14 - Wikipedia](https://en.wikipedia.org/wiki/MPEG-4_Part_14) |
|
||||
| `.mpeg` | `yolo predict source=video.mpeg` | [MPEG-1 Part 2](https://en.wikipedia.org/wiki/MPEG-1) |
|
||||
| `.mpg` | `yolo predict source=video.mpg` | [MPEG-1 Part 2](https://en.wikipedia.org/wiki/MPEG-1) |
|
||||
| `.ts` | `yolo predict source=video.ts` | [MPEG Transport Stream](https://en.wikipedia.org/wiki/MPEG_transport_stream) |
|
||||
| `.wmv` | `yolo predict source=video.wmv` | [Windows Media Video](https://en.wikipedia.org/wiki/Windows_Media_Video) |
|
||||
| `.webm` | `yolo predict source=video.webm` | [WebM Project](https://en.wikipedia.org/wiki/WebM) |
|
||||
|
||||
## Working with Results
|
||||
|
||||
|
@ -241,6 +241,7 @@ To use Comet:
|
||||
!!! Example
|
||||
|
||||
=== "Python"
|
||||
|
||||
```python
|
||||
# pip install comet_ml
|
||||
import comet_ml
|
||||
@ -259,6 +260,7 @@ To use ClearML:
|
||||
!!! Example
|
||||
|
||||
=== "Python"
|
||||
|
||||
```python
|
||||
# pip install clearml
|
||||
import clearml
|
||||
@ -277,6 +279,7 @@ To use TensorBoard in [Google Colab](https://colab.research.google.com/github/ul
|
||||
!!! Example
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
load_ext tensorboard
|
||||
tensorboard --logdir ultralytics/runs # replace with 'runs' directory
|
||||
@ -287,6 +290,7 @@ To use TensorBoard locally run the below command and view results at http://loca
|
||||
!!! Example
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
tensorboard --logdir ultralytics/runs # replace with 'runs' directory
|
||||
```
|
||||
|
@ -67,6 +67,7 @@ Validate trained YOLOv8n model accuracy on the COCO128 dataset. No argument need
|
||||
metrics.box.map75 # map75
|
||||
metrics.box.maps # a list contains map50-95 of each category
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
|
@ -22,6 +22,7 @@ Ultralytics provides various installation methods including pip, conda, and Dock
|
||||
!!! Example "Install"
|
||||
|
||||
=== "Pip install (recommended)"
|
||||
|
||||
Install the `ultralytics` package using pip, or update an existing installation by running `pip install -U ultralytics`. Visit the Python Package Index (PyPI) for more details on the `ultralytics` package: [https://pypi.org/project/ultralytics/](https://pypi.org/project/ultralytics/).
|
||||
|
||||
[](https://badge.fury.io/py/ultralytics) [](https://pepy.tech/project/ultralytics)
|
||||
@ -38,8 +39,8 @@ Ultralytics provides various installation methods including pip, conda, and Dock
|
||||
pip install git+https://github.com/ultralytics/ultralytics.git@main
|
||||
```
|
||||
|
||||
|
||||
=== "Conda install"
|
||||
|
||||
Conda is an alternative package manager to pip which may also be used for installation. Visit Anaconda for more details at [https://anaconda.org/conda-forge/ultralytics](https://anaconda.org/conda-forge/ultralytics). Ultralytics feedstock repository for updating the conda package is at [https://github.com/conda-forge/ultralytics-feedstock/](https://github.com/conda-forge/ultralytics-feedstock/).
|
||||
|
||||
|
||||
|
@ -64,6 +64,7 @@ Train a YOLOv8-pose model on the COCO128-pose dataset.
|
||||
# Train the model
|
||||
results = model.train(data='coco8-pose.yaml', epochs=100, imgsz=640)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
|
@ -193,18 +193,21 @@ Default arguments can be overridden by simply passing them as arguments in the C
|
||||
!!! Tip ""
|
||||
|
||||
=== "Train"
|
||||
|
||||
Train a detection model for `10 epochs` with `learning_rate` of `0.01`
|
||||
```bash
|
||||
yolo detect train data=coco128.yaml model=yolov8n.pt epochs=10 lr0=0.01
|
||||
```
|
||||
|
||||
=== "Predict"
|
||||
|
||||
Predict a YouTube video using a pretrained segmentation model at image size 320:
|
||||
```bash
|
||||
yolo segment predict model=yolov8n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
|
||||
```
|
||||
|
||||
=== "Val"
|
||||
|
||||
Validate a pretrained detection model at batch-size 1 and image size 640:
|
||||
```bash
|
||||
yolo detect val model=yolov8n.pt data=coco128.yaml batch=1 imgsz=640
|
||||
@ -221,6 +224,7 @@ This will create `default_copy.yaml`, which you can then pass as `cfg=default_co
|
||||
!!! Example
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
yolo copy-cfg
|
||||
yolo cfg=default_copy.yaml imgsz=320
|
||||
|
@ -52,6 +52,7 @@ Train mode is used for training a YOLOv8 model on a custom dataset. In this mode
|
||||
!!! Example "Train"
|
||||
|
||||
=== "From pretrained(recommended)"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -60,6 +61,7 @@ Train mode is used for training a YOLOv8 model on a custom dataset. In this mode
|
||||
```
|
||||
|
||||
=== "From scratch"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -68,6 +70,7 @@ Train mode is used for training a YOLOv8 model on a custom dataset. In this mode
|
||||
```
|
||||
|
||||
=== "Resume"
|
||||
|
||||
```python
|
||||
model = YOLO("last.pt")
|
||||
results = model.train(resume=True)
|
||||
@ -82,6 +85,7 @@ Val mode is used for validating a YOLOv8 model after it has been trained. In thi
|
||||
!!! Example "Val"
|
||||
|
||||
=== "Val after training"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -91,6 +95,7 @@ Val mode is used for validating a YOLOv8 model after it has been trained. In thi
|
||||
```
|
||||
|
||||
=== "Val independently"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
@ -110,6 +115,7 @@ Predict mode is used for making predictions using a trained YOLOv8 model on new
|
||||
!!! Example "Predict"
|
||||
|
||||
=== "From source"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
from PIL import Image
|
||||
@ -133,6 +139,7 @@ Predict mode is used for making predictions using a trained YOLOv8 model on new
|
||||
```
|
||||
|
||||
=== "Results usage"
|
||||
|
||||
```python
|
||||
# results would be a list of Results object including all the predictions by default
|
||||
# but be careful as it could occupy a lot memory when there're many images,
|
||||
|
Loading…
x
Reference in New Issue
Block a user