177 Commits

Author SHA1 Message Date
ZiAn-Su
7254f5330f
[Fix] Fix SegTTAModel with no attribute '_gt_sem_seg' error (#3152)
## Motivation

When using the - tta command for multi-scale prediction, and the test
set is not annotated, although format_only has been set true in
test_evaluator, but SegTTAModel class still threw error 'AttributeError:
'SegDataSample' object has no attribute '_gt_sem_seg''.

## Modification

The reason is SegTTAModel didn't determine if there were annotations in
the dataset, so I added the code to make the judgment and let the
program run normally on my computer.
2023-07-13 17:06:06 +08:00
谢昕辰
b8b6ee6017
fix assert (#3119) 2023-06-19 18:34:52 +08:00
Leon Hamnett
b0635ff783
[Enhancement] Change assertion logic inference cfg.model.test_cfg (#3012)
## Motivation

In encode_decoder.py , assertion logic is not working correctly if user
modifes cfg.test_cfg and defines it in a dictionary format. See:
https://github.com/open-mmlab/mmsegmentation/issues/3011

## Modification

Slight change to assertion behaviour to change assertion depending on if
received test_cfg object is a dict or not.

## BC-breaking (Optional)

Unsure - I believe this will not break any downstream tasks as the
previous logic is still included

## Use cases (Optional)

n/a

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-06-19 18:12:04 +08:00
jinxianwei
bb93b482b8
[Feature] huasdorff distance loss (#2820)
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.

## Motivation

Add Huasdorff distance loss

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-06-19 14:26:08 +08:00
Xu CAO
279b89783e
[Feature] enhance swin pretrained model loading (#3097)
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.

## Motivation

Enhance pretrained SwinTransformer loading when setting non-standard
backbone `depths`.

## Modification

Enhance pretrained SwinTransformer loading when setting non-standard
backbone `depths`.

## BC-breaking (Optional)

Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.

## Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases
here, and update the documentation.

## Checklist

1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.

---------

Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>
2023-06-16 10:43:34 +08:00
nightrain01
13e42cc2ae
[Fix] Fix bug cannot use both '--tta' and '--out' while testing. (#3067)
## Motivation

Fix bug cannot use both '--tta' and '--out' while testing.
For details, please refer to #3064 .

## Modification

Add 'img_path' in TTA predictions.

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-06-06 16:39:41 +08:00
CSH
2f257ab160
[Refactor] Refactor dice loss (#3002) 2023-05-15 14:20:42 +08:00
ZhangYiqin
227ced4a90
[Doc] Fix a tiny mis-Arg in BaseDecodeHead class (#2970) 2023-05-05 11:27:58 +08:00
Pan Zhang
990063e59b
[Feature] Support DDRNet (#2855)
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.

## Motivation

Support DDRNet
Paper: [Deep Dual-resolution Networks for Real-time and Accurate
Semantic Segmentation of Road Scenes](https://arxiv.org/pdf/2101.06085)
official Code: https://github.com/ydhongHIT/DDRNet


There is already a PR
https://github.com/open-mmlab/mmsegmentation/pull/1722 , but it has been
inactive for a long time.

## Current Result

### Cityscapes

#### inference with converted official weights

| Method | Backbone      | mIoU(official) | mIoU(converted weight) |
| ------ | ------------- | -------------- | ---------------------- |
| DDRNet | DDRNet23-slim | 77.8           | 77.84                  |
| DDRNet | DDRNet23 | 79.5 | 79.53 |

#### training with converted pretrained backbone

| Method | Backbone | Crop Size | Lr schd | Inf time(fps) | Device |
mIoU | mIoU(ms+flip) | config | download |
| ------ | ------------- | --------- | ------- | ------- | -------- |
----- | ------------- | ------------ | ------------ |
| DDRNet | DDRNet23-slim | 1024x1024 | 120000 | 85.85 | RTX 8000 | 77.85
| 79.80 |
[config](https://github.com/whu-pzhang/mmsegmentation/blob/ddrnet/configs/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024.py)
| model \| log |
| DDRNet | DDRNet23 | 1024x1024 | 120000 | 33.41 | RTX 8000 | 79.53 |
80.98 |
[config](https://github.com/whu-pzhang/mmsegmentation/blob/ddrnet/configs/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024.py)
| model \| log |


The converted pretrained backbone weights download link:

1.
[ddrnet23s_in1k_mmseg.pth](https://drive.google.com/file/d/1Ni4F1PMGGjuld-1S9fzDTmneLfpMuPTG/view?usp=sharing)
2.
[ddrnet23_in1k_mmseg.pth](https://drive.google.com/file/d/11rsijC1xOWB6B0LgNQkAG-W6e1OdbCyJ/view?usp=sharing)

## To do

- [x] support inference with converted official weights
- [x] support training on cityscapes dataset

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-04-27 09:44:30 +08:00
Julius Zhang
60a542cc66
[Fix] fix squeeze error when N=1 and C=1 (#2933)
## Motivation

fix squeeze error when N=1 and C=1

## Modification

fix squeeze error when N=1 and C=1
2023-04-23 15:12:40 +08:00
CSH
04f7ec60d8
[Fix] Fix binary C=1 focal loss & dataset fileio (#2935) 2023-04-23 15:02:18 +08:00
李开宇
4371ba5db6
[Fix] Fix bugs when out_channels==1 (#2911) 2023-04-18 18:26:59 +08:00
Junhwa Song
ced29fcaf8
[Refactor] Handle case where device is neither CPU nor CUDA in HamHead (#2868) 2023-04-14 10:12:49 +08:00
MengzhangLI
ff8d971988
[Feature] Support SegNeXt in MMSegmentation 2.0 (#2654)
## Motivation

Support SegNeXt in MMSeg 1.x branch.

0.x PR: https://github.com/open-mmlab/mmsegmentation/pull/2600

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-03-16 16:49:15 +08:00
谢昕辰
dd47cef801
[Feature] Support PIDNet (#2609)
## Motivation

Support SOTA real-time semantic segmentation method in [Paper with
code](https://paperswithcode.com/task/real-time-semantic-segmentation)

Paper: https://arxiv.org/pdf/2206.02066.pdf
Official repo: https://github.com/XuJiacong/PIDNet

## Current results

**Cityscapes**

|Model|Ref mIoU|mIoU (ours)|
|---|---|---|
|PIDNet-S|78.8|78.74|
|PIDNet-M|79.9|80.22|
|PIDNet-L|80.9|80.89|

## TODO

- [x] Support inference with official weights
- [x] Support training on Cityscapes
- [x] Update docstring
- [x] Add unit test
2023-03-15 14:55:30 +08:00
谢昕辰
19f92851f5
[Fix] Add out_channels in CascadeEncoderDecoder and update OCRNet and MobileNet v2 results (#2656)
## Motivation

As title.

## Modification

1. update results in readme
2. fix attr error in cascade encoder decoder
2023-02-28 15:57:43 +08:00
Siddharth Ancha
698dee9525
Backward merge #2535 from 1.x into dev-1.x (#2546)
## Motivation

This is essentially #2535 that I had intended to submit to the `dev-1.x`
branch but accidentally submitted it directly to the `1.x` branch
(apologies!). This also got approved possibly because the core devs also
didn't realize this.

The problem is that now `1.x` and `dev-1.x` are out of sync -- the
changes introduced by #2535 will never be reflected in `dev-1.x`.

## Modification

I'm proposing this "backward-merge" so that `1.x` and `dev-1.x` can be
in sync again. If you look at "files changed", they are exactly the
changes introduced by #2535.

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-02-01 10:26:44 +08:00
Miao Zheng
d88f393ffa
[Fix] Remove dependcy mmdet when do not use MaskFormerHead and MMDET_Mask2FormerHead (#2448)
## Motivation

Calling `mmseg.utils.register_all_modules` will import `MaskFormerHead`
and `Mask2FormerHead`, it will crash if mmdet is not installed as `None`
cannot be initialized.

## Modification

- Modify `MMDET_MaskFormerHead=BaseModule` and `MMDET_Mask2FormerHead =
BaseModule` when cannot import from mmdet
2022-12-31 01:02:58 +08:00
谢昕辰
da4125587e [Refactor] Support TTA (#2184)
* tta init

* use mmcv transform

* test city

* add multiscale

* fix merge

* add softmax to post process

* add ut

* add tta pipeline to other datasets

* remove softmax

* add encoder_decoder_tta ut

* add encoder_decoder_tta ut

* rename

* rename file

* rename config

* rm aug_test

* move flip to post process

* fix channel
2022-12-30 22:52:07 +08:00
nulam
3bac6ef5a4
Fix typo in warning on binary classification (#2382) 2022-12-06 11:29:11 +08:00
谢昕辰
163277bfe0
[Feature] Support Mask2former in MMSeg 1.x (#2255)
* init commits

* fix crop size

* add seg_data2instance_data method

* add ut and update requirement

* update configs and readme

* add model-indel

* update optional requirements

* fix results

* fix lint error

* update results

* update results

* remove mmdet from requirements/optional.txt

* use try import and update README

* add docstring to overwrtied method

* minor change

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>
2022-12-05 18:34:24 +08:00
MengzhangLI
933e4d3cb6
[Feature] Support MaskFormer(NeurIPS'2021) in MMSeg 1.x (#2215)
* [Feature] Support MaskFormer(NeurIPS'2021) in MMSeg 1.x

* add mmdet try except logic

* refactor config files

* add readme

* fix config

* update models & logs

* add MMDET installation and fix info

* fix comments

* fix

* fix config norm optimizer setting

* update models & logs & unittest

* add docstring of MaskFormerHead

* wait for mmdet 3.0.0rc4

* replace seg_mask with seg_logits & add docstring for batch_input_shape

* use mmdet3.0.0rc4

* fix readme and modify config comments

* add mmdet installation in pr_stage_test.yml

* update mmcv version in pr_stage_test.yml

* add mmdet in build_cpu of pr_stage_test.yml

* modify mmdet& mmcv installation in merge_stage_test.yml

* fix typo

* update test.yml

* update test.yml
2022-12-01 19:03:10 +08:00
谢昕辰
925faea5bf
[Fix] Fix the problem of post-processing not removing padding (#2367)
* add img_padding_size

* minor change

* add pad_shape to data_samples
2022-12-01 16:35:39 +08:00
MengzhangLI
e98231ba5f [Enhance] Make scipy as a default dependency in runtime 1.x 2022-11-30 20:11:14 +08:00
MengzhangLI
8b61820751 add comment 2022-11-22 22:42:11 +08:00
MengzhangLI
58e73c3fab [Fix] Fix KNet IterativeDecodeHead bug in dev-1.x branch 2022-11-22 12:46:24 +08:00
Miao Zheng
c56a299571
Merge pull request #2290 from xiexinch/fix_gt_padding
[Enhancement] Support padding in testing
2022-11-19 18:24:59 +08:00
xiexinch
4e12bcd053 fix data sample is None 2022-11-19 18:08:19 +08:00
xiexinch
f915df4b0c remove gt padding 2022-11-19 17:38:10 +08:00
xiexinch
26e9729a84 fix swin load statedict 2022-11-15 16:55:49 +08:00
xiexinch
d33af5215a fix ut 2022-11-10 18:42:18 +08:00
xiexinch
d0b35cdacd fix get gt data 2022-11-10 14:28:20 +08:00
xiexinch
70daaaad59 support padding in test and fix remove gt padding at post_process 2022-11-10 14:21:05 +08:00
Miao Zheng
b732fae265
Upgrade pre commit hooks (#2154)
* Upgrade pre commit hooks

* fix lint
2022-10-08 12:04:24 +08:00
谢昕辰
b3b7629d38
[Fix] Fix binary segmentation (#2101)
* add out_channels

* fix forward

* add decode_head ut

* add segmentor ut

* refine postprocess

* fix
2022-09-27 16:49:38 +08:00
谢昕辰
230246f557
[Refactor] Add pyupgrade pre-commit hook (#2078)
* add pyupgrade hook

* run pyupgrade precommit hook
2022-09-19 14:06:29 +08:00
MengzhangLI
ee7f340dff
[Feature] Support Tversky Loss in dev-1.x branch (#2000) 2022-08-31 10:58:21 +08:00
Miao Zheng
ef2152fd54
[Fix] Fix inputs dtype convert in data preprocessor (#1975) 2022-08-26 17:25:48 +08:00
Miao Zheng
8de0050f25
[Refactor] data flow (#1956)
* [WIP] Refactor data flow

* model return

* [WIP] Refactor data flow

* support data_samples is optional

* fix benchmark

* fix base

* minors

* rebase

* fix api

* ut

* fix api inference

* comments

* docstring

* docstring

* docstring

* fix bug of slide inference

* add assert c > 1
2022-08-26 15:54:23 +08:00
Miao Zheng
50546da85c
[Fix]Remove modules from mmcv.runner and mmcv.utils (#1966)
* [WIP] mmcv-clean

* [WIP]Remove modules from mmcv.runner and mmcv.utils

* wip

* fix import mmengine

* remove ut

* loadcheckpoint in mae
2022-08-25 15:15:21 +08:00
Miao Zheng
e0499d5a77 [Fix] Fix repo based on refactoring standard (#1869)
* [Fix] Fix repo based on refactory standard

* fix ut
2022-08-19 20:50:02 +08:00
谢昕辰
167f94a70b rename data to structures (#1854) 2022-08-19 20:50:02 +08:00
Miao Zheng
d265778b6f
[Fix] Import Sequential from mmengine (#1899) 2022-08-09 21:41:03 +08:00
Miao Zheng
e2f26e3fde
[Fix] Import BaseModule from mmengien (#1862) 2022-08-04 09:35:05 +08:00
MengzhangLI
4079d6dfed
[Fix] Use MMEngine BaseModule (#1829)
* [Fix] Use MMEngine BaseModule

* delete auto_fp16
2022-07-27 15:35:12 +08:00
zhengmiao
4b76f277a6 [Refactory] MMSegmentation Content 2022-07-15 15:47:29 +00:00
xiexinchen.vendor
1b3a4876a1 [Refactor] Fix STDCNet custom loss 2022-07-12 10:20:41 +00:00
xiexinchen.vendor
3e8594d2dc [Refactor] Move tensor2list operation to EncoderDecoder 2022-07-08 10:34:03 +00:00
xiexinch
55b0c3aef5 fix cgnet configs and encnet forward error 2022-07-07 14:18:17 +08:00
xiexinch
761e1a9983 minor change 2022-07-05 20:43:33 +08:00