-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate line and zone counters for separate classes #87
Comments
Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap. |
Hi @zburq 👋🏻!
Yup, using 'majority class' was what I did in the past too. If your model is flickering between classes, that should be able to give you a better class assignment. Other things you could do:
Unfortunately, this is a bad idea. For us to be able to say that object crossed the line, we need to be able to detect it on both sides of the line reliably. For example, it was on the left, and now it is on the right. If the line is too close to the edge of the frame in many cases, you won't get that final detection when the whole box makes it to the other side.
This one feels better to me as you want need to write a lot of custom logic. Simply divide detections into groups and run each part through the associated line counter. detections = Detections.from_yolov8(result)
detections_0 = detections[detections.class_id == 0]
line_counter_0.trigger(detections=detections_0) |
@zburq i have accomplished determining what object and class crossed the line by checking the changes in the tracker state .for each line_counter once the state changes from True to False or viceversa depending on the direction the object crossed you can then extract the class of that object based on the tracked_id. i will share my implementation to see if it helps. |
@maddust yup, that is a good solution. Would it be helpful if |
@SkalskiP that would be great. I also have noticed some weird behavior when you have multiple lines . Sometimes the object gets counted even if it is outside of the line. A good test to replicate this is having two line counters collinear to each other . |
In that case, I'll keep this issue open. And add an |
@maddust what version of |
|
ooooh you have no idea how proud I am to see you use Second of all, I understand what is happening. You are genuinely battle-testing that feature. Take a look below 👇. It looks like, and according to our logic, lines are endless. We would need to add a second condition to our logic that, at the moment when the object crosses the line, it is between two perpendicular (invisible) lines. And only count crossing if detection is in the right positioning. |
@maddust I want to work on the fix for the bug. It would be awesome if you could share your line-counting logic and a short video example. Would that be possible? |
hey @SkalskiP please find in the following https://github.com/maddust/Supervision-Line-Counter btw thank you and the roboflow team for sharing this great project !, glad to help at least testing things out ! . for the video please let me know what you would like me to show apart from the one i shared. |
You shared processing result. I’d love to have raw video that I can use to reproduce your experiment. |
|
Thanks a lot 👍🏻 I'll try to work on some fix. I hope I'll be able to work on it soon. But it can take me few days :/ |
@SkalskiP i was able to fix the issue by adding this logic to the LineZone Tigger . please review . it would be nice to also be able to select which anchor Position will trigger the count for now i choose the bottom center .since i was no able to figure out how to make a parameter as how it is in PolygonZone. hope it helps. :)
|
Hi @zburq, This is an issue for this problem; you can try this one. I'm overriding both Suppervision Lib and also with @maddust's help. This could be what you're looking for.
|
@SkalskiP I cannot find anything in the documentation talking about LineZone (I only see PolygonZone). Can you please add it? |
Hi, @ElNoSabe322 👋🏻! We want to redesign |
Oh I see... yeah fair enough. Thank you for your reply @SkalskiP. I will await the documentation and the updated release (I do not have anything else to ask for now). 👍 |
I think
For example, if one would like to track vehicles crossing a line, then do ANPR when the linezone is triggered to get accurate license plate recognition, it would be much easier if the above functionalities were separate and customizable. |
Search before asking
Question
My YOLO V8 is detecting & classifying several classes, say
classes = [2, 3, 5, 7]
:I then follow examples by @SkalskiP and do something like:
Finally I can return and use
line_counter.in_count
andline_counter.out_count
for other tasks.Currently,
LineZone().trigger
will+=1
the in/out counts if a detection of any class crosses the line.I'd like to keep a running tally of in/out counts for each class. Two possibilities:
LineZone
objects, one for each class, orLineZone
object to keep track of which class triggered how many counts.I have modified my local code to accomplish this for now, but this would be a useful feature.
Perhaps
LineZone.in_count
andLineZone.out_count
could old a vector corresponding to the classPotential problem: Sometimes the classification of the tracked object flips between different classes during the tracking or line-crossing. My instinct is to use the majority class. For this, the line would have to be at the edge of the frame, so that we have seen all the classifications.
Anyone else solving a similar problem? Any better ideas?
Additional
No response
The text was updated successfully, but these errors were encountered: