This commit is contained in:
Glenn Jocher 2023-09-10 04:58:24 +02:00 committed by GitHub
parent 16ce193d6e
commit dbc53f6741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 26 additions and 25 deletions

View File

@ -21,10 +21,10 @@ Support for training trackers alone is coming soon
from ultralytics import YOLO from ultralytics import YOLO
model = YOLO('yolov8n.pt') model = YOLO('yolov8n.pt')
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", conf=0.3, iou=0.5, show=True) results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
``` ```
=== "CLI" === "CLI"
```bash ```bash
yolo track model=yolov8n.pt source="https://youtu.be/Zgi9g1ksQHc" conf=0.3, iou=0.5 show yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3, iou=0.5 show
``` ```

View File

@ -67,7 +67,7 @@ YOLOv8 can process different types of input sources for inference, as shown in t
| video ✅ | `'video.mp4'` | `str` or `Path` | Video file in formats like MP4, AVI, etc. | | video ✅ | `'video.mp4'` | `str` or `Path` | Video file in formats like MP4, AVI, etc. |
| directory ✅ | `'path/'` | `str` or `Path` | Path to a directory containing images or videos. | | directory ✅ | `'path/'` | `str` or `Path` | Path to a directory containing images or videos. |
| glob ✅ | `'path/*.jpg'` | `str` | Glob pattern to match multiple files. Use the `*` character as a wildcard. | | glob ✅ | `'path/*.jpg'` | `str` | Glob pattern to match multiple files. Use the `*` character as a wildcard. |
| YouTube ✅ | `'https://youtu.be/Zgi9g1ksQHc'` | `str` | URL to a YouTube video. | | YouTube ✅ | `'https://youtu.be/LNwODJXcvt4'` | `str` | URL to a YouTube video. |
| stream ✅ | `'rtsp://example.com/media.mp4'` | `str` | URL for streaming protocols such as RTSP, RTMP, or an IP address. | | stream ✅ | `'rtsp://example.com/media.mp4'` | `str` | URL for streaming protocols such as RTSP, RTMP, or an IP address. |
| multi-stream ✅ | `'list.streams'` | `str` or `Path` | `*.streams` text file with one stream URL per row, i.e. 8 streams will run at batch-size 8. | | multi-stream ✅ | `'list.streams'` | `str` or `Path` | `*.streams` text file with one stream URL per row, i.e. 8 streams will run at batch-size 8. |
@ -257,7 +257,7 @@ Below are code examples for using each source type:
model = YOLO('yolov8n.pt') model = YOLO('yolov8n.pt')
# Define source as YouTube video URL # Define source as YouTube video URL
source = 'https://youtu.be/Zgi9g1ksQHc' source = 'https://youtu.be/LNwODJXcvt4'
# Run inference on the source # Run inference on the source
results = model(source, stream=True) # generator of Results objects results = model(source, stream=True) # generator of Results objects

View File

@ -37,18 +37,18 @@ To run the tracker on video streams, use a trained Detect, Segment or Pose model
model = YOLO('path/to/best.pt') # Load a custom trained model model = YOLO('path/to/best.pt') # Load a custom trained model
# Perform tracking with the model # Perform tracking with the model
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", show=True) # Tracking with default tracker results = model.track(source="https://youtu.be/LNwODJXcvt4", show=True) # Tracking with default tracker
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", show=True, tracker="bytetrack.yaml") # Tracking with ByteTrack tracker results = model.track(source="https://youtu.be/LNwODJXcvt4", show=True, tracker="bytetrack.yaml") # Tracking with ByteTrack tracker
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Perform tracking with various models using the command line interface # Perform tracking with various models using the command line interface
yolo track model=yolov8n.pt source="https://youtu.be/Zgi9g1ksQHc" # Official Detect model yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" # Official Detect model
yolo track model=yolov8n-seg.pt source="https://youtu.be/Zgi9g1ksQHc" # Official Segment model yolo track model=yolov8n-seg.pt source="https://youtu.be/LNwODJXcvt4" # Official Segment model
yolo track model=yolov8n-pose.pt source="https://youtu.be/Zgi9g1ksQHc" # Official Pose model yolo track model=yolov8n-pose.pt source="https://youtu.be/LNwODJXcvt4" # Official Pose model
yolo track model=path/to/best.pt source="https://youtu.be/Zgi9g1ksQHc" # Custom trained model yolo track model=path/to/best.pt source="https://youtu.be/LNwODJXcvt4" # Custom trained model
# Track using ByteTrack tracker # Track using ByteTrack tracker
yolo track model=path/to/best.pt tracker="bytetrack.yaml" yolo track model=path/to/best.pt tracker="bytetrack.yaml"
@ -71,14 +71,14 @@ Tracking configuration shares properties with Predict mode, such as `conf`, `iou
# Configure the tracking parameters and run the tracker # Configure the tracking parameters and run the tracker
model = YOLO('yolov8n.pt') model = YOLO('yolov8n.pt')
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", conf=0.3, iou=0.5, show=True) results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Configure tracking parameters and run the tracker using the command line interface # Configure tracking parameters and run the tracker using the command line interface
yolo track model=yolov8n.pt source="https://youtu.be/Zgi9g1ksQHc" conf=0.3, iou=0.5 show yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3, iou=0.5 show
``` ```
### Tracker Selection ### Tracker Selection
@ -94,14 +94,14 @@ Ultralytics also allows you to use a modified tracker configuration file. To do
# Load the model and run the tracker with a custom configuration file # Load the model and run the tracker with a custom configuration file
model = YOLO('yolov8n.pt') model = YOLO('yolov8n.pt')
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", tracker='custom_tracker.yaml') results = model.track(source="https://youtu.be/LNwODJXcvt4", tracker='custom_tracker.yaml')
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Load the model and run the tracker with a custom configuration file using the command line interface # Load the model and run the tracker with a custom configuration file using the command line interface
yolo track model=yolov8n.pt source="https://youtu.be/Zgi9g1ksQHc" tracker='custom_tracker.yaml' yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" tracker='custom_tracker.yaml'
``` ```
For a comprehensive list of tracking arguments, refer to the [ultralytics/cfg/trackers](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/cfg/trackers) page. For a comprehensive list of tracking arguments, refer to the [ultralytics/cfg/trackers](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/cfg/trackers) page.

View File

@ -153,7 +153,7 @@ The Ultralytics command line interface (CLI) allows for simple single-line comma
Predict a YouTube video using a pretrained segmentation model at image size 320: Predict a YouTube video using a pretrained segmentation model at image size 320:
```bash ```bash
yolo predict model=yolov8n-seg.pt source='https://youtu.be/Zgi9g1ksQHc' imgsz=320 yolo predict model=yolov8n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
``` ```
=== "Val" === "Val"

View File

@ -34,7 +34,7 @@ CLI requires no customization or Python code. You can simply run all tasks from
Predict a YouTube video using a pretrained segmentation model at image size 320: Predict a YouTube video using a pretrained segmentation model at image size 320:
```bash ```bash
yolo predict model=yolov8n-seg.pt source='https://youtu.be/Zgi9g1ksQHc' imgsz=320 yolo predict model=yolov8n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
``` ```
=== "Val" === "Val"
@ -196,7 +196,7 @@ Default arguments can be overridden by simply passing them as arguments in the C
=== "Predict" === "Predict"
Predict a YouTube video using a pretrained segmentation model at image size 320: Predict a YouTube video using a pretrained segmentation model at image size 320:
```bash ```bash
yolo segment predict model=yolov8n-seg.pt source='https://youtu.be/Zgi9g1ksQHc' imgsz=320 yolo segment predict model=yolov8n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
``` ```
=== "Val" === "Val"

View File

@ -220,8 +220,8 @@ for applications such as surveillance systems or self-driving cars.
model = YOLO('path/to/best.pt') # load a custom model model = YOLO('path/to/best.pt') # load a custom model
# Track with the model # Track with the model
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", show=True) results = model.track(source="https://youtu.be/LNwODJXcvt4", show=True)
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", show=True, tracker="bytetrack.yaml") results = model.track(source="https://youtu.be/LNwODJXcvt4", show=True, tracker="bytetrack.yaml")
``` ```
[Track Examples](../modes/track.md){ .md-button .md-button--primary} [Track Examples](../modes/track.md){ .md-button .md-button--primary}

View File

@ -55,7 +55,7 @@ python detect.py --weights yolov5s.pt --source 0 #
list.txt # list of images list.txt # list of images
list.streams # list of streams list.streams # list of streams
'path/*.jpg' # glob 'path/*.jpg' # glob
'https://youtu.be/Zgi9g1ksQHc' # YouTube 'https://youtu.be/LNwODJXcvt4' # YouTube
'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
``` ```

View File

@ -42,7 +42,7 @@ CLI_HELP_MSG = \
yolo train data=coco128.yaml model=yolov8n.pt epochs=10 lr0=0.01 yolo train data=coco128.yaml model=yolov8n.pt epochs=10 lr0=0.01
2. Predict a YouTube video using a pretrained segmentation model at image size 320: 2. Predict a YouTube video using a pretrained segmentation model at image size 320:
yolo predict model=yolov8n-seg.pt source='https://youtu.be/Zgi9g1ksQHc' imgsz=320 yolo predict model=yolov8n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
3. Val a pretrained detection model at batch-size 1 and image size 640: 3. Val a pretrained detection model at batch-size 1 and image size 640:
yolo val model=yolov8n.pt data=coco128.yaml batch=1 imgsz=640 yolo val model=yolov8n.pt data=coco128.yaml batch=1 imgsz=640

View File

@ -48,7 +48,7 @@ class LoadStreams:
# Start thread to read frames from video stream # Start thread to read frames from video stream
st = f'{i + 1}/{n}: {s}... ' st = f'{i + 1}/{n}: {s}... '
if urlparse(s).hostname in ('www.youtube.com', 'youtube.com', 'youtu.be'): # if source is YouTube video if urlparse(s).hostname in ('www.youtube.com', 'youtube.com', 'youtu.be'): # if source is YouTube video
# YouTube format i.e. 'https://www.youtube.com/watch?v=Zgi9g1ksQHc' or 'https://youtu.be/Zgi9g1ksQHc' # YouTube format i.e. 'https://www.youtube.com/watch?v=Zgi9g1ksQHc' or 'https://youtu.be/LNwODJXcvt4'
s = get_best_youtube_url(s) s = get_best_youtube_url(s)
s = eval(s) if s.isnumeric() else s # i.e. s = '0' local webcam s = eval(s) if s.isnumeric() else s # i.e. s = '0' local webcam
if s == 0 and (is_colab() or is_kaggle()): if s == 0 and (is_colab() or is_kaggle()):

View File

@ -11,7 +11,7 @@ Usage - sources:
list.txt # list of images list.txt # list of images
list.streams # list of streams list.streams # list of streams
'path/*.jpg' # glob 'path/*.jpg' # glob
'https://youtu.be/Zgi9g1ksQHc' # YouTube 'https://youtu.be/LNwODJXcvt4' # YouTube
'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
Usage - formats: Usage - formats:

View File

@ -117,7 +117,8 @@ class HUBTrainingSession:
if data['status'] == 'new': # new model to start training if data['status'] == 'new': # new model to start training
self.train_args = { self.train_args = {
'batch': data['batch'], # TODO deprecate before 8.1.0
'batch': data['batch' if 'batch' in data else 'batch_size'],
'epochs': data['epochs'], 'epochs': data['epochs'],
'imgsz': data['imgsz'], 'imgsz': data['imgsz'],
'patience': data['patience'], 'patience': data['patience'],

View File

@ -77,7 +77,7 @@ HELP_MSG = \
yolo detect train data=coco128.yaml model=yolov8n.pt epochs=10 lr0=0.01 yolo detect train data=coco128.yaml model=yolov8n.pt epochs=10 lr0=0.01
- Predict a YouTube video using a pretrained segmentation model at image size 320: - Predict a YouTube video using a pretrained segmentation model at image size 320:
yolo segment predict model=yolov8n-seg.pt source='https://youtu.be/Zgi9g1ksQHc' imgsz=320 yolo segment predict model=yolov8n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
- Val a pretrained detection model at batch-size 1 and image size 640: - Val a pretrained detection model at batch-size 1 and image size 640:
yolo detect val model=yolov8n.pt data=coco128.yaml batch=1 imgsz=640 yolo detect val model=yolov8n.pt data=coco128.yaml batch=1 imgsz=640