Docs cleanup and Google-style tracker docstrings (#6751)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
60041014a8
commit
80802be1e5
44 changed files with 740 additions and 529 deletions
|
|
@ -15,15 +15,19 @@ Ultralytics framework supports callbacks as entry points in strategic stages of
|
|||
In this example, we want to return the original frame with each result object. Here's how we can do that
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO
|
||||
|
||||
|
||||
def on_predict_batch_end(predictor):
|
||||
# Retrieve the batch data
|
||||
_, im0s, _, _ = predictor.batch
|
||||
_, image, _, _ = predictor.batch
|
||||
|
||||
# Ensure that im0s is a list
|
||||
im0s = im0s if isinstance(im0s, list) else [im0s]
|
||||
# Ensure that image is a list
|
||||
image = image if isinstance(image, list) else [image]
|
||||
|
||||
# Combine the prediction results with the corresponding frames
|
||||
predictor.results = zip(predictor.results, im0s)
|
||||
predictor.results = zip(predictor.results, image)
|
||||
|
||||
|
||||
# Create a YOLO model instance
|
||||
model = YOLO(f'yolov8n.pt')
|
||||
|
|
@ -32,7 +36,7 @@ model = YOLO(f'yolov8n.pt')
|
|||
model.add_callback("on_predict_batch_end", on_predict_batch_end)
|
||||
|
||||
# Iterate through the results and frames
|
||||
for (result, frame) in model.track/predict():
|
||||
for (result, frame) in model.predict(): # or model.track()
|
||||
pass
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class CustomTrainer(DetectionTrainer):
|
|||
# callback to upload model weights
|
||||
def log_model(trainer):
|
||||
last_weight_path = trainer.last
|
||||
...
|
||||
print(last_weight_path)
|
||||
|
||||
|
||||
trainer = CustomTrainer(overrides={...})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue