That’s the code i’m using to set YOLO.
generator = get_video_frames_generator(SOURCE_VIDEO_PATH)
box_annotator = BoxAnnotator(color=ColorPalette(), thickness=4,
text_thickness=4, text_scale=2)
iterator = iter(generator)
frame = next(iterator)
results = model(frame)
detections = Detections(
xyxy=results[0].boxes.xyxy.cpu().numpy(),
confidence=results[0].boxes.conf.cpu().numpy(),
class_id=results[0].boxes.cls.cpu().numpy().astype(int)
)
labels = [
f"{CLASS_NAMES_DICT[class_id]} {confidence:0.2f}"
for _, confidence, class_id, tracker_id
in detections
]
frame = box_annotator.annotate(frame=frame, detections=detections, labels=labels)
%matplotlib inline
show_frame_in_notebook(frame, (16, 16))
Then, it gives me the next error:
- init() missing 1 required positional argument: ‘colors’
How can i solve that?
New contributor
L1rola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.