Skip to content

Allow config files with undefined class labels #13

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

Merged
merged 1 commit into from
Mar 18, 2025
Merged

Conversation

glopesdev
Copy link
Contributor

To support loading centered instance model data or any other model without class labels, we need to relax our assumption that config files must contain a defined class_vectors element.

Here we assume that this case returns an empty list of class labels. This is consistent with other similarly accepted failure modes, such as not replacing identity indices without a corresponding class label in the config file. In this case the class_int2str method would already fail to replace the numerical indices with string labels since no corresponding index would be found in the dictionary.

We slightly optimize the case where the list of class labels is empty and avoid touching the data since it likely comes from a model without pose identities.

@glopesdev glopesdev added the feature New planned feature label Feb 25, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.25%. Comparing base (30f21ed) to head (09a2dbe).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
- Coverage   50.25%   50.25%   -0.01%     
==========================================
  Files          10       10              
  Lines         595      597       +2     
==========================================
+ Hits          299      300       +1     
- Misses        296      297       +1     

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

@anayapouget
Copy link
Contributor

Thanks for this, @glopesdev! It works well with my pose-only data, which is great. However, I was wondering what the expected behavior should be when both pose and ID .bin files are present in the same directory.

Currently, all SLEAP data is saved under the 202 register. For example, I have:

  • CameraTop_202_5899253_2024-08-29T18-00-00.bin (ID data)
  • CameraTop_202_5899254_2024-08-29T18-00-00.bin (pose data)

When both files are in the same directory, only the ID data from CameraTop_202_5899253_2024-08-29T18-00-00.bin is being loaded. Would it make more sense to load both files and return a single DataFrame with their concatenated data?

@glopesdev
Copy link
Contributor Author

When both files are in the same directory, only the ID data from CameraTop_202_5899253_2024-08-29T18-00-00.bin is being loaded. Would it make more sense to load both files and return a single DataFrame with their concatenated data?

@anayapouget I'm not sure how you would concatenate the data from both these files, as only one of them has pose identity labels, am I right? My understanding was that the pose-only model indices do not map into the pose identity indices from the pose-identity model (as the model is not doing identity inference at all).

Also, the structure of the model itself is very different, as the columns contained in one case are very different from the other, right? Loading some kind of combined model would require some kind of custom combination logic to account for this. This is definitely possible, but likely to fall more neatly inside a new bespoke reader, rather than in the general reader?

@glopesdev
Copy link
Contributor Author

Notes following meeting are to investigate why the files having the same register is blocking the reader from trying to load both files, however ID and pose-only model data should still probably be stored in separate registers.

@glopesdev
Copy link
Contributor Author

glopesdev commented Mar 18, 2025

When both files are in the same directory, only the ID data from CameraTop_202_5899253_2024-08-29T18-00-00.bin is being loaded. Would it make more sense to load both files and return a single DataFrame with their concatenated data?

@anayapouget I pinned down why this is happening, and it is a more general issue with the load function which I think we should discuss separately. I have raised a new issue for this (#15) and am merging this PR, as this problem is unrelated to the behavior changes implemented here.

@glopesdev glopesdev merged commit 743dd53 into main Mar 18, 2025
3 checks passed
@glopesdev glopesdev deleted the pose-reader branch March 18, 2025 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New planned feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants