Skip to content
Snippets Groups Projects
  1. Jun 19, 2023
  2. Jun 06, 2023
  3. May 15, 2023
  4. May 10, 2023
  5. May 08, 2023
    • zoulinxin's avatar
      [Feature] Add GDAL backend and Support LEVIR-CD Dataset (#2903) · 77591b9e
      zoulinxin authored
      ## Motivation
      
      For support with reading multiple remote sensing image formats, please
      refer to https://gdal.org/drivers/raster/index.html
      
      .
      
      Byte, UInt16, Int16, UInt32, Int32, Float32, Float64, CInt16, CInt32,
      CFloat32 and CFloat64 are supported for reading and writing.
      
      Support input of two images for change detection tasks, and support the
      LEVIR-CD dataset.
      
      ## Modification
      
      Add LoadSingleRSImageFromFile in 'mmseg/datasets/transforms/loading.py'.
      Load a single remote sensing image for object segmentation tasks.
      
      Add LoadMultipleRSImageFromFile in
      'mmseg/datasets/transforms/loading.py'.
      Load two remote sensing images for change detection tasks.
      
      Add ConcatCDInput  in 'mmseg/datasets/transforms/transforms.py'.
      Combine images that have been separately augmented for data enhancement.
      
      Add BaseCDDataset in 'mmseg/datasets/basesegdataset.py'
      Base class for datasets used in change detection tasks.
      
      ---------
      
      Co-authored-by: default avatarxiexinch <xiexinch@outlook.com>
      77591b9e
  6. Apr 24, 2023
  7. Mar 17, 2023
    • Miao Zheng's avatar
      [Features]Support dump segment predition (#2712) · ff95416c
      Miao Zheng authored
      ## 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.
      ff95416c
  8. Mar 16, 2023
  9. Mar 15, 2023
    • Junhwa Song's avatar
      [Enhance] Support multi-band image for Mosaic (#2748) · cb2d8fe0
      Junhwa Song authored
      ## Modification
      
      I changed the hardcoded 3 channel length to dynamic channel length in
      `np.full` function arguments.
      This modification enables `RandomMosaic` transform to support
      multispectral image (e.g. RGB image with NIR band) or bi-temporal image
      pairs for change detection task.
      
      ## 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.
      cb2d8fe0
    • 谢昕辰's avatar
      [Dev] Replace the test images (#2754) · 1f1f2666
      谢昕辰 authored
      ## Motivation
      
      The original images are too large.
      
      ## Modification
      
      Crop to small images.
      1f1f2666
    • Miao Zheng's avatar
      [Fix] Format shape check (#2753) · 3cc7ae21
      Miao Zheng authored
      as title
      3cc7ae21
    • 谢昕辰's avatar
      [Feature] Support PIDNet (#2609) · dd47cef8
      谢昕辰 authored
      ## 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
      dd47cef8
    • Tianlong Ai's avatar
      [Datasets] Add Mapillary Vistas Datasets to MMSeg Core Package. (#2576) · 8c89ff3d
      Tianlong Ai authored
      
      ## [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: default avatarMiao Zheng <76149310+MeowZheng@users.noreply.github.com>
      Co-authored-by: default avatarxiexinch <xiexinch@outlook.com>
      8c89ff3d
  10. Mar 14, 2023
    • Miao Zheng's avatar
      [Enhancement] Support input gt seg map is not 2D (#2739) · 6ba46966
      Miao Zheng authored
      
      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
      
      fix #2593
      
      ## Modification
      
      1. Only when gt seg map is 2D, extend its shape to 3D PixelData 
      2. If seg map is not 2D, we raised warning for users.
      
      ---------
      
      Co-authored-by: default avatarxiexinch <xiexinch@outlook.com>
      6ba46966
  11. Mar 07, 2023
  12. Mar 03, 2023
    • Miao Zheng's avatar
      [Enhancement] Modify interface of MMSeginferencer and add docs (#2658) · 310ec4af
      Miao Zheng authored
      
      ## 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: default avatarxiexinch <xiexinch@outlook.com>
      310ec4af
  13. Feb 23, 2023
  14. Feb 16, 2023
  15. Feb 03, 2023
  16. 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
  17. Jan 30, 2023
    • 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
  18. Jan 20, 2023
  19. Jan 11, 2023
    • Wencheng Wu's avatar
      [Feature] Add `gt_edge_map` field. (#2466) · 8dae9465
      Wencheng Wu authored
      ## Motivation
      
      The motivation of this PR is to add `gt_edge_map` field to support
      boundary loss.
      
      ## Modification
      
      - GenerateEdge
      Modify `gt_edge` field to `gt_edge_map`.
      
      - PackSegInputs
      Add `gt_edge_map` to data_sample.
      
      - stack_batch
      Pad `gt_edge_map` to max_shape.
      
      ## BC-breaking (Optional)
      
      No
      
      ## Use cases (Optional)
      
      Reference `GenerateEdge`.
      8dae9465
  20. Jan 10, 2023
  21. Jan 06, 2023
  22. Jan 03, 2023
  23. Jan 02, 2023
  24. Dec 30, 2022
  25. Dec 05, 2022
    • 谢昕辰's avatar
      [Feature] Support Mask2former in MMSeg 1.x (#2255) · 163277bf
      谢昕辰 authored
      
      * 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: default avatarMengzhangLI <mcmong@pku.edu.cn>
      163277bf
  26. 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
    • 谢昕辰's avatar
      [Fix] Fix the problem of post-processing not removing padding (#2367) · 925faea5
      谢昕辰 authored
      * add img_padding_size
      
      * minor change
      
      * add pad_shape to data_samples
      925faea5
  27. Nov 30, 2022
  28. Nov 24, 2022
  29. Nov 23, 2022
Loading