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

Add a ValidBboxesDataset class #201

Merged
merged 42 commits into from
Jun 13, 2024
Merged

Add a ValidBboxesDataset class #201

merged 42 commits into from
Jun 13, 2024

Conversation

sfmig
Copy link
Contributor

@sfmig sfmig commented Jun 3, 2024

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
We want to be able to load bounding boxes tracks (see #167).

What does this PR do??
This PR defines a ValidBboxesDataset class, that follows ValidPosesDataset.

A bounding boxes dataset is made up of 4 data arrays:

  • position: (required) holds the x, y coordinates of the bounding box centroid.
    • Typically it will be an array of shape (n_frames, n_individuals, n_spatial_coords), but we only enforce the last dimension (spatial) to have 2 coordinates.
  • shape: (required) holds the width and height of the bounding box.
    • The same validation from the position array is applied.
  • confidence: (optional) holds the confidence score for the bounding box. If None is passed, it is filled in with nans.
    • We check its n dimensions have the same number of coordinates as the first n dimensions of the position array.
  • individual_names: (optional) a list of bounding boxes IDs. If None is passed, we assign 1-based IDs that are unique per frame. The 1-based convention for the IDs follows MOT challenge.

We are assuming 2D bounding boxes only for now (through the validation of the position and the shape arrays).

Questions

  • In the tests, I am ensuring the error case is the one I expect to fall in by checking the error message. Should we do this in the rest of the tests too?
  • In the pose dataset, we enforce the position array to have a fixed number of dimensions, which I am not doing in the bboxes dataset. This is inconsistent atm, but my understanding from chats with @niksirbi, from this PR Accessor compute_ to only validate required position data variable #206 and from this related issue is that we would like to remove that restriction. Do correct me if I am wrong!

References

Issue #167.

This work is derived from splitting #186 into smaller PRs.

How has this PR been tested?

Tests pass locally and on CI.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

It will require an update once the bounding boxes functionality is complete.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • [ n/a ] The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

Copy link

codecov bot commented Jun 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.70%. Comparing base (e4eea35) to head (2f4cf20).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #201      +/-   ##
==========================================
+ Coverage   99.68%   99.70%   +0.01%     
==========================================
  Files          12       12              
  Lines         643      678      +35     
==========================================
+ Hits          641      676      +35     
  Misses          2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sfmig sfmig marked this pull request as ready for review June 4, 2024 14:09
Copy link
Member

@niksirbi niksirbi left a comment

Choose a reason for hiding this comment

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

I like this implementation @sfmig !
I left some nitpicky comments which should be easy to fix.
Regarding your questions, in the order they were posed:

@sfmig sfmig mentioned this pull request Jun 13, 2024
5 tasks
@sfmig sfmig force-pushed the smg/valid-bboxes-dataset branch from c7ad82e to f029e7b Compare June 13, 2024 10:56
@sfmig sfmig requested a review from niksirbi June 13, 2024 14:59
Copy link
Member

@niksirbi niksirbi left a comment

Choose a reason for hiding this comment

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

Thanks for implementing all the suggestion @sfmig, I only have very few remaining comments, and after that it's good to go.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@sfmig sfmig added this pull request to the merge queue Jun 13, 2024
Merged via the queue into main with commit bba9403 Jun 13, 2024
12 checks passed
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