Commit Graph

236 Commits (1896344e04ad3a919194b394d44da4e0b69d026b)

Author SHA1 Message Date
Tianlong Ai 1896344e04
[Docs] Update zh_CN faq.md (#2769)
As title #2750
2023-03-21 21:33:40 +08:00
Miao Zheng ff95416c3b
[Features]Support dump segment predition (#2712)
## Motivation

1. It is used to save the segmentation predictions as files and upload
these files to a test server

## Modification

1. Add output_file and format only in `IoUMetric`
 
## BC-breaking (Optional)

No

## 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.
3. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
4. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
5. The documentation has been modified accordingly, like docstring or
example tutorials.
2023-03-17 22:58:08 +08:00
Tianlong Ai 8c89ff3dd1
[Datasets] Add Mapillary Vistas Datasets to MMSeg Core Package. (#2576)
## [Datasets] Add Mapillary Vistas Datasets to MMSeg Core Package .
## Motivation
Add Mapillary Vistas Datasets to core package.
Old PR #2484 

## Modification
- Add Mapillary Vistas Datasets to core package.
- Delete `tools/datasets_convert/mapillary.py` , dataset does't need
converting.
- Add `schedule_240k.py`  config.
- Add configs files.  
  ```none
  deeplabv3plus_r101-d8_4xb2-240k_mapillay_v1-512x1024.py
  deeplabv3plus_r101-d8_4xb2-240k_mapillay_v2-512x1024.py
  maskformer_swin-s_4xb2-240k_mapillary_v1-512x1024.py
  maskformer_swin-s_4xb2-240k_mapillary_v2-512x1024.py
  maskformer_r101-d8_4xb2-240k_mapillary_v1-512x1024.py
  maskformer_r101-d8_4xb2-240k_mapillary_v2-512x1024.py
  pspnet_r101-d8_4xb2-240k_mapillay_v1-512x1024.py
  pspnet_r101-d8_4xb2-240k_mapillay_v2-512x1024.py
  ```
- Synchronized changes to `projects/mapillary_datasets`

---------

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-03-15 14:44:38 +08:00
CSH 684d79fedc
[Doc] add zh_cn migration doc (#2733)
as title

---------

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-03-13 19:23:22 +08:00
CSH 6468d3150a
[Doc] Add zh_cn transforms doc and format en doc (#2722)
as title
2023-03-09 22:28:58 +08:00
CSH 645dcf8c49
[Doc] Add zh_cn evaluation doc and fix en typo (#2701)
as title

---------

Signed-off-by: csatsurnh <cshan1995@126.com>
2023-03-09 22:27:42 +08:00
jinxianwei 7e41b5af8d
en doc of uisualization_feature_map.md (#2715)
## Motivation

En doc for visualization_feature_map.md and index.rst

## Modification

Add new file and change index.rst
2023-03-07 21:23:04 +08:00
MengzhangLI 91c62abcf4
[Fix] Fix the correct location of FAQ in dev-1.x (#2717) 2023-03-07 21:21:01 +08:00
CSH 6c3599bd9d
[Doc] Add zh_cn models doc and fix en doc typo (#2703)
as title

---------

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2023-03-07 11:47:10 +08:00
CSH e541d1acd4
[Doc] Add zh_cn add_models doc & fix link (#2702)
as title
2023-03-06 18:03:12 +08:00
CSH bb77cd9855
[Doc] Add zh_cn add_transforms doc (#2673)
as title
2023-03-06 14:49:37 +08:00
谢昕辰 779b86cd74
bump v1.0.0rc6 (#2647)
as title
2023-03-03 16:54:12 +08:00
Miao Zheng aaa08dc4b2
[Doc] Refine MMSegmentation documentation (#2668) 2023-03-03 14:51:38 +08:00
Miao Zheng 310ec4afc7
[Enhancement] Modify interface of MMSeginferencer and add docs (#2658)
## Motivation

Make MMSeginferencer easier to be used

## Modification

1. Add `_load_weights_to_model` to MMSeginferencer, it is for get
`dataset_meta` from ckpt
2. Modify and remove some parameters of `__call__`, `visualization` and
`postprocess`
3. Add function of save seg mask, remove dump pkl.
4. Refine docstring of MMSeginferencer and SegLocalVisualizer
5. Add the user documentation of MMSeginferencer

## BC-breaking (Optional)

yes, remove some parameters, we need to discuss whether keep them with
deprecated waring or just remove them as the MMSeginferencer just merged
in mmseg a few days.

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-03-03 14:37:54 +08:00
Tianlong Ai 8c1d299cb6
[Docs] Add Chinese dataflow markdown (#2652)
## Modification
Add Chinese dataflow markdown

---------

Signed-off-by: csatsurnh <cshan1995@126.com>
Co-authored-by: csatsurnh <cshan1995@126.com>
Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2023-03-02 09:56:00 +08:00
Miao Zheng e955d6868a
[Docs] Fix migration link in README (#2659)
as title
2023-03-02 09:16:48 +08:00
Miao Zheng 619a3c2508
[Enhancement] Remove mmdet and mmcls from mminstall (#2642)
## Motivation

As the mmdet and mmcls are not very stabel, and mim can install repo
from source code, we remove them from mminstall and they won't be
installed automatically when run `mim install mmsegmentation`

## Modification

1. remove mmdet and mcls from mminstall
2. add explanation in faq

---------

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>
2023-02-24 14:57:54 +08:00
谢昕辰 039ba5d4ca
[Feature] Support auto import modules from registry. (#2481)
## Motivation

The registry now supports auto-import modules from the given location.

register_all_modules before running is no longer needed. The modules
will be lazy-imported during building.

- [x] This PR can be merged after
https://github.com/open-mmlab/mmengine/pull/643. The MMEngine version
should be updated.

Ref: https://github.com/open-mmlab/mmdetection/pull/9143
2023-02-23 20:33:17 +08:00
wangjiangben-hw e9d5b03607
[DOC] update link in NPU DOC (#2610)
## Motivation

update link in dock

## Modification

docs/en/device/npu.md
docs/zh_cn/device/npu.md
2023-02-16 17:43:18 +08:00
谢昕辰 a947e3e754
[FIx] Set default `backend_args` values to None (#2597)
## Motivation

In MMEngine >= 0.2.0, it might directly determine what the backend is by
using the `data_root` path.

## Modification

Set all default `backend_args` values are `None`.
2023-02-16 15:33:52 +08:00
wangjiangben-hw 9b8e8b730c
[NPU] add npu result (#2596)
Motivation
add NPU results -- apcnet, bisenetv1, bisenetv2 

Modification
add docs/en/device/npu.md and docs/zh_cn/device/npu.md that accompanies
the submission results.

---------

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2023-02-15 12:03:01 +08:00
Yijie Zheng 712612b1a1
[Doc] fix api name error in the migration doc (#2601)
as title
2023-02-15 11:14:22 +08:00
jinxianwei 08eb9a4e1d
[Doc] for Visualization feature map using wandb backend in dev-1.x (#2557)
## Motivation

Docs for Visualization featusre map using wandb backend.

## Modification

Add a new markdown file and result demo of wandb.

---------

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-02-08 19:53:50 +08:00
wangjiangben-hw 916ed2b2e2
[NPU] add npu result (#2569)
Motivation
add NPU results.

Modification
add docs/en/device/npu.md and docs/zh_cn/device/npu.md that accompanies
the submission results.

---------

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2023-02-07 16:36:36 +08:00
MengzhangLI b2577e0ba0
[Doc] Add EN custmized runtime doc in dev-1.x (#2533)
## Motivation
Translate Chinese version customized runtime doc into English
https://github.com/open-mmlab/mmsegmentation/pull/2502.
2023-02-07 14:47:22 +08:00
Andrew Lau 49b062e365
CodeCamp #139 [Feature] Support REFUGE dataset. (#2554)
## Motivation 
Add REFUGE datasets
Old PR: https://github.com/open-mmlab/mmsegmentation/pull/2420

---------

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>
2023-02-03 16:02:19 +08:00
谢昕辰 7ac0888d9f
Bump v1.0.0rc5 (#2549)
as title
2023-02-01 20:34:20 +08:00
Qingyun a092fea8c1
[Fix] Fix MaskFormer and Mask2Former of MMSegmentation (#2532)
## Motivation

The DETR-related modules have been refactored in
open-mmlab/mmdetection#8763, which causes breakings of MaskFormer and
Mask2Former in both MMDetection (has been fixed in
open-mmlab/mmdetection#9515) and MMSegmentation. This pr fix the bugs in
MMSegmentation.

### TO-DO List

- [x] update configs
- [x] check and modify data flow
- [x] fix unit test
- [x] aligning inference
- [x] write a ckpt converter
- [x] write ckpt update script
- [x] update model zoo
- [x] update model link in readme
- [x] update
[faq.md](https://github.com/open-mmlab/mmsegmentation/blob/dev-1.x/docs/en/notes/faq.md#installation)

## Tips of Fixing other implementations based on MaskXFormer of mmseg

1. The Transformer modules should be built directly. The original
building with register manner has been refactored.
2. The config requires to be modified. Delete `type` and modify several
keys, according to the modifications in this pr.
3. The `batch_first` is set `True` uniformly in the new implementations.
Hence the data flow requires to be transposed and config of
`batch_first` needs to be modified.
4. The checkpoint trained on the old implementation should be converted
to be used in the new one.

### Convert script

```Python
import argparse
from copy import deepcopy
from collections import OrderedDict

import torch

from mmengine.config import Config
from mmseg.models import build_segmentor
from mmseg.utils import register_all_modules
register_all_modules(init_default_scope=True)


def parse_args():
    parser = argparse.ArgumentParser(
        description='MMSeg convert MaskXFormer model, by Li-Qingyun')
    parser.add_argument('Mask_what_former', type=int,
                        help='Mask what former, can be a `1` or `2`',
                        choices=[1, 2])
    parser.add_argument('CFG_FILE', help='config file path')
    parser.add_argument('OLD_CKPT_FILEPATH', help='old ckpt file path')
    parser.add_argument('NEW_CKPT_FILEPATH', help='new ckpt file path')
    args = parser.parse_args()
    return args


args = parse_args()

def get_new_name(old_name: str):
    new_name = old_name

    if 'encoder.layers' in new_name:
        new_name = new_name.replace('attentions.0', 'self_attn')

    new_name = new_name.replace('ffns.0', 'ffn')

    if 'decoder.layers' in new_name:

        if args.Mask_what_former == 2:
            # for Mask2Former
            new_name = new_name.replace('attentions.0', 'cross_attn')
            new_name = new_name.replace('attentions.1', 'self_attn')
        else:
            # for Mask2Former
            new_name = new_name.replace('attentions.0', 'self_attn')
            new_name = new_name.replace('attentions.1', 'cross_attn')

    return new_name
    
def cvt_sd(old_sd: OrderedDict):
    new_sd = OrderedDict()
    for name, param in old_sd.items():
        new_name = get_new_name(name)
        assert new_name not in new_sd
        new_sd[new_name] = param
    assert len(new_sd) == len(old_sd)
    return new_sd
    
if __name__ == '__main__':
    cfg = Config.fromfile(args.CFG_FILE)
    model_cfg = cfg.model

    segmentor = build_segmentor(model_cfg)

    refer_sd = segmentor.state_dict()
    old_ckpt = torch.load(args.OLD_CKPT_FILEPATH)
    old_sd = old_ckpt['state_dict']

    new_sd = cvt_sd(old_sd)
    print(segmentor.load_state_dict(new_sd))

    new_ckpt = deepcopy(old_ckpt)
    new_ckpt['state_dict'] = new_sd
    torch.save(new_ckpt, args.NEW_CKPT_FILEPATH)
    print(f'{args.NEW_CKPT_FILEPATH} has been saved!')
```

Usage:
```bash
# for example
python ckpt4pr2532.py 1 configs/maskformer/maskformer_r50-d32_8xb2-160k_ade20k-512x512.py original_ckpts/maskformer_r50-d32_8xb2-160k_ade20k-512x512_20221030_182724-cbd39cc1.pth cvt_outputs/maskformer_r50-d32_8xb2-160k_ade20k-512x512_20221030_182724.pth
python ckpt4pr2532.py 2 configs/mask2former/mask2former_r50_8xb2-160k_ade20k-512x512.py original_ckpts/mask2former_r50_8xb2-160k_ade20k-512x512_20221204_000055-4c62652d.pth cvt_outputs/mask2former_r50_8xb2-160k_ade20k-512x512_20221204_000055.pth
```

---------

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-02-01 18:58:21 +08:00
谢昕辰 124b87ce90
[Refactor] Refactor fileio (#2543)
## Motivation

Use the new fileio from mmengine
https://github.com/open-mmlab/mmengine/pull/533

## Modification

1. Use `mmengine.fileio` to repalce FileClient  in mmseg/datasets
2. Use `mmengine.fileio` to repalce FileClient in
mmseg/datasets/transforms
3. Use `mmengine.fileio` to repalce FileClient in mmseg/visualization

## BC-breaking (Optional)

we modify all the dataset configurations, so please use the latest config file.
2023-02-01 17:53:22 +08:00
谢昕辰 18ee41eb7a
Bump v1.0.0rc4 (#2529) 2023-01-30 17:53:07 +08:00
Siddharth Ancha 6b53ec0a1f
[Doc] Fix minor typo in migration `package.md` (#2518)
Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-01-30 12:02:09 +08:00
MengzhangLI a115b10323
[Doc] Add EN datasets.md in dev-1.x (#2464)
Add English version of `datasets.md`, the Chinese version is in
https://github.com/open-mmlab/mmsegmentation/pull/2387.

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-01-22 15:55:30 +08:00
MengzhangLI f678a5c974
[Doc] Add ZN Customized_runtime Doc in dev-1.x (#2502)
Old PR: https://github.com/open-mmlab/mmsegmentation/pull/2169
2023-01-19 16:29:56 +08:00
MengzhangLI c2ba8ebac1
[Fix][Doc] Fix link of preprocessing and order of operations in ZN dataset.md doc. (#2494)
## Motivation

Ref:
https://github.com/open-mmlab/mmsegmentation/pull/2464#discussion_r1072211706

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2023-01-19 14:26:26 +08:00
谢昕辰 d505ec1c94
[Doc] Fix API document (#2483)
## Motivation

As title.

## Modification

- docs/en/api.rst
- docs/zh_cn/api.rst
- add `scipy` to readthedocs requirement.
2023-01-13 20:06:30 +08:00
MengzhangLI 546f3b5b20
[Doc] Update ZN dataset preparation of Synapse (#2465)
## Motivation
- Add Chinese version of Synapse dataset preparation.
- Modify all `,` and `。` to `,` and `.` in
`docs/zh_cn/user_guides/2_dataset_prepare.md`.
2023-01-11 11:50:47 +08:00
王永韬 2d67e51db3
CodeCamp #140 [New] [Feature] Add synapse dataset and data augmentation in dev-1.x. (#2432)
## Motivation

Add Synapse dataset in MMSegmentation.
Old PR: https://github.com/open-mmlab/mmsegmentation/pull/2372.
2023-01-06 16:14:54 +08:00
Fivethousand 3ca690bad3
[Feature] Add BioMedicalRandomGamma (#2406)
Add the random gamma correction transform for biomedical images, which
follows the design of the nnUNet.
2023-01-02 21:29:03 +08:00
Miao Zheng 6eb1a95a48
Bump 1.0.0rc3 (#2446)
## Motivation

To release 1.0.0rc3  

## Modification

1. Modify mmseg version 
2. Add change log
3. Modify README
4. Modify faq 
5. Revise docker file
2022-12-31 18:15:56 +08:00
谢昕辰 115552d5ea update tta docs (#2335) 2022-12-30 22:52:07 +08:00
MengzhangLI 3aa5c8cf84 [Doc] Change some content from customize_runtime to engine ZN doc (#2341)
* [Doc] Change some content from customize_runtime to engine ZN doc

* fix comments

* add customize runtime setting zn doc

* move optimizer content into one section

* fix

* fix

* fix

* fix
2022-12-30 22:52:07 +08:00
谢昕辰 ad99ad1444 [Doc] Add dataflow document (#2403)
* draft

* update loss

* update

* add runner

* add steps

* update
2022-12-30 22:52:07 +08:00
tianlei 4eb366b07c CodeCamp #1565 [Doc] update the Chinese version of get_started.md (#2417)
* DOC

Update docs/zh_cn/get_started.md

Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
2022-12-30 22:52:07 +08:00
MengzhangLI 3001e93512 [Doc] Add ZN datasets.md in dev-1.x (#2387)
* [Doc] Add ZN datasets.md in dev-1.x

* fix typo

* fix

* fix
2022-12-30 22:52:07 +08:00
tianlei ad2fdc3702 CodeCamp #1562 [Doc] Add Chinese version of overview.md (#2397)
* CodeCamp #1562 [Doc] update `overview.md`

* Update overview.md

* Update docs/zh_cn/overview.md

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

* Update docs/zh_cn/overview.md

Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
2022-12-30 22:52:07 +08:00
BLUE-coconut 82a48ce1bf CodeCamp #147 [Doc] Add Chinese version of train & test tutorial (2355)
doc

modify part of content

changed parts of content

modified

Update docs/zh_cn/user_guides/4_train_test.md

Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
2022-12-30 22:52:07 +08:00
pofengdenihong 665fa4c736 CodeCamp #144 [Doc] Chinese version of config tutorial (2371)
* [Doc]Translate the 1_config.md and modify a wrong statement in 1_config.md

* Translate the 1_config.md and modify a wrong statement in 1_config.md

* Modify some expressions

* Apply suggestions from code review
2022-12-30 22:51:19 +08:00
Miao Zheng 750bb4f180
Bump 1.0.0rc2 (#2384)
* Bump 1.0.0rc2

* typo
2022-12-06 16:32:52 +08:00
xiexinch 6d3464a613 fix lint 2022-11-29 19:20:25 +08:00
MingJian.L ccc20052ee
Update visualization.md 2022-11-29 18:49:14 +08:00