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

Prefer user instances when calling Labels.numpy() #996

Merged
merged 1 commit into from
Oct 19, 2022

Conversation

roomrys
Copy link
Collaborator

@roomrys roomrys commented Oct 18, 2022

Description

In #772, we added a feature where analysis files prefer user-instances over predicted. This PR extends this preference when calling Labels.numpy(). If no user instances are found in the frame, then the predicted instances are used. However, if there are user instances in the frame, then we return the user instances.

Types of changes

  • Bugfix
  • New feature
  • Refactor / Code style update (no logical changes)
  • Build / CI changes
  • Documentation Update
  • Other (explain)

Does this address any currently open issues?

[list open issues here]

Outside contributors checklist

  • Review the guidelines for contributing to this repository
  • Read and sign the CLA and add yourself to the authors list
  • Make sure you are making a pull request against the develop branch (not main). Also you should start your branch off develop
  • Add tests that prove your fix is effective or that your feature works
  • Add necessary documentation (if appropriate)

Thank you for contributing to SLEAP!

❤️

@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Merging #996 (2daeba9) into develop (455788d) will decrease coverage by 0.00%.
The diff coverage is 90.00%.

@@             Coverage Diff             @@
##           develop     #996      +/-   ##
===========================================
- Coverage    66.75%   66.75%   -0.01%     
===========================================
  Files          127      127              
  Lines        21469    21474       +5     
===========================================
+ Hits         14332    14334       +2     
- Misses        7137     7140       +3     
Impacted Files Coverage Δ
sleap/io/dataset.py 83.26% <90.00%> (-0.24%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@roomrys roomrys marked this pull request as ready for review October 18, 2022 16:47
@roomrys roomrys requested a review from talmo October 18, 2022 16:53
Copy link
Collaborator

@talmo talmo left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -2447,21 +2467,20 @@ def numpy(
tracks = np.full((n_frames, n_tracks, n_nodes, 2), np.nan, dtype="float32")
for lf in lfs:
i = lf.frame_idx - first_frame
lf_insts: Union[List[Instance], List[PredictedInstance]] = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

List[Union[Instance, PredictedInstance]] for mixed lists?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If a labeled frame has ANY user instances in the frame, then we ONLY use the user instances (the frame is already completely labeled). The lists are never mixed.

@roomrys roomrys merged commit 9df1816 into develop Oct 19, 2022
@roomrys roomrys deleted the liezl/labels_numpy_prefers_user_instances branch October 19, 2022 22:23
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