Skip to content
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] - allow per class counting #791

Open
SkalskiP opened this issue Jan 26, 2024 · 2 comments · May be fixed by #817
Open

[PolygonZone] - allow per class counting #791

SkalskiP opened this issue Jan 26, 2024 · 2 comments · May be fixed by #817
Assignees
Labels
api:polygonzone PolygonZone API enhancement New feature or request Q2.2024 Tasks planned for execution in Q2 2024.

Comments

@SkalskiP
Copy link
Collaborator

SkalskiP commented Jan 26, 2024

Description

Currently, sv.PolygonZone provides only current aggregated counts - all classes are thrown into one bucket. In the past, many users have asked us to provide more granular - per class count. This can be achieved by adding class_in_count and class_out_count dictionaries that will store per-class counts.

class PolygonZone:

    def __init__(
        self,
        polygon: np.ndarray,
        frame_resolution_wh: Tuple[int, int],
        triggering_position: Position = Position.BOTTOM_CENTER,
    ):
        # Existing initialization code...

        self.class_in_count: Dict[int, int] = {}
        self.class_out_count: Dict[int, int] = {}

    def trigger(self, detections: Detections) -> np.ndarray:
        crossed_in = np.full(len(detections), False)
        crossed_out = np.full(len(detections), False)

        # Required logic changes...

Additional

  • Note: Please share a Google Colab with minimal code to test the new feature. We know it's additional work, but it will definitely speed up the review process. Each change must be tested by the reviewer. Setting up a local environment to do this is time-consuming. Please ensure that Google Colab can be accessed without any issues (make it public). Thank you! 🙏🏻
@SkalskiP SkalskiP added enhancement New feature or request Q1.2024 Tasks planned for execution in Q1 2024. api:polygonzone PolygonZone API labels Jan 26, 2024
@karanjakhar
Copy link
Contributor

Hi @SkalskiP I would like to work on it.

@SkalskiP
Copy link
Collaborator Author

Hi @karanjakhar 👋🏻 ! Sure, I assigned the issue to you. Have fun! 🔥

@karanjakhar karanjakhar linked a pull request Jan 31, 2024 that will close this issue
1 task
@SkalskiP SkalskiP added Q2.2024 Tasks planned for execution in Q2 2024. and removed Q1.2024 Tasks planned for execution in Q1 2024. labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:polygonzone PolygonZone API enhancement New feature or request Q2.2024 Tasks planned for execution in Q2 2024.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants