YOLO11 Tasks, Modes, Usage, Macros and Solutions Updates (#16593)

Signed-off-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Ultralytics Assistant 2024-10-01 15:41:15 +02:00 committed by GitHub
parent 3093fc9ec2
commit 51e93d6111
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 541 additions and 541 deletions

View file

@ -1,7 +1,7 @@
---
comments: true
description: Explore Ultralytics callbacks for training, validation, exporting, and prediction. Learn how to use and customize them for your ML models.
keywords: Ultralytics, callbacks, training, validation, export, prediction, ML models, YOLOv8, Python, machine learning
keywords: Ultralytics, callbacks, training, validation, export, prediction, ML models, YOLO11, Python, machine learning
---
## Callbacks
@ -16,7 +16,7 @@ Ultralytics framework supports callbacks as entry points in strategic stages of
allowfullscreen>
</iframe>
<br>
<strong>Watch:</strong> Mastering Ultralytics YOLOv8: Callbacks
<strong>Watch:</strong> Mastering Ultralytics YOLO: Callbacks
</p>
## Examples
@ -41,7 +41,7 @@ def on_predict_batch_end(predictor):
# Create a YOLO model instance
model = YOLO("yolov8n.pt")
model = YOLO("yolo11n.pt")
# Add the custom callback to the model
model.add_callback("on_predict_batch_end", on_predict_batch_end)
@ -119,7 +119,7 @@ def on_predict_batch_end(predictor):
predictor.results = zip(predictor.results, image)
model = YOLO("yolov8n.pt")
model = YOLO("yolo11n.pt")
model.add_callback("on_predict_batch_end", on_predict_batch_end)
for result, frame in model.predict():
pass
@ -141,7 +141,7 @@ def on_train_epoch_end(trainer):
trainer.log({"additional_metric": additional_metric})
model = YOLO("yolov8n.pt")
model = YOLO("yolo11n.pt")
model.add_callback("on_train_epoch_end", on_train_epoch_end)
model.train(data="coco.yaml", epochs=10)
```
@ -164,7 +164,7 @@ def on_val_end(validator):
validator.log({"custom_metric": custom_metric})
model = YOLO("yolov8n.pt")
model = YOLO("yolo11n.pt")
model.add_callback("on_val_end", on_val_end)
model.val(data="coco.yaml")
```
@ -187,7 +187,7 @@ def on_predict_end(predictor):
log_prediction(result)
model = YOLO("yolov8n.pt")
model = YOLO("yolo11n.pt")
model.add_callback("on_predict_end", on_predict_end)
results = model.predict(source="image.jpg")
```
@ -215,7 +215,7 @@ def on_predict_batch_end(predictor):
predictor.results = zip(predictor.results, image)
model = YOLO("yolov8n.pt")
model = YOLO("yolo11n.pt")
model.add_callback("on_predict_batch_end", on_predict_batch_end)
for result, frame in model.predict():
pass