Issue Encountered with Code "How to Detect and Count Objects in Polygon Zone"

Hello,

I hope this message finds you well. I’m writing to inform you about an error I encountered while working on the code example titled “How to Detect and Count Objects in Polygon Zone.”

I came across the following error:

I would greatly appreciate it if you could assist me in resolving this issue. Your help in fixing this error would be invaluable to me.

Best regards

Hey @shahin_amini :wave:

Welcome to the community - good to see you trying out Roboflow!

What would help is seeing what the error says. Can you post it here, please? :slight_smile:

At the same time, I see you’re using some functions only found in older supervision versions. Could you change to sv.Detections.from_ultralytics, instead of from_yolov8?

Hi! Found the same issue. The tutorial @shahin_amini is using is this

The error got from running the code above was this. Hope this helps with fixing the issue :+1:

did not work

exactly!
and i don’t know how to fix it.

Thanks @Nathan_Yan, that’s very useful info.

I feel like I’ve seen this issue before - looking into it right now.

Hi @shahin_amini, @Nathan_Yan,

I found what’s causing the issue. Turns out - our tutorial is a bit old. I’ll make sure it’s updated soon.

In the mean time, would this solve your problem?

Note that I see 2 slightly-old parts in this too:

  1. We’re using sv.Color.WHITE instead of sv.Color.white()
  2. We’ve changed sv.Detections.from_yolov8 to sv.Detections.from_ultralytics

Let me know if that solves your problem!

Didn’t work yet
R U sure it works?

Indeed, I found one issue in this blog too. Following updates this year, the iterators are missing an extra _ in the results.

I did get it working here: Google Colab

it seems it works
thanks a lot!