ultralytics 8.0.141
create new SettingsManager (#3790)
This commit is contained in:
@ -20,10 +20,10 @@ In this example, we want to return the original frame with each result object. H
|
||||
def on_predict_batch_end(predictor):
|
||||
# Retrieve the batch data
|
||||
_, im0s, _, _ = predictor.batch
|
||||
|
||||
|
||||
# Ensure that im0s is a list
|
||||
im0s = im0s if isinstance(im0s, list) else [im0s]
|
||||
|
||||
|
||||
# Combine the prediction results with the corresponding frames
|
||||
predictor.results = zip(predictor.results, im0s)
|
||||
|
||||
@ -85,4 +85,4 @@ Here are all supported callbacks. See callbacks [source code](https://github.com
|
||||
| Callback | Description |
|
||||
|-------------------|------------------------------------------|
|
||||
| `on_export_start` | Triggered when the export process starts |
|
||||
| `on_export_end` | Triggered when the export process ends |
|
||||
| `on_export_end` | Triggered when the export process ends |
|
||||
|
@ -13,19 +13,19 @@ YOLOv8 'yolo' CLI commands use the following syntax:
|
||||
!!! example ""
|
||||
|
||||
=== "CLI"
|
||||
|
||||
|
||||
```bash
|
||||
yolo TASK MODE ARGS
|
||||
```
|
||||
|
||||
=== "Python"
|
||||
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
|
||||
# Load a YOLOv8 model from a pre-trained weights file
|
||||
model = YOLO('yolov8n.pt')
|
||||
|
||||
|
||||
# Run MODE mode using the custom arguments ARGS (guess TASK)
|
||||
model.MODE(ARGS)
|
||||
```
|
||||
@ -45,9 +45,9 @@ Where:
|
||||
YOLO models can be used for a variety of tasks, including detection, segmentation, classification and pose. These tasks
|
||||
differ in the type of output they produce and the specific problem they are designed to solve.
|
||||
|
||||
**Detect**: For identifying and localizing objects or regions of interest in an image or video.
|
||||
**Segment**: For dividing an image or video into regions or pixels that correspond to different objects or classes.
|
||||
**Classify**: For predicting the class label of an input image.
|
||||
**Detect**: For identifying and localizing objects or regions of interest in an image or video.
|
||||
**Segment**: For dividing an image or video into regions or pixels that correspond to different objects or classes.
|
||||
**Classify**: For predicting the class label of an input image.
|
||||
**Pose**: For identifying objects and estimating their keypoints in an image or video.
|
||||
|
||||
| Key | Value | Description |
|
||||
@ -61,11 +61,11 @@ differ in the type of output they produce and the specific problem they are desi
|
||||
YOLO models can be used in different modes depending on the specific problem you are trying to solve. These modes
|
||||
include:
|
||||
|
||||
**Train**: For training a YOLOv8 model on a custom dataset.
|
||||
**Val**: For validating a YOLOv8 model after it has been trained.
|
||||
**Predict**: For making predictions using a trained YOLOv8 model on new images or videos.
|
||||
**Export**: For exporting a YOLOv8 model to a format that can be used for deployment.
|
||||
**Track**: For tracking objects in real-time using a YOLOv8 model.
|
||||
**Train**: For training a YOLOv8 model on a custom dataset.
|
||||
**Val**: For validating a YOLOv8 model after it has been trained.
|
||||
**Predict**: For making predictions using a trained YOLOv8 model on new images or videos.
|
||||
**Export**: For exporting a YOLOv8 model to a format that can be used for deployment.
|
||||
**Track**: For tracking objects in real-time using a YOLOv8 model.
|
||||
**Benchmark**: For benchmarking YOLOv8 exports (ONNX, TensorRT, etc.) speed and accuracy.
|
||||
|
||||
| Key | Value | Description |
|
||||
@ -251,4 +251,4 @@ it easier to debug and optimize the training process.
|
||||
| `name` | `'exp'` | experiment name. `exp` gets automatically incremented if not specified, i.e, `exp`, `exp2` ... |
|
||||
| `exist_ok` | `False` | whether to overwrite existing experiment |
|
||||
| `plots` | `False` | save plots during train/val |
|
||||
| `save` | `False` | save train checkpoints and predict results |
|
||||
| `save` | `False` | save train checkpoints and predict results |
|
||||
|
@ -74,7 +74,7 @@ Where:
|
||||
|
||||
!!! warning "Warning"
|
||||
|
||||
Arguments must be passed as `arg=val` pairs, split by an equals `=` sign and delimited by spaces ` ` between pairs. Do not use `--` argument prefixes or commas `,` beteen arguments.
|
||||
Arguments must be passed as `arg=val` pairs, split by an equals `=` sign and delimited by spaces ` ` between pairs. Do not use `--` argument prefixes or commas `,` between arguments.
|
||||
|
||||
- `yolo predict model=yolov8n.pt imgsz=640 conf=0.25` ✅
|
||||
- `yolo predict model yolov8n.pt imgsz 640 conf 0.25` ❌
|
||||
@ -88,7 +88,7 @@ the [Configuration](cfg.md) page.
|
||||
!!! example "Example"
|
||||
|
||||
=== "Train"
|
||||
|
||||
|
||||
Start training YOLOv8n on COCO128 for 100 epochs at image-size 640.
|
||||
```bash
|
||||
yolo detect train data=coco128.yaml model=yolov8n.pt epochs=100 imgsz=640
|
||||
|
@ -84,4 +84,4 @@ To know more about Callback triggering events and entry point, checkout our [Cal
|
||||
## Other engine components
|
||||
|
||||
There are other components that can be customized similarly like `Validators` and `Predictors`
|
||||
See Reference section for more information on these.
|
||||
See Reference section for more information on these.
|
||||
|
@ -29,7 +29,7 @@ To install the required packages, run:
|
||||
!!! tip "Installation"
|
||||
|
||||
```bash
|
||||
# Install and update Ultralytics and Ray Tune pacakges
|
||||
# Install and update Ultralytics and Ray Tune packages
|
||||
pip install -U ultralytics 'ray[tune]'
|
||||
|
||||
# Optionally install W&B for logging
|
||||
@ -99,7 +99,7 @@ In this example, we demonstrate how to use a custom search space for hyperparame
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
# Define a YOLO model
|
||||
# Define a YOLO model
|
||||
model = YOLO("yolov8n.pt")
|
||||
|
||||
# Run Ray Tune on the model
|
||||
@ -166,4 +166,4 @@ plt.show()
|
||||
|
||||
In this documentation, we covered common workflows to analyze the results of experiments run with Ray Tune using Ultralytics. The key steps include loading the experiment results from a directory, performing basic experiment-level and trial-level analysis and plotting metrics.
|
||||
|
||||
Explore further by looking into Ray Tune’s [Analyze Results](https://docs.ray.io/en/latest/tune/examples/tune_analyze_results.html) docs page to get the most out of your hyperparameter tuning experiments.
|
||||
Explore further by looking into Ray Tune’s [Analyze Results](https://docs.ray.io/en/latest/tune/examples/tune_analyze_results.html) docs page to get the most out of your hyperparameter tuning experiments.
|
||||
|
@ -19,22 +19,22 @@ format with just a few lines of code.
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
|
||||
# Create a new YOLO model from scratch
|
||||
model = YOLO('yolov8n.yaml')
|
||||
|
||||
|
||||
# Load a pretrained YOLO model (recommended for training)
|
||||
model = YOLO('yolov8n.pt')
|
||||
|
||||
|
||||
# Train the model using the 'coco128.yaml' dataset for 3 epochs
|
||||
results = model.train(data='coco128.yaml', epochs=3)
|
||||
|
||||
|
||||
# Evaluate the model's performance on the validation set
|
||||
results = model.val()
|
||||
|
||||
|
||||
# Perform object detection on an image using the model
|
||||
results = model('https://ultralytics.com/images/bus.jpg')
|
||||
|
||||
|
||||
# Export the model to ONNX format
|
||||
success = model.export(format='onnx')
|
||||
```
|
||||
@ -135,7 +135,7 @@ predicts the classes and locations of objects in the input images or videos.
|
||||
=== "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,
|
||||
# but be careful as it could occupy a lot memory when there're many images,
|
||||
# especially the task is segmentation.
|
||||
# 1. return as a list
|
||||
results = model.predict(source="folder")
|
||||
@ -161,7 +161,7 @@ predicts the classes and locations of objects in the input images or videos.
|
||||
# Classification
|
||||
result.probs # cls prob, (num_class, )
|
||||
|
||||
# Each result is composed of torch.Tensor by default,
|
||||
# Each result is composed of torch.Tensor by default,
|
||||
# in which you can easily use following functionality:
|
||||
result = result.cuda()
|
||||
result = result.cpu()
|
||||
@ -210,18 +210,18 @@ for applications such as surveillance systems or self-driving cars.
|
||||
!!! example "Track"
|
||||
|
||||
=== "Python"
|
||||
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
|
||||
# Load a model
|
||||
model = YOLO('yolov8n.pt') # load an official detection model
|
||||
model = YOLO('yolov8n-seg.pt') # load an official segmentation model
|
||||
model = YOLO('path/to/best.pt') # load a custom model
|
||||
|
||||
|
||||
# Track with the model
|
||||
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", show=True)
|
||||
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", show=True, tracker="bytetrack.yaml")
|
||||
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", show=True)
|
||||
results = model.track(source="https://youtu.be/Zgi9g1ksQHc", show=True, tracker="bytetrack.yaml")
|
||||
```
|
||||
|
||||
[Track Examples](../modes/track.md){ .md-button .md-button--primary}
|
||||
@ -237,11 +237,11 @@ their specific use case based on their requirements for speed and accuracy.
|
||||
!!! example "Benchmark"
|
||||
|
||||
=== "Python"
|
||||
|
||||
|
||||
Benchmark an official YOLOv8n model across all export formats.
|
||||
```python
|
||||
from ultralytics.utils.benchmarks import benchmark
|
||||
|
||||
|
||||
# Benchmark
|
||||
benchmark(model='yolov8n.pt', data='coco8.yaml', imgsz=640, half=False, device=0)
|
||||
```
|
||||
|
Reference in New Issue
Block a user