-
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
Polygonzone add multiple anchors support #910
Polygonzone add multiple anchors support #910
Conversation
617a445
to
b5452f6
Compare
Hi @LeviVasconcelos 👋🏻 ! Awesome PR. I liked your ideas. I left some comments. I'd appreciate it if you consider my feedback. |
add multiple anchors support remove old trigger
add polygon_zone unit tests
pre-commit reformatting
pre-commit
b01950c
to
8b443d1
Compare
Thank you for your comments, @SkalskiP ! I've addressed all of them. Please let me know what you think |
01c0281
to
7adb368
Compare
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
7adb368
to
d0ad5fe
Compare
@LeviVasconcelos thank you for your contribution I am merging in. For examples I did not touch it. There is little bit more work I see in example let's do them outside. |
I fixed all changes as has been requested.
Thank you guys @SkalskiP @onuralpszr. It was a big pleasure to contribute! Congratulation for the awesome project you guys are building :) ! |
Thanks for your help @LeviVasconcelos 👋🏻 ! I really like your |
Description
This PR addresses Issue #844.
triggering_position
totriggering_anchors
to be consistent with theLineZone
naming convention.Position
toIterable[Position]
.Position.BOTTOM_CENTER
.PolygonZone
.Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
For a minimalist setup, I'm doing the following:
1- Create mock detections simulating an object moving in a straight line.
2- Instantiate a
PolygonZone
object with polygon partially intersecting the line.3- Compute the
PolygonZone.trigger(mock_detections)
and annotate the detections triggering thePolygonZone
object as green, and red otherwise.The setup used here was also used as base for the unit tests.
Google colab: https://colab.research.google.com/drive/1fcsVrprMuf7hm_bxitSqmeL5L7KBVGHh?usp=sharing
Deployment Concerns
API Backward Compatibility
Option 1: Maintaining Deprecation Logic Within the Function
To ensure backward compatibility after renaming a parameter in this PR, one approach is to maintain deprecation logic within the function itself. The implementation could look something like this:
While effective for specific cases, this approach has some drawbacks:
**kwargs
might make the documentation less clear.Option 2: Adding a
@deprecated_parameter
Annotator (Adopted Solution)The chosen solution involves creating a
@deprecated_parameter
annotator using pseudocode like this:While this solution may not be suitable for highly complex parameter changes, it aligns with existing practices, such as the use of the
@deprecated
annotator, making it easier to track deprecated code references.Please share your thoughts on this proposed solution.
Deprecated Examples
Some examples, like
examples/traffic_analysis
, explicitly settriggering_position
for thePolygonZone
class. This PR renders it deprecated.Should we address these changes within this PR, or would it be more appropriate to handle them in a separate one? I am open to incorporating the necessary modifications here if that is the preferred approach.
Let me know your preferences regarding these considerations.
Docs
Changed the documentation for class
PolygonZone
.Fix : #844