276 Commits

Author SHA1 Message Date
Zhongyu Li
486a40995e
add baseline methods for imagenets (#2573)
as title
2023-02-15 21:12:43 +08:00
Jonas Sitzmann
5b438f45b6
change typo in CrossEntropyLoss (#2534)
The documentation of the use_sigmoid argument in CrossEntropyLoss
currently suggests the sigmoid would be applied in addition to the
softmax function. This change fixes this typo.
2023-01-30 21:56:17 +08:00
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
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
谢昕辰
ed83982876
bump v0.30.0 (#2462) 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
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
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
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
2022-11-03 16:19:52 +08:00
xiexinch
47c7ed5dec bumpv0.29.1 2022-11-03 14:37:38 +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
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
谢昕辰
356215bf58
Bump v0.29.0 (#2167)
* bump v0.29.0

* remove 2159
2022-10-10 14:06:25 +08:00
Miao Zheng
abb0932966
Fix lint (#2159) 2022-10-08 17:36:56 +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
Sungchul Kim
ee25adc2c1
fix (#2075) 2022-09-15 15:16:46 +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
谢昕辰
b51670b613
Bump v0.28.0 (#2047)
* bump v0.28.0

* update
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
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
谢昕辰
eeeaff9421
Bump v0.27.0 (#1836)
* Bump v0.26.1

* update version

* fix mmcv requirement
2022-07-28 21:04:01 +08:00
谢昕辰
0e37281884
[Enhancement] Modify MMCV version requirement (#1764)
* modify mmcv version requirement

* minor change

* change max mmcv version
2022-07-13 19:40:32 +08:00
谢昕辰
e3b5b5ee38
remove show=False parameter in test_fn (#1741) 2022-07-07 09:21:27 +08:00
MengzhangLI
17056b636f
Bump v0.26.0 (#1731) 2022-07-01 20:31:52 +08:00
Ayush Thakur
dca46fec9a
[Feature] Dedicated MMSegWandbHook for MMSegmentation (Weights and Biases Integration) (#1603)
* wandb integration

* wandb integration

* Update mmseg/core/hook/wandblogger_hook.py

Co-authored-by: 谢昕辰 <xiexinch@outlook.com>

* trying to fix circular import issue

* Update mmseg/core/hook/wandblogger_hook.py docstring

Try to activate the CI.

* move import op in func

* add comments to test_fn

Co-authored-by: xiexinch <test767803@foxmail.com>
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
2022-07-01 18:29:13 +08:00
MengzhangLI
fe455c2771
[Fix] Fix typo in comments in mFscore (#1708) 2022-06-27 13:04:41 +08:00
Qing
e8dfa3f26b
fix OpenCV num_threads log (#1704) 2022-06-24 11:58:27 +08:00
MengzhangLI
a8a8fec178
[Fix] Fix liscense of SegFormer (#1699)
* [Fix] Fix liscense of SegFormer

* add liscense

* add liscense
2022-06-23 18:57:12 +08:00
FreyWang
6f43f4d5d3
[Enchance] support infererence with padding (#1607)
* [Enchance] support infererence with padding

* limite pad after flip when inference

* add test code
2022-06-15 11:28:09 +08:00
rotorliu
f3c72c6dbb
Fixed a few spelling errors (#1656)
* 修复拼写错误

* Fix lint error

* Fix lint error

* Fix lint error
2022-06-14 12:10:59 +08:00
Xiaolin Wang
df434bed69
fix typo (#1667) 2022-06-14 11:20:31 +08:00
MengzhangLI
43b4efb122
[Fix] Fix image_demo.py error (#1640)
* [Fix] Fix image_demo.py error

* [Fix] Fix image_demo.py error

* fix

* delete plt.cla()
2022-06-09 17:20:28 +08:00
RunningLeon
60655de194
change for easy deployment of segmenter (#1642) 2022-06-07 18:00:13 +08:00
Miao Zheng
46326f63ce
Bump v0.25.0 (#1636)
* Bump v0.25.0

* format

* fix mmcv version

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>
2022-06-02 22:40:08 +08:00
Wencheng Wu
63fa98515b
[Fix] Fix the error of BCE loss when batch size is 1. (#1629) 2022-05-31 18:07:29 +08:00
Aston.He
7628a61f92
feat(mlu): Support PyTorch backend on MLU. (#1515)
* feat(mlu): Support PyTorch backend on MLU.

* fix redundant device variable.

* Update mmseg/apis/train.py

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>

* Update comments.

* Update mmseg/apis/train.py

* Update is_mlu_available flag.

* align util_distribution.py to mmdet.

* align util_distribution.py to mmdet.

* add build_dp, build_ddp testcase.

* Update mmseg/utils/util_distribution.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update mmseg/utils/util_distribution.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update mmseg/utils/util_distribution.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update tests/test_utils/test_util_distribution.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update tests/test_utils/test_util_distribution.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update tests/test_utils/test_util_distribution.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update tests/test_utils/test_util_distribution.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* add mmcv version check for mlu device.

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
2022-05-25 18:11:42 +08:00
FreyWang
4f394b0674
[Fix] bug of resize warning when align_corners is True (#1592)
Signed-off-by: FreyWang <wangwxyz@qq.com>
2022-05-18 16:39:52 +08:00
MengzhangLI
ae0fac4a36
Bump version to v0.24.1 (#1541)
* Bump version to v0.24.1

* version.py

* changelog.md
2022-05-01 14:06:04 +08:00
Miao Zheng
9dae7e1d49
[Enhancement]Revise docstring and UT for layer decay LR (#1540)
* fix docstring

* fix ut for optimizer cosntructor
2022-05-01 13:13:53 +08:00
FangjianLin
8be5987fdd
[Fix] Add MAE LayerDecayOptimizerConstructor (#1539) 2022-05-01 12:42:49 +08:00
Miao Zheng
c4c0c1f804
Bump version to v0.24.0 (#1533)
* [WIP] Bump version to v0.24.0

* changelog

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* Update docs/en/changelog.md

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>

* words

* typo

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>
2022-04-29 22:23:02 +08:00
wangbin
061b5b4383
[Fix] Fix the bug in binary_cross_entropy (#1527)
* [Fix] Fix the bug in binary_cross_entropy

 Fix the bug in binary_cross_entropy
'label.max() <= 1' should mask out ignore_index, since the ignore_index often set as 255.

* [Fix] Fix the bug in binary_cross_entropy, add comments

As the ignore_index often set as 255, so the binary class label check should mask out ignore_index.

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>

* [Fix] Fix the bug in binary_cross_entropy

As the ignore_index often set as 255, so the binary class label check should mask out ignore_index.

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
Co-authored-by: MeowZheng <meowzheng@outlook.com>
2022-04-29 19:32:12 +08:00
Yuan Liu
6563cb513e
[Feature]: Add MAE (#1307)
* [Fix]: Fix lint

* [WIP]: Add mae seg config

* [Feature]: Add MAE seg

* [Fix]: Fix mae dataset img scale bug

* [Fix]: Fix lint

* [Feature]: Change mae config to mae_segmentation's config

* [Feature]: Add interpolate pe when loading

* [Fix]: Fix pos_embed not used bug

* [Fix]: Fix lint

* [Fix]: Init rel pos embed with zeros

* [Fix]: Fix lint

* [Fix]: Change the type name of backbone to MAE

* [Fix]: Delete ade20k_512x512.py

* [Fix]: Use mmseg provided ade20k.py

* [Fix]: Change 1 sample per gpu to 2 samples per gpu

* [Fix]: Fix conflict

* [Refactor]: Use the TransformerEncoderLayer of  BEiT

* [Feature]: Add UT

* [Fix]: Change the default value of qv bias to False

* [Fix]: Initialize relative pos table with zeros

* [Fix]: Delete redundant code in mae

* [Fix]: Fix lint

* [Fix]: Rename qkv_bias to qv_bias

* [Fix]: Add docstring to weight_init of MAEAttention

* [Refactor]: Delete qv_bias param

* [Fix]: Add reference to fix_init_weight

* [Fix]: Fix lint

* [Fix]: Delete extra crop size

* [Refactor]: Rename mae

* [Fix]: Set bias to True

* [Fix]: Delete redundant params

* [Fix]: Fix lint

* [Fix]: Fix UT

* [Fix]: Add resize abs pos embed

* [Fix]: Fix UT

* [Refactor]: Use build layer

* [Fix]: Add licsense and fix docstring

* [Fix]: Fix docstring

* [Feature]: Add README metafile

* [Fix]: Change 640 to 512

* [Fix]: Fix README

* fix readme of MAE

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>
2022-04-28 00:54:20 +08:00