Skip to content

Fix RandomRotFlip interpolation for segmentation maps#3879

Open
ziyangwang007 wants to merge 1 commit into
open-mmlab:dev-1.xfrom
ziyangwang007:main
Open

Fix RandomRotFlip interpolation for segmentation maps#3879
ziyangwang007 wants to merge 1 commit into
open-mmlab:dev-1.xfrom
ziyangwang007:main

Conversation

@ziyangwang007

Copy link
Copy Markdown

Motivation

RandomRotFlip.random_rotate currently rotates segmentation fields with
mmcv.imrotate without specifying the interpolation mode. Since
mmcv.imrotate defaults to bilinear interpolation, rotating semantic
segmentation masks may introduce unexpected label values around class
boundaries.

Fixes #3399.

Modification

  • Use interpolation='nearest' when rotating entries in seg_fields in
    RandomRotFlip.random_rotate.

BC-breaking (Optional)

No backward-incompatible change is expected. The change only makes
RandomRotFlip preserve discrete segmentation labels during rotation.

Use cases (Optional)

This affects training pipelines that use RandomRotFlip for semantic
segmentation masks. It prevents augmented masks from containing invalid class
ids produced by bilinear interpolation.

Checklist

  1. The change is small and limited to RandomRotFlip.random_rotate.
  2. Local pre-commit was not completed because the local pre-commit environment
    failed on the deprecated python_venv hook.
  3. Local unit tests were not run because the local environment is missing
    mmcv.
  4. No documentation change is required because this is a bug fix.

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.

1 participant