roboflow / supervision

We write your reusable computer vision tools. šŸ’œ
https://supervision.roboflow.com
MIT License
24.33k stars 1.81k forks source link

Zone_annotator error when Yolo predictions/tracking are out of bounds (resolution) #51

Closed arturovv21 closed 1 year ago

arturovv21 commented 1 year ago

Search before asking

Bug

Hello, I am reporting an issue I found when using Yolo tracking/prediction results. Zone_annotator does not work properly when using the Yolo track model results. Sometimes, prediction index goes out of bounds when the object goes out of the image to fast. Out of bounds values in the xyxy detections/predictions (e.g. predicted 480.4, but limit is 480.0 in the resolution). I think it is due to X and Y being interpolated out of the index while moving? Then the zone_annotator gives an error at "zone.trigger(detections=detections)" and stop the code: Detections(xyxy=array([[136.70734, 166.26642, 641.2425 , 480.40762], [157.55916, 270.19525, 212.24619, 369.16534]], dtype=float32), class_id=array([ 0, 67]), confidence=array([0.96505105, 0.938522 ], dtype=float32), tracker_id=array([2, 4])) Traceback (most recent call last): File "C:\Users\artur\miniconda3\lib\site-packages\supervision\detection\polygon_zone.py", line 34, in trigger is_in_zone = self.mask[anchors[:, 1], anchors[:, 0]] IndexError: index 480 is out of bounds for axis 0 with size 480

Environment

No response

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

Hello there, thank you for opening an Issue ! šŸ™šŸ» The team was notified and they will get back to you asap.

SkalskiP commented 1 year ago

Hi @arturovv21 šŸ‘‹šŸ»! What version of supervision are you using?

arturovv21 commented 1 year ago

Hi @arturovv21 šŸ‘‹šŸ»! What version of supervision are you using?

Hi @SkalskiP, I'm using supervision 0.3.0 and ultralytics 8.0.55

SkalskiP commented 1 year ago

I think https://github.com/roboflow/supervision/pull/46 PR solved this problem. That change was released with version 0.3.1. Could you try to update the version of supervision in your project and try if it solves your problem?

SkalskiP commented 1 year ago

@arturovv21, any updates on that?

arturovv21 commented 1 year ago

@arturovv21, any updates on that?

Yes, it is working now, thanks! I installed 0.3.2.