Skip to content
Snippets Groups Projects
  1. Mar 06, 2023
  2. Mar 03, 2023
  3. Mar 02, 2023
  4. Feb 28, 2023
  5. Feb 27, 2023
  6. Feb 24, 2023
  7. Feb 23, 2023
  8. Feb 22, 2023
    • Miao Zheng's avatar
      [Enhancement] Refine projects (#2586) · 2d38bc85
      Miao Zheng authored
      ## Motivation
      
      Make projects contribution more clear
      
      ## Modification
      
      1. Add description on project/README
      2. Modify comments to reference in example_project/README 
      3. Add faq for projects
      
      ## BC-breaking (Optional)
      
      No
      2d38bc85
  9. Feb 16, 2023
  10. Feb 15, 2023
  11. Feb 10, 2023
  12. Feb 08, 2023
  13. Feb 07, 2023
  14. Feb 06, 2023
    • Tianlong Ai's avatar
      [Fix] Rename and Fix bug of projects HieraSeg (old PR #2444) (#2565) · 432628b7
      Tianlong Ai authored
      ## Motivation
      Supplementary PR #2444 
      Fix tiny bug and add loss_by_feat() to compute loss to train.
      The inference process have verified to be accurate.
      ## Modification
      - modify `sep_aspp_contrast_head.py` , add `loss_by_feat()` function to
      train(training still has bug, will fix in future:tired_face:)
      - fix testing commands path error `bash tools/dist_test.sh
      projects/HieraSeg_project/` to `bash tools/dist_test.sh
      projects/HieraSeg/` at README.md
      432628b7
  15. Feb 03, 2023
  16. Feb 01, 2023
    • 谢昕辰's avatar
      Bump v1.0.0rc5 (#2549) · 7ac0888d
      谢昕辰 authored
      as title
      7ac0888d
    • zccjjj's avatar
      Rename typing.py to typing_utils.py (#2548) · ce63ccf7
      zccjjj authored
      ## Motivation
      
      Fix the bug in running ```collect_evn.py```. #2547 
      
      ## Modification
      
      Rename typing.py to typing_utils.py
      ce63ccf7
    • 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
    • Siddharth Ancha's avatar
      Backward merge #2535 from `1.x` into `dev-1.x` (#2546) · 698dee95
      Siddharth Ancha authored
      
      ## 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: default avatarMeowZheng <meowzheng@outlook.com>
      698dee95
  17. Jan 31, 2023
  18. Jan 30, 2023
    • 谢昕辰's avatar
      Bump v1.0.0rc4 (#2529) · 18ee41eb
      谢昕辰 authored
      18ee41eb
    • Miao Zheng's avatar
      [Fix]Fix mmcv version 2.0.0rc3 for win test (#2531) · 981f3a48
      Miao Zheng authored
      as title
      981f3a48
    • Siddharth Ancha's avatar
      [Fix] Unfinished label conversion from `-1` to `255` in 1.x (#2516) · d1c0a3ef
      Siddharth Ancha authored
      ## Motivation
      
      This is motivated by a previously unfinished PR (#2332). In that PR, the
      label -1 was changed to 255 in `BaseSegDataset`, which is correct.
      However, it was changed at only one location. There is another location
      in `mmseg/datasets/basesegdataset.py` where -1 was still being used that
      was not converted to 255. I have now converted it to 255.
      
      This is exactly same as a similar fix to the `master` branch via #2515 .
      
      ## Modification
      
      I've simply converted the snipped
      
      ```python
      if new_id != -1:
          new_palette.append(palette[old_id])
      ```
      to 
      ```python
      if new_id != 255:
          new_palette.append(palette[old_id])
      ```
      
      ## 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 or were affected.
      - [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._
      d1c0a3ef
    • Siddharth Ancha's avatar
      [Fix] Switch order of `reduce_zero_label` and applying `label_map` in 1.x (#2517) · 74e8b89b
      Siddharth Ancha authored
      This is an almost exact duplicate of #2500 (that was made to the
      `master` branch) now applied to the `1.x` branch.
      
      ---
      
      ## 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 a few
      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._
      74e8b89b
    • Siddharth Ancha's avatar
    • 谢昕辰's avatar
  19. Jan 22, 2023
  20. Jan 20, 2023
Loading