mmsegmentation/tests
Siddharth Ancha 74e8b89b17
[Fix] Switch order of `reduce_zero_label` and applying `label_map` in 1.x (#2517)
This is an almost exact duplicate of #2500 (that was made to the
`master` branch) now applied to the `1.x` branch.

---

## Motivation

I want to fix a bug through this PR. The bug occurs when two options --
`reduce_zero_label=True`, and custom classes are used.
`reduce_zero_label` remaps the GT seg labels by remapping the zero-class
to 255 which is ignored. Conceptually, this should occur *before* the
`label_map` is applied, which maps *already reduced labels*. However,
currently, the `label_map` is applied before the zero label is reduced.

## Modification

The modification is simple:
- I've just interchanged the order of the two operations by moving a few
lines from bottom to top.
- I've added a test that passes when the fix is introduced, and fails on
the original `master` branch.

## BC-breaking (Optional)

I do not anticipate this change braking any backward-compatibility.

## Checklist

- [x] Pre-commit or other linting tools are used to fix the potential
lint issues.
  - _I've fixed all linting/pre-commit errors._
- [x] The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
  - _I've added a unit test._ 
- [x] If the modification has potential influence on downstream
projects, this PR should be tested with downstream projects, like MMDet
or MMDet3D.
  - _I don't think this change affects MMDet or MMDet3D._
- [x] The documentation has been modified accordingly, like docstring or
example tutorials.
- _This change fixes an existing bug and doesn't require modifying any
documentation/docstring._
2023-01-30 12:17:15 +08:00
..
data CodeCamp #140 [New] [Feature] Add synapse dataset and data augmentation in dev-1.x. (#2432) 2023-01-06 16:14:54 +08:00
test_datasets [Fix] Switch order of `reduce_zero_label` and applying `label_map` in 1.x (#2517) 2023-01-30 12:17:15 +08:00
test_engine [Refactor] data flow (#1956) 2022-08-26 15:54:23 +08:00
test_evaluation/test_metrics [Doc] Add evaluation doc (#2077) 2022-10-13 14:55:04 +08:00
test_models [Refactor] Support TTA (#2184) 2022-12-30 22:52:07 +08:00
test_structures
test_utils [Feature] Add BioMedical data loading (#2176) 2022-10-18 16:30:08 +08:00
test_visualization [Enhancement]Add `out_file` in add_datasample to directly save image (#2090) 2022-09-20 15:23:13 +08:00
__init__.py
test_config.py [Feature] Support PoolFormer in MMSegmentation 2.0 (#2191) 2022-10-19 13:08:07 +08:00
test_digit_version.py
test_sampler.py