remove clamp_keypoints
from transforms
#9236
Merged
+13
−20
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.
Context
This PR proposes an alternative to #9234. We disable the clamping for
KeyPoints
after the following transformationsvertical_flip_keypoints
,horizontal_flip_keypoints
,_affine_keypoints_with_expand
,pad_keypoints
,crop_keypoints
,perspective_keypoints
, andelastic_keypoints
. We are fixing this to avoid the issue observed in #9223, where clamping modifies the position ofKeyPoints
and create a misalignment with the actual locations in the transformed image. This PR will need to be supplemented with #9235 to implement a class similar toSanitizeBoundingBoxes
transform to remove non validKeyPoints
, e.g. outside of the image canvas.Implementation details
In the current proposition, we simply do not apply the
clamp_keypoints
by default after any transform. ForKeyPoints
, the clamping must therefore be explicitly set with theClampKeyPoints
transform.Illustration of the changes
Without explicit clamping
With explicit clamping (default before)
Testing
Please run the following unit tests