Extend LineZone to filter out miscounts #1540
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 to1
to ensure unchanged default behavior. Whenmax_linger
is set to a number greater than1
then detection must cross on all frames in order to be counted. This results in slight delay (i.e. whenmax_linger
is set to10
on10fps
video then objects will be counted with1s
delay) however more accurate counts.Type of change
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.