-
Notifications
You must be signed in to change notification settings - Fork 96
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
Fix top-down inference on Apple Silicon #1547
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe changes primarily revolve around the enhancement of the Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files selected for processing (1)
- sleap/nn/inference.py (6 hunks)
Additional comments (Suppressed): 6
sleap/nn/inference.py (6)
408-419: The new hunk introduces a check for the size of
ex["instance_peaks"]
before performing operations on it. This is a good practice as it prevents potential errors when the array is empty. However, ensure that this change does not affect the expected behavior of the function in cases whereex["instance_peaks"]
is expected to be non-empty.796-800: The new hunk introduces a new parameter
n_peaks
to the function call. Ensure that the function being called has been updated to accept this new parameter and that all calls to this function throughout the codebase have been updated to include this new argument.1909-1914: The new hunk adds
n_peaks
to theoutputs
dictionary. This is a good practice as it makes the function's output more informative. However, ensure that this change does not affect the expected behavior of the function in cases wheren_peaks
is expected to be a certain value.2085-2096: The new hunk introduces checks for the presence of
centroids
,centroid_vals
, andcentroid_confmaps
ininputs
before adding them tooutputs
. This is a good practice as it prevents potential errors when these keys are not present ininputs
. However, ensure that this change does not affect the expected behavior of the function in cases where these keys are expected to be present ininputs
.2153-2158: The new hunk modifies the way
outputs
is built. Instead of creating a new dictionary, it now addsinstance_peaks
andinstance_peak_vals
to the existingoutputs
dictionary. This is a good practice as it makes the function's output more informative. However, ensure that this change does not affect the expected behavior of the function in cases whereoutputs
is expected to be a certain structure.2261-2298: The new hunk introduces a check for
n_peaks
being 0 and handles this case separately. This is a good practice as it prevents potential errors whenn_peaks
is 0. However, ensure that this change does not affect the expected behavior of the function in cases wheren_peaks
is expected to be non-zero.
Description
This PR changes the logic for how we handle empty outputs from the centroid model in top-down inference models.
We now check for this condition and explicitly create empty tensors (this was done automatically in older versions of TF on other platforms).
Types of changes
Does this address any currently open issues?
#1100
Outside contributors checklist
Thank you for contributing to SLEAP!
❤️
Summary by CodeRabbit
Release Notes
process_batch
function to adjustinstance_peaks
based onoffset_x
andoffset_y
values, improving the accuracy of instance peak detection.call
methods in several classes to includen_peaks
,instance_peaks
, andinstance_peak_vals
in theoutputs
dictionary, providing more detailed output information.n_peaks
is 0 orinstance_peaks
is an instance ofFindInstancePeaksGroundTruth
, increasing the robustness of the code.