mirror of
https://github.com/ultralytics/ultralytics.git
synced 2025-09-15 15:48:41 +08:00
Add CLI commands for predict and train YOLOv10 models. (#13940)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
d58058505e
commit
1d7eeae325
@ -122,31 +122,56 @@ Here is a detailed comparison of YOLOv10 variants with other state-of-the-art mo
|
||||
|
||||
For predicting new images with YOLOv10:
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
!!! Example
|
||||
|
||||
# Load a pre-trained YOLOv10n model
|
||||
model = YOLO("yolov10n.pt")
|
||||
=== "Python"
|
||||
|
||||
# Perform object detection on an image
|
||||
results = model("image.jpg")
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
# Display the results
|
||||
results[0].show()
|
||||
```
|
||||
# Load a pre-trained YOLOv10n model
|
||||
model = YOLO("yolov10n.pt")
|
||||
|
||||
# Perform object detection on an image
|
||||
results = model("image.jpg")
|
||||
|
||||
# Display the results
|
||||
results[0].show()
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
# Load a COCO-pretrained YOLOv10n model and run inference on the 'bus.jpg' image
|
||||
yolo detect predict model=yolov10n.pt source=path/to/bus.jpg
|
||||
```
|
||||
|
||||
For training YOLOv10 on a custom dataset:
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
!!! Example
|
||||
|
||||
# Load YOLOv10n model from scratch
|
||||
model = YOLO("yolov10n.yaml")
|
||||
=== "Python"
|
||||
|
||||
# Train the model
|
||||
model.train(data="coco8.yaml", epochs=100, imgsz=640)
|
||||
```
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
# Load YOLOv10n model from scratch
|
||||
model = YOLO("yolov10n.yaml")
|
||||
|
||||
# Train the model
|
||||
model.train(data="coco8.yaml", epochs=100, imgsz=640)
|
||||
```
|
||||
|
||||
=== "CLI"
|
||||
|
||||
```bash
|
||||
# Build a YOLOv10n model from scratch and train it on the COCO8 example dataset for 100 epochs
|
||||
yolo train model=yolov10n.yaml data=coco8.yaml epochs=100 imgsz=640
|
||||
|
||||
# Build a YOLOv10n model from scratch and run inference on the 'bus.jpg' image
|
||||
yolo predict model=yolov10n.yaml source=path/to/bus.jpg
|
||||
```
|
||||
|
||||
## Supported Tasks and Modes
|
||||
|
||||
The YOLOv10 models series offers a range of models, each optimized for high-performance [Object Detection](../tasks/detect.md). These models cater to varying computational needs and accuracy requirements, making them versatile for a wide array of applications.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user