Commit Graph

407 Commits (72e20a88543a4764780803a66a87d3f4897bc944)

Author SHA1 Message Date
zoulinxin 72e20a8854
[Feature] remote sensing inference (#3131)
## Motivation

Supports inference for ultra-large-scale remote sensing images.

## Modification

Add RSImageInference.py in demo.

## Use cases

Taking the inference of Vaihingen dataset images using PSPNet as an
example, the following settings are required:

**img**: Specify the path of the image.
**model**: Provide the configuration file for the model.
**checkpoint**: Specify the weight file for the model.
**out**: Set the output path for the results.
**batch_size**: Determine the batch size used during inference.
**win_size**: Specify the width and height(512x512) of the sliding
window.
**stride**: Set the stride(400x400) for sliding the window.
**thread(default: 1)**: Specify the number of threads to be used for
inference.
**Inference device (default: cuda:0)**: Specify the device for inference
(e.g., cuda:0 for CPU).

```shell
python demo/rs_image_inference.py demo/demo.png projects/pp_mobileseg/configs/pp_mobileseg/pp_mobileseg_mobilenetv3_2x16_80k_ade20k_512x512_tiny.py pp_mobileseg_mobilenetv3_2xb16_3rdparty-tiny_512x512-ade20k-a351ebf5.pth --batch-size 8 --device cpu --thread 2
```

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-08-31 12:44:46 +08:00
Peng Lu 35ff78a07f
[Feature] Support depth metrics (#3297)
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

Please describe the motivation of this PR and the goal you want to
achieve through this PR.

Support metrics for the depth estimation task, including RMSE, ABSRel,
and etc.

## Modification

Please briefly describe what modification is made in this PR.

## BC-breaking (Optional)

Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.

## Use cases (Optional)

Using the following configuration to compute depth metrics on NYU

```python
dataset_type = 'NYUDataset'
data_root = 'data/nyu'

test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(dict(type='LoadDepthAnnotation', depth_rescale_factor=1e-3)),
    dict(
        type='PackSegInputs',
        meta_keys=('img_path', 'depth_map_path', 'ori_shape', 'img_shape',
                   'pad_shape', 'scale_factor', 'flip', 'flip_direction',
                   'category_id'))
]

val_dataloader = dict(
    batch_size=1,
    num_workers=4,
    persistent_workers=True,
    sampler=dict(type='DefaultSampler', shuffle=False),
    dataset=dict(
        type=dataset_type,
        data_root=data_root,
        test_mode=True,
        data_prefix=dict(
            img_path='images/test', depth_map_path='annotations/test'),
        pipeline=test_pipeline))
test_dataloader = val_dataloader

val_evaluator = dict(type='DepthMetric', max_depth_eval=10.0, crop_type='nyu')
test_evaluator = val_evaluator
```

Example log:

![image](https://github.com/open-mmlab/mmsegmentation/assets/26127467/8101d65c-dee6-48de-916c-818659947b59)


## 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.
2023-08-31 12:02:19 +08:00
Andrey Dolgovyazov 8233e64c7e
[CodeCamp2023-526] Kullback-Leibler divergence Loss implementation (#3242)
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

It's OpenMMLab  Codecamp task.

## Modification

Implementd Kullback-Leibler divergence loss and also added tests for it.

## 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.

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-08-28 16:48:26 +08:00
Peng Lu 788b37f78f
[Feature] Support NYU depth estimation dataset (#3269)
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

Please describe the motivation of this PR and the goal you want to
achieve through this PR.

## Modification

Please briefly describe what modification is made in this PR.
1. add `NYUDataset`class
2. add script to process NYU dataset
3. add transforms for loading depth map
4. add docs & unittest

## BC-breaking (Optional)

Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.

## 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.
5. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
6. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
7. The documentation has been modified accordingly, like docstring or
example tutorials.
2023-08-17 11:39:44 +08:00
yeedrag 817c18bf2c
[Fix] Added ignore_index and one hot encoding for dice loss (#3237)
Added ignore_index param to forward(),
also implemented one hot encoding to ensure the dims of target matches
pred.

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

Please describe the motivation of this PR and the goal you want to
achieve through this PR.

Attempted to solve the problems mentioned by #3172 

## Modification

Please briefly describe what modification is made in this PR.

Added ignore_index into forward function (although the dice loss itself
does not actually take account for it for some reason).
Added _expand_onehot_labels_dice, which takes the target with shape [N,
H, W] into [N, num_classes, H, W].

## BC-breaking (Optional)

Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.

## 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.
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.

This is my first time contributing to open-source code, so I might have
made some stupid mistakes. Please don't hesitate to point it out.
2023-08-09 10:16:22 +08:00
angiecao 4927b0ed03
[Fix] Fix module PascalContextDataset (#3235)
## Motivation

- 'PascalContextDataset' object has no attribute 'file_client', it will
cause an error.
- The attribute ‘ann_file’ is not allowed to be empty, otherwise, an
error will be reported.

## Modification
- Replace file_client with fileio
2023-08-09 10:15:50 +08:00
CastleDream 1235217667
[CodeCamp2023-154] Add semantic label to the segmentation visualization results (#3229)
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

[Add semantic label to the segmentation visualization results
分割可视化结果中加上语义信息
#154](https://github.com/open-mmlab/OpenMMLabCamp/discussions/154)

corresponding issue: [跑出来结果之后怎么在结果图片上获取各个语意部分的区域信息?
#2578](https://github.com/open-mmlab/mmsegmentation/issues/2578)

## Modification

1. mmseg/apis/inference.py, add withLabels in visualizer.add_datasample
call, to indicate whether add semantic label
2. mmseg/visualization/local_visualizer.py, add semantic labels by
opencv; modify the demo comment description
3. mmseg/utils/__init__.py, add bdd100k datasets to test
local_visualizer.py

**Current visualize result**
<img width="637" alt="image"
src="https://github.com/open-mmlab/mmsegmentation/assets/35064479/6ef6ce02-1d82-46f8-bde9-a1d69ff62df8">


**Add semantic label**
<img width="637" alt="image"
src="https://github.com/open-mmlab/mmsegmentation/assets/35064479/00716679-b43a-4794-8499-9bfecdb4b78b">

## Test results
**tests/test_visualization/test_local_visualizer.py** test
results:(MMSegmentation/tests/data/pseudo_cityscapes_dataset/leftImg8bit/val/frankfurt/frankfurt_000000_000294_leftImg8bit.png)
<img width="643" alt="image"
src="https://github.com/open-mmlab/mmsegmentation/assets/35064479/6792b7d2-2512-4ea9-8500-1a7ed2d5e0dc">

**demo/inference_demo.ipynb** test results:
<img width="966" alt="image"
src="https://github.com/open-mmlab/mmsegmentation/assets/35064479/dfc0147e-fb1a-490a-b6ff-a8b209352d9b">

-----
## Drawbacks
config opencv thickness according to image size
<img width="496" alt="image"
src="https://github.com/open-mmlab/mmsegmentation/assets/35064479/0a54d72c-62b1-422c-89ae-69dc753fe0fc">

I have no idea of dealing with label overlapping for the time being
2023-08-01 14:38:33 +08:00
谢昕辰 30a3f94f3e
bumpv1.1.1 (#3223) 2023-07-24 15:28:21 +08:00
谢昕辰 857f854b61
[Enhancement] Remove batch inference assertion (#3210)
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

https://github.com/open-mmlab/mmsegmentation/issues/3181
https://github.com/open-mmlab/mmsegmentation/issues/2965
https://github.com/open-mmlab/mmsegmentation/issues/2644
https://github.com/open-mmlab/mmsegmentation/issues/1645
https://github.com/open-mmlab/mmsegmentation/issues/1444
https://github.com/open-mmlab/mmsegmentation/issues/1370
https://github.com/open-mmlab/mmsegmentation/issues/125

## Modification

Remove the assertion at data_preprocessor

## BC-breaking (Optional)

Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.

## 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.
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.
2023-07-20 09:45:04 +08:00
Hongyuan Zhang 20fa12912f
[Fix] Albumentations default key mapping mismatch (#3195)
## Modification

Fix Albumentations default key mapping mismatch as mentioned in [issue #
3179](https://github.com/open-mmlab/mmsegmentation/issues/3179) by
changing `self.keymap_to_albu = { 'img': 'image', 'gt_masks': 'masks'}`
to `self.keymap_to_albu = { 'img': 'image', 'gt_seg_map': 'mask'}`

## Use cases (Optional)

Example albu config
```
crop_size = (512, 512)

albu_train_transforms = [
    dict(
        type='PadIfNeeded',
        min_height=crop_size[0]*2,
        min_width=crop_size[1]*2,
        border_mode=0,
        always_apply=True),
    dict(type='Flip', always_apply=True),
    dict(type='Rotate', limit=(-180, 180), interpolation=4, always_apply=True),
    dict(type='RandomScale', scale_limit=0.1, interpolation=4, always_apply=True),
    dict(
        type='ElasticTransform',
        alpha=20, 
        sigma=15, 
        interpolation=4, 
        border_mode=0,
        mask_value=(0, 0, 0),
        approximate=True,
        same_dxdy=True,
        p=0.8),
    dict(type='ColorJitter', brightness=0.2, contrast=0.1, saturation=0.2, hue=0.2, always_apply=True),
    dict(type='AdvancedBlur', p=0.5),
    dict(type='CenterCrop', height=crop_size[0], width=crop_size[1], always_apply=True)
]
```

Example training pipeline without specifying `keymap`
```
train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='LoadAnnotations', reduce_zero_label=False),
    dict(
        type='Albu',
        transforms=albu_train_transforms,
        ),
    dict(type='Resize', scale=crop_size, keep_ratio=False, interpolation='lanczos'), 
    dict(type='PackSegInputs')
]
```

Example viz_dataset before the issue fixing
![A thaliana Lucia 07 2022 col-0 30m-1h after Infection 22162057 object
id
0](https://github.com/open-mmlab/mmsegmentation/assets/66273343/5431472a-83fd-485f-aeb7-c65f27f1993d)

Example viz_dataset after the issue fixing
![A thaliana Lucia 07 2022 col-0 30m-1h after Infection 22162057 object
id
0](https://github.com/open-mmlab/mmsegmentation/assets/66273343/3d6d4937-41f0-4a18-ae47-35bc43d78843)

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-07-14 12:44:03 +08:00
CastleDream 057155d3ab
[Feature] add bdd100K datasets (#3158)
## Motivation
Integrate [BDD100K](https://paperswithcode.com/dataset/bdd100k) dataset.
It shares the same classes as Cityscapes, and it's commonly used for
evaluating segmentation/detection tasks in driving scenes, such as in
[RobustNet](https://arxiv.org/abs/2103.15597),
[WildNet](https://github.com/suhyeonlee/WildNet).

Enhancement for Add BDD100K Dataset #2808

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-07-14 10:09:16 +08:00
ZiAn-Su 7254f5330f
[Fix] Fix SegTTAModel with no attribute '_gt_sem_seg' error (#3152)
## Motivation

When using the - tta command for multi-scale prediction, and the test
set is not annotated, although format_only has been set true in
test_evaluator, but SegTTAModel class still threw error 'AttributeError:
'SegDataSample' object has no attribute '_gt_sem_seg''.

## Modification

The reason is SegTTAModel didn't determine if there were annotations in
the dataset, so I added the code to make the judgment and let the
program run normally on my computer.
2023-07-13 17:06:06 +08:00
谢昕辰 e4c1865a82
Bump1.1 (#3140)
Co-authored-by: CSH <40987381+csatsurnh@users.noreply.github.com>
2023-07-04 11:11:30 +08:00
谢昕辰 8806b4e548
[Fix] Fix visualizor (#3154)
## Motivation

**Current visualize result**


![rs-dev](https://github.com/open-mmlab/mmsegmentation/assets/15952744/147ea3f7-f632-457b-b257-031199320825)

**Fixed the visualization result**



![rs-fix](https://github.com/open-mmlab/mmsegmentation/assets/15952744/98a86025-5a1e-4c2b-83e0-653dd659ba79)


## Modification

remove mmengine `draw_binary_masks` api
2023-07-03 09:43:00 +08:00
谢昕辰 b8b6ee6017
fix assert (#3119) 2023-06-19 18:34:52 +08:00
Leon Hamnett b0635ff783
[Enhancement] Change assertion logic inference cfg.model.test_cfg (#3012)
## Motivation

In encode_decoder.py , assertion logic is not working correctly if user
modifes cfg.test_cfg and defines it in a dictionary format. See:
https://github.com/open-mmlab/mmsegmentation/issues/3011

## Modification

Slight change to assertion behaviour to change assertion depending on if
received test_cfg object is a dict or not.

## BC-breaking (Optional)

Unsure - I believe this will not break any downstream tasks as the
previous logic is still included

## Use cases (Optional)

n/a

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-06-19 18:12:04 +08:00
jinxianwei bb93b482b8
[Feature] huasdorff distance loss (#2820)
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

Add Huasdorff distance loss

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-06-19 14:26:08 +08:00
WRH c30d5060f1
[Fix] Robust mapping from image path to seg map path (#3091)
## Motivation

Suppose an image is named `jpg.jpg` and its corresponding segmap is
named `jpg.png`.
The original implementation will try to read segmap from `png.png` and
causes FileNotfoundError

## Modification

Only replace the suffix, instead of full string search and replacement. 

## BC-breaking (Optional)

Probably no. 

## Use cases (Optional)


## 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.

---------

Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
Co-authored-by: CSH <40987381+csatsurnh@users.noreply.github.com>
2023-06-16 11:07:17 +08:00
Xu CAO 279b89783e
[Feature] enhance swin pretrained model loading (#3097)
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

Enhance pretrained SwinTransformer loading when setting non-standard
backbone `depths`.

## Modification

Enhance pretrained SwinTransformer loading when setting non-standard
backbone `depths`.

## BC-breaking (Optional)

Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.

## 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.
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.

---------

Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>
2023-06-16 10:43:34 +08:00
nightrain01 13e42cc2ae
[Fix] Fix bug cannot use both '--tta' and '--out' while testing. (#3067)
## Motivation

Fix bug cannot use both '--tta' and '--out' while testing.
For details, please refer to #3064 .

## Modification

Add 'img_path' in TTA predictions.

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-06-06 16:39:41 +08:00
CSH 2f257ab160
[Refactor] Refactor dice loss (#3002) 2023-05-15 14:20:42 +08:00
haruishi b83a498d6b
[Feature] Prevent passed `ann_file` from silently failing to load (#2966)
## Motivation

While customizing the number of samples using `ann_file` for Cityscapes,
I noticed that when the `ann_file` name is incorrect, it will silently
resort to loading the dataset from the directory.
I think when the user intends to load using `ann_file`, it should not
silently fail, but give some sort of error message or warning.

## Modification

I added assertion to check whether the `ann_file` exists instead of
silently resorting to loading from the directory.
Since `ann_file` is set to `''` by default and joined with
`self.data_root`, I used `osp.isdir` to first check if `self.ann_dir` is
a directory or text file.

## BC-breaking (Optional)

Not that I am aware of.

## Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases
here, and update the documentation.


---------

Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
Co-authored-by: CSH <40987381+csatsurnh@users.noreply.github.com>
2023-05-12 16:28:30 +08:00
WuFan b89c2c4cb7
[Feature] Support DSDL Dataset (#2925)
- support dsdl seg dataset 
- add dsdl dataset citest
- validated accuracy on voc2012 and cityscapes
2023-05-10 16:54:42 +08:00
zoulinxin 77591b9e7b
[Feature] Add GDAL backend and Support LEVIR-CD Dataset (#2903)
## 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: xiexinch <xiexinch@outlook.com>
2023-05-08 20:09:33 +08:00
ZhangYiqin 227ced4a90
[Doc] Fix a tiny mis-Arg in BaseDecodeHead class (#2970) 2023-05-05 11:27:58 +08:00
Pan Zhang 990063e59b
[Feature] Support DDRNet (#2855)
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

Support DDRNet
Paper: [Deep Dual-resolution Networks for Real-time and Accurate
Semantic Segmentation of Road Scenes](https://arxiv.org/pdf/2101.06085)
official Code: https://github.com/ydhongHIT/DDRNet


There is already a PR
https://github.com/open-mmlab/mmsegmentation/pull/1722 , but it has been
inactive for a long time.

## Current Result

### Cityscapes

#### inference with converted official weights

| Method | Backbone      | mIoU(official) | mIoU(converted weight) |
| ------ | ------------- | -------------- | ---------------------- |
| DDRNet | DDRNet23-slim | 77.8           | 77.84                  |
| DDRNet | DDRNet23 | 79.5 | 79.53 |

#### training with converted pretrained backbone

| Method | Backbone | Crop Size | Lr schd | Inf time(fps) | Device |
mIoU | mIoU(ms+flip) | config | download |
| ------ | ------------- | --------- | ------- | ------- | -------- |
----- | ------------- | ------------ | ------------ |
| DDRNet | DDRNet23-slim | 1024x1024 | 120000 | 85.85 | RTX 8000 | 77.85
| 79.80 |
[config](https://github.com/whu-pzhang/mmsegmentation/blob/ddrnet/configs/ddrnet/ddrnet_23-slim_in1k-pre_2xb6-120k_cityscapes-1024x1024.py)
| model \| log |
| DDRNet | DDRNet23 | 1024x1024 | 120000 | 33.41 | RTX 8000 | 79.53 |
80.98 |
[config](https://github.com/whu-pzhang/mmsegmentation/blob/ddrnet/configs/ddrnet/ddrnet_23_in1k-pre_2xb6-120k_cityscapes-1024x1024.py)
| model \| log |


The converted pretrained backbone weights download link:

1.
[ddrnet23s_in1k_mmseg.pth](https://drive.google.com/file/d/1Ni4F1PMGGjuld-1S9fzDTmneLfpMuPTG/view?usp=sharing)
2.
[ddrnet23_in1k_mmseg.pth](https://drive.google.com/file/d/11rsijC1xOWB6B0LgNQkAG-W6e1OdbCyJ/view?usp=sharing)

## To do

- [x] support inference with converted official weights
- [x] support training on cityscapes dataset

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-04-27 09:44:30 +08:00
谢昕辰 7ff58d7074
[Feature] Support albu transform (#2943)
## Motivation


3a14c35974/mmseg/datasets/pipelines/transforms.py (L1348)

## Modification

Add albu to dev-1.x
2023-04-24 13:44:20 +08:00
Julius Zhang 60a542cc66
[Fix] fix squeeze error when N=1 and C=1 (#2933)
## Motivation

fix squeeze error when N=1 and C=1

## Modification

fix squeeze error when N=1 and C=1
2023-04-23 15:12:40 +08:00
CSH 04f7ec60d8
[Fix] Fix binary C=1 focal loss & dataset fileio (#2935) 2023-04-23 15:02:18 +08:00
李开宇 4371ba5db6
[Fix] Fix bugs when out_channels==1 (#2911) 2023-04-18 18:26:59 +08:00
Junhwa Song ced29fcaf8
[Refactor] Handle case where device is neither CPU nor CUDA in HamHead (#2868) 2023-04-14 10:12:49 +08:00
谢昕辰 892f9e19e7
bumpv1.0.0 (#2849) 2023-04-06 17:24:57 +08:00
谢昕辰 4dc4ed9650
[Fix] Remove locations of not exists modules in the registry (#2829)
## Motivation

If the module does not actually exist, setting locations will report an
error.

https://github.com/open-mmlab/mmengine/pull/1010

## Modification

mmseg/registry/registry.py
2023-04-03 17:29:53 +08:00
谢昕辰 c448646a92
[Doc] Refine doc and fix links (#2821)
## Motivation

- Create the `main` branch

## Modification

Modify links from `dev-1.x` to `main`
2023-03-31 16:26:30 +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
MengzhangLI ff8d971988
[Feature] Support SegNeXt in MMSegmentation 2.0 (#2654)
## Motivation

Support SegNeXt in MMSeg 1.x branch.

0.x PR: https://github.com/open-mmlab/mmsegmentation/pull/2600

---------

Co-authored-by: xiexinch <xiexinch@outlook.com>
2023-03-16 16:49:15 +08:00
Junhwa Song cb2d8fe085
[Enhance] Support multi-band image for Mosaic (#2748)
## 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.
2023-03-15 19:36:47 +08:00
Miao Zheng 3cc7ae2167
[Fix] Format shape check (#2753)
as title
2023-03-15 17:49:59 +08:00
谢昕辰 dd47cef801
[Feature] Support PIDNet (#2609)
## 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
2023-03-15 14:55:30 +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
Junhwa Song 447a398c24
[Typo] Change indexes to indices (#2747)
## Modification

I just replaced the `indexes` variable name with `indices` for naming
consistency.
2023-03-14 23:56:40 +08:00
Miao Zheng 6ba4696648
[Enhancement] Support input gt seg map is not 2D (#2739)
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: xiexinch <xiexinch@outlook.com>
2023-03-14 23:14:41 +08:00
Miao Zheng a8aafdd902
[Fix] Support format_result and fix prefix param in cityscape metric, and rename CitysMetric to CityscapesMetric (#2660)
as title
2023-03-07 17:57:37 +08:00
谢昕辰 779b86cd74
bump v1.0.0rc6 (#2647)
as title
2023-03-03 16:54:12 +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
谢昕辰 19f92851f5
[Fix] Add out_channels in `CascadeEncoderDecoder` and update OCRNet and MobileNet v2 results (#2656)
## Motivation

As title.

## Modification

1. update results in readme
2. fix attr error in cascade encoder decoder
2023-02-28 15:57:43 +08:00
谢昕辰 53fe1ccf39
[Feature] Support MMSegInferencer (#2413)
## Motivation

Support `MMSegInferencer` for providing an easy and clean interface for
single or multiple images inferencing.

Ref: https://github.com/open-mmlab/mmengine/pull/773
https://github.com/open-mmlab/mmocr/pull/1608

## Modification

- mmseg/apis/mmseg_inferencer.py
- mmseg/visualization/local_visualizer.py
- demo/image_demo_with_inferencer.py

## Use cases (Optional)

Based on https://github.com/open-mmlab/mmengine/tree/inference

Add a new image inference demo with `MMSegInferencer`

- demo/image_demo_with_inferencer.py

```shell
python demo/image_demo_with_inferencer.py demo/demo.png fcn_r50-d8_4xb2-40k_cityscapes-512x1024
```

---------

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-02-23 21:16:19 +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
谢昕辰 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
CSH 2e27f8b678
[Enhancement]Replace numpy ascontiguousarray with torch contiguous to speed-up (#2604)
## Motivation

Original motivation was after [MMDetection PR
#9533](https://github.com/open-mmlab/mmdetection/pull/9533)

With several experiments I found out that if a ndarray is contiguous,
numpy.transpose + torch.contiguous perform better, while if not, then
use numpy.ascontiguousarray + numpy.transpose

## Modification

Replace numpy.ascontiguousarray with torch.contiguous in
[PackSegInputs](https://github.com/open-mmlab/mmsegmentation/blob/1.x/mmseg/datasets/transforms/formatting.py)

Co-authored-by: MeowZheng <meowzheng@outlook.com>
2023-02-15 19:02:00 +08:00