neuroinformatics-unit / movement

Python tools for analysing body movements across space and time
http://movement.neuroinformatics.dev
BSD 3-Clause "New" or "Revised" License
77 stars 7 forks source link

Small edits to ValidBboxesDataset (1/4) #230

Open sfmig opened 1 week ago

sfmig commented 1 week ago

Description

What is this PR

Why is this PR needed? Two small edits are needed in ValidBboxesDataset to continue with the bboxes work:

  1. Adding frame_array to ValidBboxesDataset. Usually running inference on a video using a detection model will output a file (often a csv) that links each detection (aka bounding box) to a frame in the video. As a result, specific frame numbers appear in the output file (see here for a few examples). We would like to be able to pass these specific frame numbers to the bounding boxes dataset if they are defined.

  2. Setting default track IDs to 1-based integers. This follows from the discussion at #217.

What does this PR do?

  1. Adds frame_array as an optional attribute to the ValidBboxesDataset.

    • If no frame numbers are provided, we assign numbers based on the first dimension of the position array, and starting from 0.
    • If frame numbers are provided, we only check that the frame_numbers value is a column vector (a numpy array of size (n,1) with n being the number of frames).
  2. Sets the default IDs for the individual_names to start with 0 ('id_0', 'id_1',...).

This PR also includes:

Question: We do not check that the frames are monotonically increasing (i.e. sorted) or that there are no gaps - should we? I think we shouldn't, but let me know thoughts.

References

\

How has this PR been tested?

Tests pass locally and in CI.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

No.

Checklist:

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.71%. Comparing base (2e406e1) to head (299b626).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #230 +/- ## ======================================= Coverage 99.70% 99.71% ======================================= Files 12 12 Lines 678 690 +12 ======================================= + Hits 676 688 +12 Misses 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 1 week ago

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud