Apply new Ruff actions to Python codeblocks (#13783)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-06-18 20:51:37 +02:00 committed by GitHub
parent c0305f4e15
commit 6bddeda34b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 95 additions and 99 deletions

View file

@ -41,7 +41,7 @@ def on_predict_batch_end(predictor):
# Create a YOLO model instance
model = YOLO(f"yolov8n.pt")
model = YOLO("yolov8n.pt")
# Add the custom callback to the model
model.add_callback("on_predict_batch_end", on_predict_batch_end)

View file

@ -349,6 +349,16 @@ from ultralytics.utils.ops import (
xyxy2ltwh, # xyxy → top-left corner, w, h
xyxy2xywhn, # pixel → normalized
)
for func in (
ltwh2xywh,
ltwh2xyxy,
xywh2ltwh,
xywh2xyxy,
xywhn2xyxy,
xyxy2ltwh,
xyxy2xywhn):
print(help(func)) # print function docstrings
```
See docstring for each function or visit the `ultralytics.utils.ops` [reference page](../reference/utils/ops.md) to read more about each function.
@ -467,7 +477,10 @@ Want or need to use the formats of [images or videos types supported](../modes/p
from ultralytics.data.utils import IMG_FORMATS, VID_FORMATS
print(IMG_FORMATS)
# >>> ('bmp', 'dng', 'jpeg', 'jpg', 'mpo', 'png', 'tif', 'tiff', 'webp', 'pfm')
# {'tiff', 'pfm', 'bmp', 'mpo', 'dng', 'jpeg', 'png', 'webp', 'tif', 'jpg'}
print(VID_FORMATS)
# {'avi', 'mpg', 'wmv', 'mpeg', 'm4v', 'mov', 'mp4', 'asf', 'mkv', 'ts', 'gif', 'webm'}
```
### Make Divisible