Skip to content

remove (un-)squashing logic from crop mask kernels #8005

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Sep 29, 2023

After we have put the (un-)squashing logic in, it seems we have refactored the image kernel in a way so we no longer need the extra mask handling.

2d masks are tests as segmentation masks in

@pytest.mark.parametrize("make_mask", [make_segmentation_mask, make_detection_mask])
def test_kernel_mask(self, make_mask):
check_kernel(F.crop_mask, make_mask(self.INPUT_SIZE), **self.MINIMAL_CROP_KWARGS)

and

@pytest.mark.parametrize("make_mask", [make_segmentation_mask, make_detection_mask])
def test_kernel_mask(self, make_mask):
check_kernel(F.center_crop_mask, make_mask(), output_size=self.OUTPUT_SIZES[0])

cc @vfdev-5

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 29, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8005

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 1 Unrelated Failure

As of commit 4a6f093 with merge base f96deba (image):

NEW FAILURE - The following job has failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Touching on what we discussed offline: in main, we convert masks to 3D and we have correctness tests for (3D) images. So indirectly, we have correctness tests for masks.

With this PR, as-is, we're loosing any correctness test we have on masks. Yes we still have the kernel checks, but these don't test correctness against a reference.

@NicolasHug
Copy link
Member

With this PR, as-is, we're loosing any correctness test we have on masks. Yes we still have the kernel checks, but these don't test correctness against a reference.

There is some minimal degree of correctness check, but it's very indirect: _check_kernel_batched_vs_unbatched, will ensure that the batched mask (3D, treated as an image, which are tested for correctness) are transformed the same as the unbatched ones (2D).

It only works for these 2 kernels because the C dim of images is treated as N dim of 2D masks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants