Skip to content

Commit a2738fd

Browse files
yamengxixvjiarui
andauthored
Add Pascal Context to mmsegmentation (open-mmlab#133)
* Add Pascal Context to mmsegmentation * Add benchmark result to Pascal Context * fix mmcv version * fix code syntax * fix code syntax again * Update mmseg/models/segmentors/encoder_decoder.py update hint Co-authored-by: Jerry Jiarui XU <[email protected]> * update comment * fix pascal context model path * fix model path mistake again * fix model path mistake again * fix model path mistakes again Co-authored-by: Jerry Jiarui XU <[email protected]>
1 parent 768c3ee commit a2738fd

34 files changed

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

configs/deeplabv3/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ Note: `D-8` here corresponding to the output stride 8 setting for DeepLab series
4141
| DeepLabV3 | R-101-D8 | 512x512 | 20000 | 9.6 | 9.81 | 78.70 | 79.95 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r101-d8_512x512_20k_voc12aug/deeplabv3_r101-d8_512x512_20k_voc12aug_20200617_010932-8d13832f.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r101-d8_512x512_20k_voc12aug/deeplabv3_r101-d8_512x512_20k_voc12aug_20200617_010932.log.json) |
4242
| DeepLabV3 | R-50-D8 | 512x512 | 40000 | - | - | 77.68 | 78.78 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r50-d8_512x512_40k_voc12aug/deeplabv3_r50-d8_512x512_40k_voc12aug_20200613_161546-2ae96e7e.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r50-d8_512x512_40k_voc12aug/deeplabv3_r50-d8_512x512_40k_voc12aug_20200613_161546.log.json) |
4343
| DeepLabV3 | R-101-D8 | 512x512 | 40000 | - | - | 77.92 | 79.18 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r101-d8_512x512_40k_voc12aug/deeplabv3_r101-d8_512x512_40k_voc12aug_20200613_161432-0017d784.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r101-d8_512x512_40k_voc12aug/deeplabv3_r101-d8_512x512_40k_voc12aug_20200613_161432.log.json) |
44+
45+
### Pascal Context
46+
| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | mIoU | mIoU(ms+flip) | download |
47+
|-----------|----------|-----------|--------:|----------|----------------|------:|--------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
48+
| DeepLabV3 | R-101-D8 | 480x480 | 40000 | 9.2 | 7.09 | 46.55 | 47.81 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r101-d8_480x480_40k_pascal_context/deeplabv3_r101-d8_480x480_40k_pascal_context_20200911_204118-1aa27336.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r101-d8_480x480_40k_pascal_context/deeplabv3_r101-d8_480x480_40k_pascal_context-20200911_204118.log.json) |
49+
| DeepLabV3 | R-101-D8 | 480x480 | 80000 | - | - | 46.42 | 47.53 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r101-d8_480x480_80k_pascal_context/deeplabv3_r101-d8_480x480_80k_pascal_context_20200911_170155-2a21fff3.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3/deeplabv3_r101-d8_480x480_80k_pascal_context/deeplabv3_r101-d8_480x480_80k_pascal_context-20200911_170155.log.json) |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './deeplabv3_r50-d8_480x480_40k_pascal_context.py'
2+
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './deeplabv3_r50-d8_480x480_80k_pascal_context.py'
2+
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
_base_ = [
2+
'../_base_/models/deeplabv3_r50-d8.py',
3+
'../_base_/datasets/pascal_context.py', '../_base_/default_runtime.py',
4+
'../_base_/schedules/schedule_40k.py'
5+
]
6+
model = dict(
7+
decode_head=dict(num_classes=60), auxiliary_head=dict(num_classes=60))
8+
test_cfg = dict(mode='slide', crop_size=(480, 480), stride=(320, 320))
9+
optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
_base_ = [
2+
'../_base_/models/deeplabv3_r50-d8.py',
3+
'../_base_/datasets/pascal_context.py', '../_base_/default_runtime.py',
4+
'../_base_/schedules/schedule_80k.py'
5+
]
6+
model = dict(
7+
decode_head=dict(num_classes=60), auxiliary_head=dict(num_classes=60))
8+
test_cfg = dict(mode='slide', crop_size=(480, 480), stride=(320, 320))
9+
optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001)

configs/deeplabv3plus/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ Note: `D-8` here corresponding to the output stride 8 setting for DeepLab series
4141
| DeepLabV3+ | R-101-D8 | 512x512 | 20000 | 11 | 13.88 | 77.22 | 78.59 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_512x512_20k_voc12aug/deeplabv3plus_r101-d8_512x512_20k_voc12aug_20200617_102345-c7ff3d56.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_512x512_20k_voc12aug/deeplabv3plus_r101-d8_512x512_20k_voc12aug_20200617_102345.log.json) |
4242
| DeepLabV3+ | R-50-D8 | 512x512 | 40000 | - | - | 76.81 | 77.57 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_512x512_40k_voc12aug/deeplabv3plus_r50-d8_512x512_40k_voc12aug_20200613_161759-e1b43aa9.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_512x512_40k_voc12aug/deeplabv3plus_r50-d8_512x512_40k_voc12aug_20200613_161759.log.json) |
4343
| DeepLabV3+ | R-101-D8 | 512x512 | 40000 | - | - | 78.62 | 79.53 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_512x512_40k_voc12aug/deeplabv3plus_r101-d8_512x512_40k_voc12aug_20200613_205333-faf03387.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_512x512_40k_voc12aug/deeplabv3plus_r101-d8_512x512_40k_voc12aug_20200613_205333.log.json) |
44+
45+
#### Pascal Context
46+
| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | mIoU | mIoU(ms+flip) | download |
47+
|------------|----------|-----------|--------:|----------|----------------|------:|--------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
48+
| DeepLabV3+ | R-101-D8 | 480x480 | 40000 | - | 9.09 | 47.30 | 48.47 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_40k_pascal_context/deeplabv3plus_r101-d8_480x480_40k_pascal_context_20200911_165459-d3c8a29e.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_40k_pascal_context/deeplabv3plus_r101-d8_480x480_40k_pascal_context-20200911_165459.log.json) |
49+
| DeepLabV3+ | R-101-D8 | 480x480 | 80000 | - | - | 47.23 | 48.26 | [model](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_80k_pascal_context/deeplabv3plus_r101-d8_480x480_80k_pascal_context_20200911_155322-145d3ee8.pth) &#124; [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r101-d8_480x480_80k_pascal_context/deeplabv3plus_r101-d8_480x480_80k_pascal_context-20200911_155322.log.json) |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './deeplabv3plus_r50-d8_480x480_40k_pascal_context.py'
2+
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_base_ = './deeplabv3plus_r50-d8_480x480_80k_pascal_context.py'
2+
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
_base_ = [
2+
'../_base_/models/deeplabv3plus_r50-d8.py',
3+
'../_base_/datasets/pascal_context.py', '../_base_/default_runtime.py',
4+
'../_base_/schedules/schedule_40k.py'
5+
]
6+
model = dict(
7+
decode_head=dict(num_classes=60), auxiliary_head=dict(num_classes=60))
8+
test_cfg = dict(mode='slide', crop_size=(480, 480), stride=(320, 320))
9+
optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001)

0 commit comments

Comments
 (0)