Skip to content

Commit 2bd7f60

Browse files
Junjue-WangMengzhangLIJunjun2016
authored
[Feature] Support LoveDA dataset (open-mmlab#1028)
* update LoveDA dataset api * revised lint errors in dataset_prepare.md * revised lint errors in loveda.py * revised lint errors in loveda.py * revised lint errors in dataset_prepare.md * revised lint errors in dataset_prepare.md * checked with isort and yapf * checked with isort and yapf * checked with isort and yapf * Revert "checked with isort and yapf" This reverts commit 686a51d * Revert "checked with isort and yapf" This reverts commit b877e12. * Revert "revised lint errors in dataset_prepare.md" This reverts commit 2289e27 * Revert "checked with isort and yapf" This reverts commit 159db2f * Revert "checked with isort and yapf" This reverts commit 159db2f * add configs & fix bugs * update new branch * upload models&logs and add format-only * change pretraied model path of HRNet * fix the errors in dataset_prepare.md * fix the errors in dataset_prepare.md and configs in loveda.py * change the description in docs_zh-CN/dataset_prepare.md * use init_cfg * fix test converage * adding pseudo loveda dataset * adding pseudo loveda dataset * adding pseudo loveda dataset * adding pseudo loveda dataset * adding pseudo loveda dataset * adding pseudo loveda dataset * Update docs/dataset_prepare.md Co-authored-by: Junjun2016 <[email protected]> * Update docs_zh-CN/dataset_prepare.md Co-authored-by: Junjun2016 <[email protected]> * Update docs_zh-CN/dataset_prepare.md Co-authored-by: Junjun2016 <[email protected]> * Delete unused lines of unittest and Add docs * add convert .py file * add downloading links from zenodo * move place of LoveDA and Cityscapes in doc * move place of LoveDA and Cityscapes in doc Co-authored-by: MengzhangLI <[email protected]> Co-authored-by: Junjun2016 <[email protected]>
1 parent 6070a0e commit 2bd7f60

32 files changed

+670
-18
lines changed

configs/_base_/datasets/loveda.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# dataset settings
2+
dataset_type = 'LoveDADataset'
3+
data_root = 'data/loveDA'
4+
img_norm_cfg = dict(
5+
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
6+
crop_size = (512, 512)
7+
train_pipeline = [
8+
dict(type='LoadImageFromFile'),
9+
dict(type='LoadAnnotations', reduce_zero_label=True),
10+
dict(type='Resize', img_scale=(2048, 512), ratio_range=(0.5, 2.0)),
11+
dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75),
12+
dict(type='RandomFlip', prob=0.5),
13+
dict(type='PhotoMetricDistortion'),
14+
dict(type='Normalize', **img_norm_cfg),
15+
dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255),
16+
dict(type='DefaultFormatBundle'),
17+
dict(type='Collect', keys=['img', 'gt_semantic_seg']),
18+
]
19+
test_pipeline = [
20+
dict(type='LoadImageFromFile'),
21+
dict(
22+
type='MultiScaleFlipAug',
23+
img_scale=(1024, 1024),
24+
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
25+
flip=False,
26+
transforms=[
27+
dict(type='Resize', keep_ratio=True),
28+
dict(type='RandomFlip'),
29+
dict(type='Normalize', **img_norm_cfg),
30+
dict(type='ImageToTensor', keys=['img']),
31+
dict(type='Collect', keys=['img']),
32+
])
33+
]
34+
data = dict(
35+
samples_per_gpu=4,
36+
workers_per_gpu=4,
37+
train=dict(
38+
type=dataset_type,
39+
data_root=data_root,
40+
img_dir='img_dir/train',
41+
ann_dir='ann_dir/train',
42+
pipeline=train_pipeline),
43+
val=dict(
44+
type=dataset_type,
45+
data_root=data_root,
46+
img_dir='img_dir/val',
47+
ann_dir='ann_dir/val',
48+
pipeline=test_pipeline),
49+
test=dict(
50+
type=dataset_type,
51+
data_root=data_root,
52+
img_dir='img_dir/val',
53+
ann_dir='ann_dir/val',
54+
pipeline=test_pipeline))

configs/deeplabv3plus/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@
8585
| DeepLabV3+ | R-101-D8 | 480x480 | 40000 | - | - | 52.86 | 54.54 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/deeplabv3plus/deeplabv3plus_r101-d8_480x480_40k_pascal_context_59.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_40k_pascal_context_59/deeplabv3plus_r101-d8_480x480_40k_pascal_context_59_20210416_111233-ed937f15.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_40k_pascal_context_59/deeplabv3plus_r101-d8_480x480_40k_pascal_context_59-20210416_111233.log.json) |
8686
| DeepLabV3+ | R-101-D8 | 480x480 | 80000 | - | - | 53.2 | 54.67 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/deeplabv3plus/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59_20210416_111127-7ca0331d.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59-20210416_111127.log.json) |
8787

88+
#### LoveDA
89+
90+
| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | mIoU | mIoU(ms+flip) | config | download |
91+
| ---------- | -------- | --------- | ------: | -------- | -------------- | ----: | ------------: | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
92+
| DeepLabV3+ | R-18-D8 | 512x512 | 80000 | 1.93 | 25.57 | 50.28 | 50.47 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/deeplabv3plus/deeplabv3plus_r18-d8_512x512_80k_loveda.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r18-d8_512x512_80k_loveda/deeplabv3plus_r18-d8_512x512_80k_loveda_20211104_132800-ce0fa0ca.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r18-d8_512x512_80k_loveda/deeplabv3plus_r18-d8_512x512_80k_loveda_20211104_132800.log.json) |
93+
| DeepLabV3+ | R-50-D8 | 512x512 | 80000 | 7.37 | 6.00 | 50.99 | 50.65 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/deeplabv3plus/deeplabv3plus_r50-d8_512x512_80k_loveda.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_512x512_80k_loveda/deeplabv3plus_r50-d8_512x512_80k_loveda_20211105_080442-f0720392.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_512x512_80k_loveda/deeplabv3plus_r50-d8_512x512_80k_loveda_20211105_080442.log.json) |
94+
| DeepLabV3+ | R-101-D8 | 512x512 | 80000 | 10.84 | 4.33 | 51.47 | 51.32 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/deeplabv3plus/deeplabv3plus_r101-d8_512x512_80k_loveda.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_512x512_80k_loveda/deeplabv3plus_r101-d8_512x512_80k_loveda_20211105_110759-4c1f297e.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_512x512_80k_loveda/deeplabv3plus_r101-d8_512x512_80k_loveda_20211105_110759.log.json) |
95+
8896
Note:
8997

9098
- `FP16` means Mixed Precision (FP16) is adopted in training.

configs/deeplabv3plus/deeplabv3plus.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,3 +599,69 @@ Models:
599599
mIoU(ms+flip): 54.67
600600
Config: configs/deeplabv3plus/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59.py
601601
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59/deeplabv3plus_r101-d8_480x480_80k_pascal_context_59_20210416_111127-7ca0331d.pth
602+
- Name: deeplabv3plus_r18-d8_512x512_80k_loveda
603+
In Collection: deeplabv3plus
604+
Metadata:
605+
backbone: R-18-D8
606+
crop size: (512,512)
607+
lr schd: 80000
608+
inference time (ms/im):
609+
- value: 39.11
610+
hardware: V100
611+
backend: PyTorch
612+
batch size: 1
613+
mode: FP32
614+
resolution: (512,512)
615+
memory (GB): 1.93
616+
Results:
617+
- Task: Semantic Segmentation
618+
Dataset: ADE20K
619+
Metrics:
620+
mIoU: 50.28
621+
mIoU(ms+flip): 50.47
622+
Config: configs/deeplabv3plus/deeplabv3plus_r18-d8_512x512_80k_loveda.py
623+
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r18-d8_512x512_80k_loveda/deeplabv3plus_r18-d8_512x512_80k_loveda_20211104_132800-ce0fa0ca.pth
624+
- Name: deeplabv3plus_r50-d8_512x512_80k_loveda
625+
In Collection: deeplabv3plus
626+
Metadata:
627+
backbone: R-50-D8
628+
crop size: (512,512)
629+
lr schd: 80000
630+
inference time (ms/im):
631+
- value: 166.67
632+
hardware: V100
633+
backend: PyTorch
634+
batch size: 1
635+
mode: FP32
636+
resolution: (512,512)
637+
memory (GB): 7.37
638+
Results:
639+
- Task: Semantic Segmentation
640+
Dataset: ADE20K
641+
Metrics:
642+
mIoU: 50.99
643+
mIoU(ms+flip): 50.65
644+
Config: configs/deeplabv3plus/deeplabv3plus_r50-d8_512x512_80k_loveda.py
645+
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_512x512_80k_loveda/deeplabv3plus_r50-d8_512x512_80k_loveda_20211105_080442-f0720392.pth
646+
- Name: deeplabv3plus_r101-d8_512x512_80k_loveda
647+
In Collection: deeplabv3plus
648+
Metadata:
649+
backbone: R-101-D8
650+
crop size: (512,512)
651+
lr schd: 80000
652+
inference time (ms/im):
653+
- value: 230.95
654+
hardware: V100
655+
backend: PyTorch
656+
batch size: 1
657+
mode: FP32
658+
resolution: (512,512)
659+
memory (GB): 10.84
660+
Results:
661+
- Task: Semantic Segmentation
662+
Dataset: ADE20K
663+
Metrics:
664+
mIoU: 51.47
665+
mIoU(ms+flip): 51.32
666+
Config: configs/deeplabv3plus/deeplabv3plus_r101-d8_512x512_80k_loveda.py
667+
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_512x512_80k_loveda/deeplabv3plus_r101-d8_512x512_80k_loveda_20211105_110759-4c1f297e.pth
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_base_ = './deeplabv3plus_r50-d8_512x512_80k_loveda.py'
2+
model = dict(
3+
backbone=dict(
4+
depth=101,
5+
init_cfg=dict(
6+
type='Pretrained', checkpoint='open-mmlab://resnet101_v1c')))
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
_base_ = './deeplabv3plus_r50-d8_512x512_80k_loveda.py'
2+
model = dict(
3+
backbone=dict(
4+
depth=18,
5+
init_cfg=dict(
6+
type='Pretrained', checkpoint='open-mmlab://resnet18_v1c')),
7+
decode_head=dict(
8+
c1_in_channels=64,
9+
c1_channels=12,
10+
in_channels=512,
11+
channels=128,
12+
),
13+
auxiliary_head=dict(in_channels=256, channels=64))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_base_ = [
2+
'../_base_/models/deeplabv3plus_r50-d8.py', '../_base_/datasets/loveda.py',
3+
'../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'
4+
]
5+
model = dict(
6+
decode_head=dict(num_classes=7), auxiliary_head=dict(num_classes=7))

configs/hrnet/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,11 @@
7373
| ------ | ------------ | --------- | ------: | -------- | -------------- | ----: | ------------: | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7474
| FCN | HRNetV2p-W48 | 480x480 | 40000 | - | - | 50.33 | 52.83 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/hrnet/fcn_hr48_480x480_40k_pascal_context_59.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr48_480x480_40k_pascal_context_59/fcn_hr48_480x480_40k_pascal_context_59_20210410_122738-b808b8b2.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr48_480x480_40k_pascal_context_59/fcn_hr48_480x480_40k_pascal_context_59-20210410_122738.log.json) |
7575
| FCN | HRNetV2p-W48 | 480x480 | 80000 | - | - | 51.12 | 53.56 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/hrnet/fcn_hr48_480x480_80k_pascal_context_59.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr48_480x480_80k_pascal_context_59/fcn_hr48_480x480_80k_pascal_context_59_20210411_003240-3ae7081e.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr48_480x480_80k_pascal_context_59/fcn_hr48_480x480_80k_pascal_context_59-20210411_003240.log.json) |
76+
77+
#### LoveDA
78+
79+
| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | mIoU | mIoU(ms+flip) | config | download |
80+
| ---------- | -------- | --------- | ------: | -------- | -------------- | ----: | ------------: | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
81+
| FCN | HRNetV2p-W18-Small | 512x512 | 80000 | 1.72 | 30.07 | 49.3 | 49.23 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/hrnet/fcn_hr18s_512x512_80k_loveda.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr18s_512x512_80k_loveda/fcn_hr18s_512x512_80k_loveda_20211105_180825-41dcc5dc.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr18s_512x512_80k_loveda/fcn_hr18s_512x512_80k_loveda_20211105_180825.log.json) |
82+
| FCN | HRNetV2p-W18 | 512x512 | 80000 | 2.90 | 16.77 | 50.87 | 51.24 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/hrnet/fcn_hr18_512x512_80k_loveda.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr18_512x512_80k_loveda/fcn_hr18_512x512_80k_loveda_20211105_165542-95be4d2b.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr18_512x512_80k_loveda/fcn_hr18_512x512_80k_loveda_20211105_165542.log.json) |
83+
| FCN | HRNetV2p-W48 | 512x512 | 80000 | 6.25 | 9.09 | 51.04 | 51.12 | [config](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/hrnet/fcn_hr48_512x512_80k_loveda.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr48_512x512_80k_loveda/fcn_hr48_512x512_80k_loveda_20211105_131509-f07e47c6.pth) &#124; [log](https://download.openmmlab.com/mmsegmentation/v0.5/hrnet/fcn_hr48_512x512_80k_loveda/fcn_hr48_512x512_80k_loveda_20211105_131509.log.json) |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
_base_ = [
2+
'../_base_/models/fcn_hr18.py', '../_base_/datasets/loveda.py',
3+
'../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'
4+
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
_base_ = './fcn_hr18_512x512_80k_loveda.py'
2+
model = dict(
3+
backbone=dict(
4+
init_cfg=dict(
5+
type='Pretrained',
6+
checkpoint='open-mmlab://msra/hrnetv2_w18_small'),
7+
extra=dict(
8+
stage1=dict(num_blocks=(2, )),
9+
stage2=dict(num_blocks=(2, 2)),
10+
stage3=dict(num_modules=3, num_blocks=(2, 2, 2)),
11+
stage4=dict(num_modules=2, num_blocks=(2, 2, 2, 2)))))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
_base_ = './fcn_hr18_512x512_80k_loveda.py'
2+
model = dict(
3+
backbone=dict(
4+
init_cfg=dict(
5+
type='Pretrained', checkpoint='open-mmlab://msra/hrnetv2_w48'),
6+
extra=dict(
7+
stage2=dict(num_channels=(48, 96)),
8+
stage3=dict(num_channels=(48, 96, 192)),
9+
stage4=dict(num_channels=(48, 96, 192, 384)))),
10+
decode_head=dict(
11+
in_channels=[48, 96, 192, 384], channels=sum([48, 96, 192, 384])))

0 commit comments

Comments
 (0)