563 Commits

Author SHA1 Message Date
Siddharth Ancha
190063fbb4
[Fix] Fix reduce_zero_label in evaluation (#2504)
## Motivation

Through this PR, I (1) fix a bug, and (2) perform some associated cleanup, and (3) add a unit test. The bug occurs during evaluation when two options -- `reduce_zero_label=True`, and custom classes are used. The bug was that the `reduce_zero_label` is not properly propagated (see details below).

## Modification

1. **Bugfix**

The bug occurs [in the initialization of `CustomDataset`](5d49918b3c/mmseg/datasets/custom.py (L108-L110)) where the `reduce_zero_label` flag is not propagated to its member `self.gt_seg_map_loader_cfg`:

```python
self.gt_seg_map_loader = LoadAnnotations(
) if gt_seg_map_loader_cfg is None else LoadAnnotations(
    **gt_seg_map_loader_cfg)
```

Because the `reduce_zero_label` flag was not being propagated, the zero label reduction was being [unnecessarily and explicitly duplicated during the evaluation](5d49918b3c/mmseg/core/evaluation/metrics.py (L66-L69)).

As pointed in a previous PR (#2500), `reduce_zero_label` must occur before applying the `label_map`. Due to this bug, the order gets reversed when both features are used simultaneously.

This has been fixed to:

```python
self.gt_seg_map_loader = LoadAnnotations(
    reduce_zero_label=reduce_zero_label, **gt_seg_map_loader_cfg)
```

2. **Cleanup**

Due to the bug fix, since both `reduce_zero_label` and `label_map` are being applied in `get_gt_seg_map_by_idx()` (i.e. `LoadAnnotations.__call__()`), the evaluation does not need perform them anymore. However, for backwards compatibility, the evaluation keeps previous input arguments.

This was pointed out for `label_map` in a previous issue (#1415) that the `label_map` should  not be applied in the evaluation. This was handled by [passing an empty dict](5d49918b3c/mmseg/datasets/custom.py (L306-L311)):

```python
# as the labels has been converted when dataset initialized
# in `get_palette_for_custom_classes ` this `label_map`
# should be `dict()`, see
# https://github.com/open-mmlab/mmsegmentation/issues/1415
# for more ditails
label_map=dict(),
reduce_zero_label=self.reduce_zero_label))
```

Similar to this, I now also set `reduce_label=False` since it is now also being handled by `get_gt_seg_map_by_idx()` (i.e. `LoadAnnotations.__call__()`).

3. **Unit test**

I've added a unit test that tests the `CustomDataset.pre_eval()` function when `reduce_zero_label=True` and custom classes are used. The test fails on the original `master` branch but passes with this fix.

## 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 test that passes when the fix is introduced, and fails on the original master branch._
- [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:01:20 +08:00
谢昕辰
ac5d650526
[CI] Upgrade the version of isort to fix lint error in master branch (#2520)
## Motivation

https://github.com/open-mmlab/mmeval/pull/85

---------

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
2023-01-29 20:21:56 +08:00
Siddharth Ancha
64ad5871ae
[Fix] Fix ignore class id from -1 to 255 in master (#2515)
## Motivation

This fixes #2493. When the `label_map` is created, the index for ignored
classes was being set to -1, whereas the index that is actually ignored
is 255. This worked indirectly since -1 was underflowed to 255 when
converting to uint8.

The same fix was made in the 1.x by #2332 but this fix was never made to
`master`.

## Modification

The only small modification is setting the index of ignored classes to
255 instead of -1.

## 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.
- _No unit tests need to be added. Unit tests that are affected were
modified.
- [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-28 22:53:29 +08:00
Siddharth Ancha
5d49918b3c
[Fix] Switch order of reduce_zero_label and applying label_map (#2500)
## 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 4
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-19 15:01:40 +08:00
Shanghua Gao
6cb7fe0c51
Imagenet-s dataset for large-scale semantic segmentation (#2480)
## Motivation

Based on the ImageNet dataset, we propose the ImageNet-S dataset has 1.2 million training images and 50k high-quality semantic segmentation annotations to support unsupervised/semi-supervised semantic segmentation on the ImageNet dataset.

paper:
Large-scale Unsupervised Semantic Segmentation (TPAMI 2022)
[Paper link](https://arxiv.org/abs/2106.03149)

## Modification

1. Support imagenet-s dataset and its' configuration
2. Add the dataset preparation in the documentation
2023-01-16 16:42:19 +08:00
MengzhangLI
ba7608cefe
[Fix] Fix no revert_sync_batchnorm in image_demo of master branch (#2489)
Fix: https://github.com/open-mmlab/mmsegmentation/issues/2478
2023-01-16 15:40:29 +08:00
谢昕辰
ed83982876
bump v0.30.0 (#2462) v0.30.0 2023-01-11 17:39:09 +08:00
whooray
35cd28bb5f Support for occludedface for external use (#2463)
## Motivation

Please describe the motivation of this PR and the goal you want to
achieve through this PR.
support get_classes, get_palette for Occluded Face dataset. 

## Modification

Please briefly describe what modification is made in this PR.
add occludedface_classes()
add occludedface_palette()
modified dataset_aliases
2023-01-11 13:59:27 +08:00
Miao Zheng
a6ea630e62 [Fix]Fix circile ci env (#2467)
## Motivation

1. circle ci failed without zlib1g-dev installation
3. add approve button

## Modification

1. .circleci/
2023-01-11 13:59:27 +08:00
谢昕辰
b312e796d6 [Projects] Add 'Projects/' folder, and the first example project in 0.x (#2457)
## Motivation

Introducing new models and features into OpenMMLab's algorithm libraries
has long been complained to be troublesome due to the rigorous
requirements on code quality, which could hinder the fast iteration of
SOTA models and might discourage potential contributors from sharing
their latest outcome here.

Ref: https://github.com/open-mmlab/mmsegmentation/pull/2412

## Modification

This PR adds a new `projects/` folder, which will be a place for some
experimental models/features. Implementations inside might be not quite
perfect but already fine to produce some exciting results. We hope that
this PR can help us better embrace the contribution from our community.
We also add the first example project to illustrate what we expect a
good project to have.
2023-01-11 13:59:27 +08:00
Vinson
bedec406e1 Fix the docstring error in the class PascalContextDataset59 (#2450)
## Motivation

The docstring in the class PascalContextDataset59 is misleading. Try to fix it.

## Modification

The docstring in the class PascalContextDataset59 is changed.
2023-01-11 13:59:27 +08:00
whooray
c143f96c1d Add high quality synthetic face occlusion dataset link to readme. (#2453)
## Motivation

Add link for high quality synthetic face occlusion dataset.

## Modification

readme.md
2023-01-11 13:59:27 +08:00
Miao Zheng
632fb9b651 [Fix]Fix the deprecation of np.float and fix ci configuration (#2451)
## Motivation

1. numpy from 1.24 deprecated the aliases np.object, np.bool, np.float,
np.complex, np.str, and np.int
https://numpy.org/devdocs/release/1.24.0-notes.html

2. timm needs to pytorch>=1.7, so ignore test timm in pytorch 1.5 and
1.6

3. Remove install pillow as it doesn't test torchvision < 0.5

## Modification

1. np.float->np.float32
 
2. torch >= '1.7.0' -> matrix.torch != '1.5.1+cu101' && matrix.torch !=
'1.6.0+cu101' (as '1.10' < '1.7'

3. Remove install pillow
2023-01-11 13:59:27 +08:00
MilkClouds
c0515a1be5 Fixed deadlock issue related with MMSegWandbHook (#2398)
Co-authored-by: WangYudong <yudong.wang@akane.waseda.jp>
2023-01-11 13:59:27 +08:00
MengzhangLI
320d8c60f3 [Fix] Fix KNet IterativeDecodeHead bug in v0.x branch #2333
* add comment
2023-01-11 13:59:27 +08:00
smttsp
2aeb010e7a [FIX] fixing bug in test_cfg for U-Net _base_ script
tuples were required as default input, but int was given
2023-01-11 13:59:27 +08:00
xiexinch
bc9b3388f2 [CI] Add torch1.13 checking in CI (#2331)
add torch1.13 in ci

remove coverage and fix cuda version
2023-01-11 13:59:27 +08:00
jinwonkim93
2e840ac696 gitlab.com/pycqa/flake8 no longer exists (#2309) 2023-01-11 13:59:27 +08:00
jinwonkim93
a1d8174017 [Feature] Support Delving into High-Quality Synthetic Face Occlusion Segmentation Datasets (#2194)
add custom dataset

add face occlusion dataset

add config file for occlusion face

fix format

update prepare.md

formatting

formatting

fix typo error for doc

update downloading process

Update dataset_prepare.md

PR fix version to original repository. change to original repository.
2023-01-11 13:58:44 +08:00
Miao Zheng
7b09967fcc
Merge pull request #2257 from xiexinch/bumpv0.29.1
bumpv0.29.1
v0.29.1
2022-11-03 16:19:52 +08:00
xiexinch
47c7ed5dec bumpv0.29.1 2022-11-03 14:37:38 +08:00
Jinhee Lee
eb5ea47d9c
Update customize_datasets.md (#2249) 2022-11-01 19:14:36 +08:00
MengzhangLI
b42c487767
[Doc] Update FAQ doc about binary segmentation and ReduceZeroLabel (#2206)
* [Doc] Update FAQ doc about binary segmentation and ReduceZeroLabel

* update

* modify

* fix typo and add modification

* fix typo

* fix comments

* fix order

* fix

* fix

* Update docs/en/faq.md

* Update docs/zh_cn/faq.md

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2022-10-28 21:44:37 +08:00
谢昕辰
6db09358f0
modify results (#2114) 2022-10-27 13:08:34 +08:00
zhijiejia
8dbbdd8c17
[Feature] Add model ensemble tools (#2218)
* [Feature] Add model ensemble tool

* [Enhance] Add en and zh_cn instructions for model_ensemble

* [Enhance] Add default-value for --out and modify instruction

* [Enhance] Add arg-type for --out

* [Enhance] Delete redundant code
2022-10-24 19:03:48 +08:00
Xu Lin
76a5138ac8
add MMYOLO desc in README (#2219) 2022-10-21 19:57:39 +08:00
MengzhangLI
a68e7c2823
[Fix] Fix PoolFormer mIoU result (#2190) 2022-10-18 22:58:21 +08:00
谢昕辰
04afdb3f27
use syncbn (#2207) 2022-10-18 20:13:53 +08:00
谢昕辰
356215bf58
Bump v0.29.0 (#2167)
* bump v0.29.0

* remove 2159
v0.29.0
2022-10-10 14:06:25 +08:00
Miao Zheng
5811b3f74d
[Fix] Ignore timm test in ircleCI (#2162) 2022-10-09 16:13:08 +08:00
Miao Zheng
abb0932966
Fix lint (#2159) 2022-10-08 17:36:56 +08:00
mangelroman
963b8edc32
Add missing dependencies to torchserve docker file (#2133) 2022-10-08 16:33:03 +08:00
Edward
2eb13c6906
Improve structure and readability for FCNHead (#2142) 2022-10-08 16:31:17 +08:00
Miao Zheng
0391dcd105
Upgrade pre commit hooks master (#2155)
* Upgrade pre commit hooks

* Upgrade pre commit hooks

* mim install mmcv-full

* install mim

* install mmcv-full

* test mmcv-full 1.6.0

* fix timm

* fix timm

* fix timm
2022-10-08 16:29:12 +08:00
Shirley Wang
9d2312b4ac
added if statement to account for IterableDatasets doing distributed training (#2151) 2022-10-08 12:14:01 +08:00
MengzhangLI
6c746fad9c
[Feature] Add PoolFormer (CVPR'2022) (#1537)
* [Feature] Add PoolFormer (CVPR'2022)

* Upload README.md, models and log.json

* fix wrong base config name in config file

* refactor alignresize

* delete align_resize.py

* change config name

* use ResizetoMultiple to replace AlignResize

* update readme

* fix config bug

* resolve conflict
2022-10-01 12:54:00 +08:00
Sungchul Kim
ee25adc2c1
fix (#2075) 2022-09-15 15:16:46 +08:00
AmirMasoud Nourollah
31395a83bd
[Enhancement] .dev Python files updated to get better performance and syntax (#2020)
* logger hooks samples updated

* [Docs] Details for WandBLoggerHook Added

* [Docs] lint test pass

* [Enhancement] .dev Python files updated to get better performance and quality

* [Docs] Details for WandBLoggerHook Added

* [Docs] lint test pass

* [Enhancement] .dev Python files updated to get better performance and quality

* [Enhancement] lint test passed

* [Enhancement] Change Some Line from Previous to Support Python<3.9

* Update .dev/gather_models.py

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2022-09-14 16:05:40 +08:00
whooray
ecd1ecb6ba
[Fix] Fix mmseg.api.inference inference_segmentor (#1849)
* [Fix] Fix mmseg.api.inference inference_segmentor

Motivation
Fix inference_segmentor not working with multiple images path or images. List[str/ndarray]

Modification
- process images if instance is list

* fix typo

* Update mmseg/apis/inference.py

Co-authored-by: Hakjin Lee <nijkah@gmail.com>

Co-authored-by: Hakjin Lee <nijkah@gmail.com>
2022-09-14 00:13:43 +08:00
Miao Zheng
ca7c098767
[Fix] Fix ddp ut (#2060) 2022-09-13 13:08:44 +08:00
谢昕辰
b51670b613
Bump v0.28.0 (#2047)
* bump v0.28.0

* update
v0.28.0
2022-09-08 16:54:12 +08:00
谢昕辰
c1c942e8fc
[Fix] Fix binary segmentation when num_classes==1 (#2016)
* fix binary

* add ut

* fix ut

* restore metric computation

* remove metric ut update

* set out_channels by num_classes

* replace num_classes in encoder_decoder

* update props setting and fix ut

* update ut

* minor change

* update warning
2022-09-08 14:43:21 +08:00
谢昕辰
d8ea8f7460
[Doc] Introduce 1.x in readme (#2025)
* introduce 1.x

* update
2022-09-05 18:55:03 +08:00
Wencheng Wu
74e13cfa61
[Fix] Fix decode head forward_train error. (#1997) 2022-08-30 20:43:10 +08:00
MengzhangLI
acff83909f
[Feature] Support Tversky Loss (#1986) 2022-08-30 20:17:50 +08:00
AmirMasoud Nourollah
c5259a0d83
logger hooks samples updated (#1982) 2022-08-29 19:46:15 +08:00
Timo Kaiser
319ab5f2f3
Fixed Bug as explained in Issue #1969 (#1992)
For explanations, have a look at

https://github.com/open-mmlab/mmsegmentation/issues/1969
2022-08-29 18:20:30 +08:00
MengzhangLI
7a0f45ebe0
[Fix] Fix Segformer readme typo (#1980) 2022-08-28 13:19:55 +08:00
MengzhangLI
dd42fa8d01
[Fix] Fix knet_s3_upernet_swin-l_8x2_640x640_adamw_80k_ade20k config (#1871)
* [Fix] Fix knet_s3_upernet_swin-l_8x2_640x640_adamw_80k_ade20k model

* delete data link
2022-08-11 09:34:25 +08:00
MengzhangLI
3e3ed9ad67
[Fix] Fix bisenetv2_fcn_ohem_4x4_1024x1024_160k_cityscapes.py (#1901) 2022-08-11 09:33:00 +08:00