Skip to content

Extend LineZone to filter out miscounts#1540

Merged
LinasKo merged 9 commits intodevelopfrom
feature/remove-false-line-counts
Nov 6, 2024
Merged

Extend LineZone to filter out miscounts#1540
LinasKo merged 9 commits intodevelopfrom
feature/remove-false-line-counts

Conversation

@grzegorz-roboflow
Copy link
Contributor

@grzegorz-roboflow grzegorz-roboflow commented Sep 23, 2024

Description

LineZone is checking if line was crossed by comparing detection position relative to the line across 2 frames. This is resulting in miscounts when bbox flickers.

Below video shows difference in counts between current develop and this PR.

traffic_side_by_side.mp4

In this PR new init param is added called max_linger, which is by default set to 1 to ensure unchanged default behavior. When max_linger is set to a number greater than 1 then detection must cross on all frames in order to be counted. This results in slight delay (i.e. when max_linger is set to 10 on 10fps video then objects will be counted with 1s delay) however more accurate counts.

Type of change

  • New feature (non-breaking change which adds functionality)

How has this change been tested, please provide a testcase or example of how you tested the change?

Added unit tests

Any specific deployment considerations

N/A

Docs

I updated LineZone init docstring.

@LinasKo
Copy link
Contributor

LinasKo commented Sep 23, 2024

Hi @grzegorz-roboflow,

I'd witnessed this but hadn't verified it. Very nice contribution yet again! I'll take some time to cehck it, especially regarding how the model IDs / edge cases.

@LinasKo
Copy link
Contributor

LinasKo commented Nov 5, 2024

Hey @grzegorz-roboflow, I made some heavy edits and think it's good to go.

You wouldn't happen to have the traffic video you used to test it, would you?

Edit: Found it.

@LinasKo
Copy link
Contributor

LinasKo commented Nov 6, 2024

Tested in a Colab: https://colab.research.google.com/drive/1rVuuJGPH-la2ExDmEUkKxwBnxRZMvgTK?usp=sharing

It works very similarly to how it was presented in Grzegorz's video.

image

Final results at different thresholds:

  • threshold=1: in=12, out=65
  • threshold=2: in=5, out=59
  • threshold=3: in=5, out=56

Copy link
Contributor

@LinasKo LinasKo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much @grzegorz-roboflow! At long last, we're adding it to the repo :)

Expect to see it in the new supervision version this weekend!

@LinasKo LinasKo merged commit fe2781c into develop Nov 6, 2024
@LinasKo LinasKo deleted the feature/remove-false-line-counts branch November 6, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants