supervision: Loading OBB detection from ultralytics fails
Search before asking
- I have searched the Supervision issues and found no similar bug report.
Bug
When passing in the results from ultralytics yolov8 OBB model to from_ultralytics it will fail and give the following:
AttributeError: ‘NoneType’ object has no attribute ‘cls’
due to:
class_id = ultralytics_results.boxes.cls.cpu().numpy().astype(int)
Environment
- Supervision 0.20.0
- Ultralytics 8.2.18
Minimal Reproducible Example
from typing import List
import cv2
from ultralytics import YOLO
from supervision import Detections
from ultralytics.engine.results import Results
from supervision.tracker.byte_tracker.core import ByteTrack
yolo = YOLO("yolov8n-obb.pt", task="obb")
tracker = ByteTrack(track_activation_threshold=0.8,
minimum_matching_threshold=0.8,
lost_track_buffer=30,
frame_rate=30)
video_feed = cv2.VideoCapture("test_rgb.mp4")
status, frame = video_feed.read()
while status:
results: List[Results] = yolo(frame,
show=False,
verbose=False,
imgsz=[736, 1280])
result: Results = results[0]
inference_detections: Detections = Detections.from_ultralytics(result)
detections = tracker.update_with_detections(inference_detections)
for (xyxy, mask, conf, class_id, tracker_id, data) in detections:
print("xyxy:", xyxy)
status, frame = video_feed.read()
Additional
No response
Are you willing to submit a PR?
- Yes I’d like to help by submitting a PR!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (4 by maintainers)
I think you forgot the press “comment” because I don’t see it.