Commit Graph

49 Commits (e64548fda0221ad708f5da29dc907e51a644c345)

Author SHA1 Message Date
谢昕辰 e566f986be
Merge branch 'dev-1.x' of github.com:open-mmlab/mmsegmentation into main (#2928) 2023-04-19 17:23:29 +08:00
谢昕辰 997d14701e
[CI] update mmdet dependency (#2848) 2023-04-06 16:18:25 +08:00
谢昕辰 3312c505af
[Doc] Update readme (#2834)
## Motivation

As title, lead users to follow our migration document.

## Checklist

- [x] https://github.com/open-mmlab/mmsegmentation/pull/2801
2023-04-06 14:57:25 +08:00
谢昕辰 413f12066e
[CI] Update ci image (#2801)
## Motivation

https://github.com/actions/runner-images/issues/6002
2023-04-06 11:12:14 +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
Miao Zheng 981f3a488e
[Fix]Fix mmcv version 2.0.0rc3 for win test (#2531)
as title
2023-01-30 13:49:54 +08:00
谢昕辰 b9b5d8bf52
[CI] Upgrade the version of isort to fix lint error (#2519)
## Motivation

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

---------

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2023-01-30 10:31:12 +08:00
Miao Zheng 4e759bb1d2
[CI] Remove test py3.6 (#2468)
## Motivation

as title

## Modification

1. .circleci/test.yml
2. .github/workflows/merge_stage_test.yml
2023-01-10 17:11:59 +08:00
Miao Zheng e727e92ac6
[Fix]Fix pt version for merge stage test (#2449)
## Motivation

The conflict is caused by:
    The user requested torch==1.12.1+cpu
    torchvision 0.13.0+cpu depends on torch==1.12.0

## Modification

modify the torch==1.12.0+cpu
2022-12-31 17:38:33 +08:00
xiexinch 2843faa6b5 [Projects] Add 'Projects/' folder, and the first example project (#2412)
add example project

add ci ignore

add version limits
2022-12-30 22:52:07 +08:00
xiexinch f4dad5f921 [CI] Add torch1.13 checking in CI (#2402)
* Add torch1.13 in CI

* use mim install mm packages

* install all requirements

* install wheel

* add ref
2022-12-30 22:52:07 +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
xiexinch 921fdde032 fix lint 2022-11-15 15:58:24 +08:00
Miao Zheng b07bb163a1 [Enhancement] Fix ci for 1.x (#2011)
* [Enhancement] Fix ci for 1.x

* circle ci

* lint and engien

* typo

* typo

* mim install mmcv

* python -m pip

* python -m pip

* python -m pip

* remove pt1.5

* remove pt1.5

* ignore high memory in win

* fix win and lint

* fix lint

* fix lint

* fix lint

* win

* win
2022-11-01 22:46:02 +08:00
谢昕辰 2ea4034014
upgrade (#2202) 2022-10-18 13:19:40 +08:00
Miao Zheng 00c5e80026
[Fix] Ignore test timm when torch<1.7 (#2158) 2022-10-08 17:32:12 +08:00
Miao Zheng fffb9e2588
[Del] Remove ops (#2063) 2022-09-13 15:47:42 +08:00
MengzhangLI 8aca73e187
[CI] Fix CI (#2029)
* [CI] Fix CI

* fix wrong command

* remove mmcv

* fix lint error

* add pytorch install

* fix pytorch installation

* fix mmengine error

* fix mmcv installation in pr_stage

* fix docstring coverage in lint and delete cu102 in pr_stage windows

* fix lint.yml and reset test.yml

* ignore some ut in build_windows of pr_stage

* test merge stage test

* fix mmseg dependencies in pr_stage_test.yml

* delete redundant lines in pr_stage and fix mmseg dependencies in mr_stage

* fix error in merge_stage

* delete python -m in merge_stage

* fix error in merge_stage

* let mmcv installation before mmengine

* fix error of mmcv not found

* fix ut error in merge)stage_test.yml

* fix build_windows ut in metge_stage

* fix error

* fix windows error of merge_stag

* Update .github/workflows/merge_stage_test.yml

* Update .github/workflows/merge_stage_test.yml

* Update .github/workflows/merge_stage_test.yml

* fix error

* delete skip timm ut

* add requitements/optinal.txt in test.yml

* Update .github/workflows/merge_stage_test.yml

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
2022-09-13 13:43:13 +08:00
Miao Zheng 8f5dcc8579
[Fix] README for mmseg 1.x (#2009)
* [Fix] README for mmseg 1.x

* typo

* link and refine
2022-09-01 00:03:51 +08:00
xiexinch 28a3d89b7a Update pre-commit yaml and md2yml.py 2022-07-05 15:58:48 +08:00
Miao Zheng f06c39f9d6 [Fix] Add GPG keys in CI (#1532)
* [Fix] Fix system dependencies in CI

* del pt1.5

* add gpg keys

* add pt1.5
2022-04-29 14:20:08 +08:00
MengzhangLI bcd0c89ebb [Enhancement] Add win-ci (#1296)
* [Enhancement] Add win-ci

* add timm in win unittest

* remove mmflow with mmseg in win unittest

* remove opencv-python in requirements

* add opencv2 back

* move opencv installation into build.yml
2022-02-22 21:06:57 +08:00
MengzhangLI 8e8cb06f52 [Enhancement] Update the installation of MMCV (#1275)
* Update the installation of MMCV

* use matrix.torch_version

* fix typo in doc

* fix docs

* fix colab

* change docs
2022-02-15 22:18:39 +08:00
MengzhangLI 4a90241f91 [Docs] Refactor the structure of documentation (#1128)
* merge docs/ and docs_zh-CN/

* merge docs/ and docs_zh-CN/

* merge docs/ and docs_zh-CN/

* merge docs/ and docs_zh-CN/

* fix launch utility url

* fix launch utility url

* fix wrong pytorch doc url

* remove wrong links docs//
2021-12-16 18:56:45 +08:00
MengzhangLI 12d902c02c [Fix] Cancel previous runs that are not completed #1118 2021-12-09 15:56:22 +08:00
MengzhangLI ae8d5ff0d4 [Enhancement] CircleCI Setup (#1086)
* uploading circle-ci

* uploading circle-ci

* uploading circle-ci

* correct circleci folder

* change mmsegmentation to mmseg in config.yml

* adding timm package in circleci

* adding timm package in circleci

* fix original lint error
2021-11-30 00:25:35 -08:00
del-zhenwu 621114fa39 Skip CI on ignoring given paths (#1078)
* Skip CI on ignoring given paths

Signed-off-by: del-zhenwu <dele.zhenwu@gmail.com>

* Fix ignoring path with using

Signed-off-by: del-zhenwu <dele.zhenwu@gmail.com>
2021-11-29 15:48:57 +08:00
MengzhangLI fdc054614c [Fix] Fix Dataset Display on README.md (#1072)
* fix dataset display on readme

* delete pytorch1.3.1

* change PyTorch 1.5.1 to 1.5or1.5.0

* change PyTorch 1.5.1 to 1.5.0

* change PyTorch 1.5.1 to 1.5.0

* fix cu102
2021-11-25 09:40:29 -08:00
Junjun2016 0a06853bb6 [Feature] Support TIMMBackbone (#998)
* add TIMMBackbone and unittests

* add timm to tests requirements

* deprecate pt1.3.1

* reduce the unittests input of timm backbone

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci

* remove unittests of large models of timm backbone

* generate coverage report for all unittests env

* reduce the unittests input of timm backbone

* reduce the unittests input of timm backbone
2021-11-02 12:51:11 +08:00
Junjun2016 32f153e272 [Fix] Fix bug in CI with py3.9 (#994)
* remove python-dev in CI

* remove pycocotools installation

* remove python 3.9-dev installation dependencies
2021-10-24 11:49:07 -07:00
Junjun2016 67f1420472 [Enhancement] Add codespell pre-commit hook and fix typos (#920)
* add codespell pre-commit hook and fix typos

* Update mmseg/models/decode_heads/dpt_head.py

* Update mmseg/models/backbones/vit.py

* Update mmseg/models/backbones/vit.py

* fix typos

* skip formating typo

* deprecate formating

* skip ipynb

* unstage ipynb changes

* unstage ipynb changes

* fix typos in ipynb

* unstage ipynb changes
2021-10-13 06:21:17 -07:00
Junjun2016 d96937a003 [Enhancement] Using docker to skip CUDA installation in CI (#882)
* Use docker to skip CUDA installation in CI

* Update .github/workflows/build.yml

Co-authored-by: Jerry Jiarui XU <xvjiarui0826@gmail.com>

* Remove Install system dependencies

* Add Install system dependencies for cuda usage

* Add Install system dependencies and requirements

* fix requirements error

Co-authored-by: Jerry Jiarui XU <xvjiarui0826@gmail.com>
2021-09-26 22:25:21 -07:00
Junjun2016 9162d058d9 [Docs] Improve docs style (#879)
* Improve docs style

* update lists

* update the size of image

* modify duplicate mmdet3d
2021-09-16 08:23:50 -07:00
Junjun2016 6762958ea0 [Enhancement] Upgrade CI for PyTorch1.9 (#712)
* Upgrade CI for PyTorch1.9

* fix typo

* merge build_cu101 and build_cu102 to build_cuda

* fix substitution bug

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* remove redudant items

* add python 3.9 to CI

* add python 3.9 to setup.py

* remove some versions of pytorch for python 3.9 test

* fix torch version error

* delete mim files

* update ubuntu version

* fix mmcv cuda version
2021-09-08 18:43:17 -07:00
Junjun2016 8ed5975b81 add reimplementation questions template (#741) 2021-07-31 09:29:15 -07:00
Junjun2016 7eeb0aa56a fix typos 2021-06-22 19:07:55 +08:00
Junjun2016 52a8112d60 fix lint error 2021-06-22 00:41:31 +08:00
Junjun2016 87dac0fe82 add_pr_template 2021-06-21 22:31:59 +08:00
sennnnn 76e0d673e9 [Feature] Move 'Install MMCV' to a independent CI item. (#602)
* [Feature] Move 'Install MMCV' to a independent CI item.

* Merge MMCV install into MMSEG dependencies install

* Fix bug of 'Install MMCV'

* Remove duplicate CI items

* Fix torch device

* Split cpu env and gpu env into two CI project

* Fix some mmdet related bugs

* Fix mmcv-full install bug of build_cpu CI project.
2021-06-17 07:57:46 -07:00
Jerry Jiarui XU d283ca6fea [Improvement] Add more CI (#460)
* add more CI

* fix missing

* remove python-version

* fixed acc
2021-04-08 19:29:00 -07:00
Jerry Jiarui XU 7e918e302a update CI for pip 20.3 (#307)
* update CI for pip 20.3

* fixed 1.6 torchvision

* delete python 3.8

* fixed mmcv

* add cuda home

* change to 1.2.2

* add pip upgrade

* install cuda for all

* add missing mmcv

* switch to deprecate
2020-12-17 22:46:38 -08:00
Jerry Jiarui XU c13e1d5e05 [Improvement] Add markdown linter and fix linting errors (#171)
* [Improvement] Add markdown linter and fix linting errors

* fixed pip
2020-10-07 19:50:16 +08:00
Jerry Jiarui XU e86f4377b3 [Enhance] Update url to https://download.openmmlab.com (#165) 2020-09-28 00:32:44 +08:00
Jerry Jiarui XU a96e2f932d Add pytorch 1.6 CI (#64) 2020-08-12 18:55:40 +08:00
Jerry Jiarui XU daa023836b Fixed voc aug convert (#19)
* Fixed voc aug convert

* update getting_started.md

* add class balanced doc
2020-07-17 09:55:28 +08:00
Kai Chen 5d2140f0ca Install wheel before building mmseg (#14) 2020-07-14 00:28:13 +08:00
Kai Chen bc285bea28 Add pypi deployment (#11)
* add pypi deployment

* remove useless jobs

* fixed typo and cleanup

* delete build.tx

* add change log

Co-authored-by: Jiarui XU <xvjiarui0826@gmail.com>
2020-07-13 20:54:32 +08:00
Jiarui XU b2724da80b init commit 2020-07-10 02:39:01 +08:00