-
Notifications
You must be signed in to change notification settings - Fork 2
Revert crop order changes in #330
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
+25
−21
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3125949
fix crop order
dtronmans e1d99fd
remove rf-detr cropping, fix for mask_conf under 0.5
dtronmans d310cc3
attempt to sematically match luxonis-train
klemen1999 f3cc6c5
Revert "attempt to sematically match luxonis-train"
dtronmans c5d3756
explicit conditions for mask_conf being 0 or 1
dtronmans f04a715
handle thresholds past 0 and 1
dtronmans File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve excluded logits below the threshold.
crop_maskreplaces pixels outside the bounding box with0. For anymask_conf < 0.5,probability_to_logit_threshold(mask_conf)is negative, so those zero-valued pixels pass themask_logits > logit_thresholdcheck. The output mask then marks the area outside the bounding box as foreground.Use
-np.inffor excluded logits in this path. Keep zero as the default fill value for already-thresholded binary masks.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
✅ Addressed in commit e1d99fd
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.
I see, this is a valid point and I have been testing with mask_conf=0.5 which is probably why I haven't run into this problem yet. However, feeding
-infthrough OpenCV bilinear interpolation can produceNaN, I addressed this instead in e1d99fd by filling with thelogit_threshold, which can never trigger positively since we use the exclusionary>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.
@dtronmans, correct. Usinglogit_thresholdavoids non-finite values during OpenCV interpolation. The strict>comparison excludes pixels with logits equal to the threshold.✏️ Learnings added
@dtronmansThanks for confirming the fix. I couldn't resolve this review thread on the repository platform, so it remains open. Please retry or resolve it manually.You are interacting with an AI system.
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.
The solution with
logit_thresholdalso affects resize. I pushed a different solution in d310cc3 which essentially matches your original one but adds one more crop at the very end. This should ensure that there is no leakage. But please test this out with luxonis-eval to see if metrics agree.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.
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.
@klemen1999 unfortunately the tests fail with this extra crop:
FAILED tests/test_rvc4_nnarchive_regression.py::test_rvc4_nnarchive_regression[instance_segmentation_multiclass_squares_ldf_native_empty_task] - AssertionError: MaskMeanAveragePrecision.AP mismatch: actual=0.813644, expected=0.715013, rel_error=13.79%, allowed=2.00%.Just to verify I went back to e1d99fd to test with and the tests pass. I see that your commit message is about semantically matching luxonis-train, but is this last additional crop in the repo itself? For reference here is the order of operations in luxonis-train for postprocessing masks