Skip to content
Snippets Groups Projects
  1. Apr 19, 2023
  2. Apr 13, 2023
  3. Apr 06, 2023
  4. Feb 01, 2023
    • Qingyun's avatar
      [Fix] Fix MaskFormer and Mask2Former of MMSegmentation (#2532) · a092fea8
      Qingyun authored
      ## 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: default avatarMeowZheng <meowzheng@outlook.com>
      a092fea8
    • 谢昕辰's avatar
      [Refactor] Refactor fileio (#2543) · 124b87ce
      谢昕辰 authored
      ## 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.
      124b87ce
  5. Jan 30, 2023
  6. Jan 10, 2023
  7. Dec 31, 2022
  8. Dec 30, 2022
  9. Dec 01, 2022
    • MengzhangLI's avatar
      [Feature] Support MaskFormer(NeurIPS'2021) in MMSeg 1.x (#2215) · 933e4d3c
      MengzhangLI authored
      * [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
      933e4d3c
  10. Nov 15, 2022
  11. Nov 01, 2022
    • Miao Zheng's avatar
      [Enhancement] Fix ci for 1.x (#2011) · b07bb163
      Miao Zheng authored
      * [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
      b07bb163
  12. Oct 18, 2022
  13. Oct 08, 2022
  14. Sep 13, 2022
    • Miao Zheng's avatar
      [Del] Remove ops (#2063) · fffb9e25
      Miao Zheng authored
      fffb9e25
    • MengzhangLI's avatar
      [CI] Fix CI (#2029) · 8aca73e1
      MengzhangLI authored
      
      * [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: default avatarMiao Zheng <76149310+MeowZheng@users.noreply.github.com>
      8aca73e1
  15. Sep 02, 2022
    • Miao Zheng's avatar
      [Enhancement] Fix ci for 1.x (#2011) · a57855b6
      Miao Zheng authored
      * [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
      a57855b6
  16. Aug 31, 2022
  17. Jul 05, 2022
  18. Apr 29, 2022
  19. Feb 22, 2022
    • MengzhangLI's avatar
      [Enhancement] Add win-ci (#1296) · bcd0c89e
      MengzhangLI authored
      * [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
      bcd0c89e
  20. Feb 15, 2022
  21. Dec 16, 2021
    • MengzhangLI's avatar
      [Docs] Refactor the structure of documentation (#1128) · 4a90241f
      MengzhangLI authored
      * 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//
      4a90241f
  22. Dec 09, 2021
  23. Nov 30, 2021
    • MengzhangLI's avatar
      [Enhancement] CircleCI Setup (#1086) · ae8d5ff0
      MengzhangLI authored
      * 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
      ae8d5ff0
  24. Nov 29, 2021
  25. Nov 25, 2021
  26. Nov 02, 2021
    • Junjun2016's avatar
      [Feature] Support TIMMBackbone (#998) · 0a06853b
      Junjun2016 authored
      * 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
      0a06853b
  27. Oct 24, 2021
  28. Oct 13, 2021
    • Junjun2016's avatar
      [Enhancement] Add codespell pre-commit hook and fix typos (#920) · 67f14204
      Junjun2016 authored
      * 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
      67f14204
  29. Sep 27, 2021
  30. Sep 16, 2021
  31. Sep 09, 2021
    • Junjun2016's avatar
      [Enhancement] Upgrade CI for PyTorch1.9 (#712) · 6762958e
      Junjun2016 authored
      * 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
      6762958e
  32. Jul 31, 2021
  33. Jun 22, 2021
  34. Jun 21, 2021
Loading