Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Datasets] Add Mapillary Vistas Datasets to MMSeg Core Package. #2576

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6fa3c67
Merge pull request #1 from open-mmlab/dev-1.x
AI-Tianlong Feb 2, 2023
7600cd5
Merge branch 'dev-1.x' of github.com:open-mmlab/mmsegmentation into d…
AI-Tianlong Feb 8, 2023
ee26528
add-mapillary-to-core-package
AI-Tianlong Feb 9, 2023
cd08dbf
add-mapillary-to-core-package
AI-Tianlong Feb 9, 2023
7bc71f7
add mapillary to docs/user_guides/zh_cn/2_dataset_prepare.md
AI-Tianlong Feb 9, 2023
7bc2efc
add mapillary to docs/user_guides/zh_cn/2_dataset_prepare.md
AI-Tianlong Feb 9, 2023
15c58fe
add mapillary to docs/user_guides/zh_cn/2_dataset_prepare.md
AI-Tianlong Feb 9, 2023
f7e5bc3
add mapillary to docs/user_guides/zh_cn/2_dataset_prepare.md
AI-Tianlong Feb 9, 2023
f6e7562
add mapillary to docs/user_guides/zh_cn/2_dataset_prepare.md
AI-Tianlong Feb 9, 2023
a82662f
fix _init__.py
AI-Tianlong Feb 9, 2023
7eed696
Update docs/zh_cn/user_guides/2_dataset_prepare.md
AI-Tianlong Feb 13, 2023
c0e2cb8
Update 2_dataset_prepare.md
AI-Tianlong Feb 13, 2023
0dd4adb
Update 2_dataset_prepare.md
AI-Tianlong Feb 13, 2023
70a4d91
fix configs
AI-Tianlong Feb 13, 2023
05a1b44
fix configs
AI-Tianlong Feb 13, 2023
5dcecf4
fix lint
AI-Tianlong Feb 13, 2023
3b59312
add mapillary_v1_2_65.py
AI-Tianlong Feb 24, 2023
f9b7f8a
Merge branch 'dev-1.x' of github.com:open-mmlab/mmsegmentation into A…
AI-Tianlong Feb 24, 2023
7d609d3
rename config
AI-Tianlong Mar 8, 2023
5dd068a
modify configs
AI-Tianlong Mar 9, 2023
e464e7a
add tests_dataset of mapillary
AI-Tianlong Mar 9, 2023
ee9ae33
add tests images
AI-Tianlong Mar 9, 2023
1dec29f
remove maskformer benchmark
xiexinch Mar 10, 2023
8c2e9e4
add result
xiexinch Mar 10, 2023
3df31b7
update deeplabv3plus
xiexinch Mar 13, 2023
b283fc9
update doc
xiexinch Mar 14, 2023
b270993
readme
xiexinch Mar 15, 2023
7751b78
Merge remote-tracking branch 'upstream/dev-1.x' into AI-Tianlong/add-…
xiexinch Mar 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Results and models are available in the [model zoo](docs/en/model_zoo.md).
- [x] [Potsdam](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/en/user_guides/2_dataset_prepare.md#isprs-potsdam)
- [x] [Vaihingen](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/en/user_guides/2_dataset_prepare.md#isprs-vaihingen)
- [x] [iSAID](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/en/user_guides/2_dataset_prepare.md#isaid)
- [x] [Mapillary Vistas](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/en/user_guides/2_dataset_prepare.md#mapillary-vistas-datasets)

</details>

Expand Down
1 change: 1 addition & 0 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ MMSegmentation 是一个基于 PyTorch 的语义分割开源工具箱。它是 O
- [x] [Potsdam](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/zh_cn/dataset_prepare.md#isprs-potsdam)
- [x] [Vaihingen](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/zh_cn/dataset_prepare.md#isprs-vaihingen)
- [x] [iSAID](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/zh_cn/dataset_prepare.md#isaid)
- [x] [Mapillary Vistas](https://github.com/open-mmlab/mmsegmentation/blob/1.x/docs/en/user_guides/2_dataset_prepare.md#mapillary-vistas-datasets)

</details>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# dataset settings
dataset_type = 'MapillaryDataset_v1_2'
dataset_type = 'MapillaryDataset_v1'
data_root = 'data/mapillary/'
crop_size = (512, 1024)
train_pipeline = [
Expand Down Expand Up @@ -48,8 +48,7 @@
type=dataset_type,
data_root=data_root,
data_prefix=dict(
img_path='training/images',
seg_map_path='training/v1.2/labels_mask'),
img_path='training/images', seg_map_path='training/v1.2/labels'),
pipeline=train_pipeline))
val_dataloader = dict(
batch_size=1,
Expand All @@ -61,7 +60,7 @@
data_root=data_root,
data_prefix=dict(
img_path='validation/images',
seg_map_path='validation/v1.2/labels_mask'),
seg_map_path='validation/v1.2/labels'),
pipeline=test_pipeline))
test_dataloader = val_dataloader

Expand Down
37 changes: 37 additions & 0 deletions configs/_base_/datasets/mapillary_v1_65.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# dataset settings
_base_ = './mapillary_v1.py'
metainfo = dict(
classes=('Bird', 'Ground Animal', 'Curb', 'Fence', 'Guard Rail', 'Barrier',
'Wall', 'Bike Lane', 'Crosswalk - Plain', 'Curb Cut', 'Parking',
'Pedestrian Area', 'Rail Track', 'Road', 'Service Lane',
'Sidewalk', 'Bridge', 'Building', 'Tunnel', 'Person', 'Bicyclist',
'Motorcyclist', 'Other Rider', 'Lane Marking - Crosswalk',
'Lane Marking - General', 'Mountain', 'Sand', 'Sky', 'Snow',
'Terrain', 'Vegetation', 'Water', 'Banner', 'Bench', 'Bike Rack',
'Billboard', 'Catch Basin', 'CCTV Camera', 'Fire Hydrant',
'Junction Box', 'Mailbox', 'Manhole', 'Phone Booth', 'Pothole',
'Street Light', 'Pole', 'Traffic Sign Frame', 'Utility Pole',
'Traffic Light', 'Traffic Sign (Back)', 'Traffic Sign (Front)',
'Trash Can', 'Bicycle', 'Boat', 'Bus', 'Car', 'Caravan',
'Motorcycle', 'On Rails', 'Other Vehicle', 'Trailer', 'Truck',
'Wheeled Slow', 'Car Mount', 'Ego Vehicle'),
palette=[[165, 42, 42], [0, 192, 0], [196, 196, 196], [190, 153, 153],
[180, 165, 180], [90, 120, 150], [102, 102, 156], [128, 64, 255],
[140, 140, 200], [170, 170, 170], [250, 170, 160], [96, 96, 96],
[230, 150, 140], [128, 64, 128], [110, 110, 110], [244, 35, 232],
[150, 100, 100], [70, 70, 70], [150, 120, 90], [220, 20, 60],
[255, 0, 0], [255, 0, 100], [255, 0, 200], [200, 128, 128],
[255, 255, 255], [64, 170, 64], [230, 160, 50], [70, 130, 180],
[190, 255, 255], [152, 251, 152], [107, 142, 35], [0, 170, 30],
[255, 255, 128], [250, 0, 30], [100, 140, 180], [220, 220, 220],
[220, 128, 128], [222, 40, 40], [100, 170, 30], [40, 40, 40],
[33, 33, 33], [100, 128, 160], [142, 0, 0], [70, 100, 150],
[210, 170, 100], [153, 153, 153], [128, 128, 128], [0, 0, 80],
[250, 170, 30], [192, 192, 192], [220, 220, 0], [140, 140, 20],
[119, 11, 32], [150, 0, 255], [0, 60, 100], [0, 0, 142],
[0, 0, 90], [0, 0, 230], [0, 80, 100], [128, 64, 64], [0, 0, 110],
[0, 0, 70], [0, 0, 192], [32, 32, 32], [120, 10, 10]])

train_dataloader = dict(dataset=dict(metainfo=metainfo))
val_dataloader = dict(dataset=dict(metainfo=metainfo))
test_dataloader = val_dataloader
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# dataset settings
dataset_type = 'MapillaryDataset_v2_0'
dataset_type = 'MapillaryDataset_v2'
data_root = 'data/mapillary/'
crop_size = (512, 1024)
train_pipeline = [
Expand Down Expand Up @@ -48,8 +48,7 @@
type=dataset_type,
data_root=data_root,
data_prefix=dict(
img_path='training/images',
seg_map_path='training/v2.0/labels_mask'),
img_path='training/images', seg_map_path='training/v2.0/labels'),
pipeline=train_pipeline))
val_dataloader = dict(
batch_size=1,
Expand All @@ -61,7 +60,7 @@
data_root=data_root,
data_prefix=dict(
img_path='validation/images',
seg_map_path='validation/v2.0/labels_mask'),
seg_map_path='validation/v2.0/labels'),
pipeline=test_pipeline))
test_dataloader = val_dataloader

Expand Down
25 changes: 25 additions & 0 deletions configs/_base_/schedules/schedule_240k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# optimizer
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005)
optim_wrapper = dict(type='OptimWrapper', optimizer=optimizer, clip_grad=None)
# learning policy
param_scheduler = [
dict(
type='PolyLR',
eta_min=1e-4,
power=0.9,
begin=0,
end=240000,
by_epoch=False)
]
# training schedule for 240k
train_cfg = dict(
type='IterBasedTrainLoop', max_iters=240000, val_interval=24000)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
default_hooks = dict(
timer=dict(type='IterTimerHook'),
logger=dict(type='LoggerHook', interval=50, log_metric_by_epoch=False),
param_scheduler=dict(type='ParamSchedulerHook'),
checkpoint=dict(type='CheckpointHook', by_epoch=False, interval=24000),
sampler_seed=dict(type='DistSamplerSeedHook'),
visualization=dict(type='SegVisualizationHook'))
6 changes: 6 additions & 0 deletions configs/deeplabv3plus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ Spatial pyramid pooling module or encode-decoder structure are used in deep neur
| DeepLabV3+ | R-18-D8 | 896x896 | 80000 | 6.19 | 24.81 | 61.35 | 62.61 | [config](https://github.com/open-mmlab/mmsegmentation/blob/dev-1.x/configs/deeplabv3plus/deeplabv3plus_r18-d8_4xb4-80k_isaid-896x896.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r18-d8_4x4_896x896_80k_isaid/deeplabv3plus_r18-d8_4x4_896x896_80k_isaid_20220110_180526-7059991d.pth) \| [log](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r18-d8_4x4_896x896_80k_isaid/deeplabv3plus_r18-d8_4x4_896x896_80k_isaid_20220110_180526.log.json) |
| DeepLabV3+ | R-50-D8 | 896x896 | 80000 | 21.45 | 8.42 | 67.06 | 68.02 | [config](https://github.com/open-mmlab/mmsegmentation/blob/dev-1.x/configs/deeplabv3plus/deeplabv3plus_r50-d8_4xb4-80k_isaid-896x896.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_4x4_896x896_80k_isaid/deeplabv3plus_r50-d8_4x4_896x896_80k_isaid_20220110_180526-598be439.pth) \| [log](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_4x4_896x896_80k_isaid/deeplabv3plus_r50-d8_4x4_896x896_80k_isaid_20220110_180526.log.json) |

### Mapillary Vistas v1.2

| Method | Backbone | Crop Size | Lr schd | Mem (GB) | Inf time (fps) | Device | mIoU | mIoU(ms+flip) | config | download |
| ---------- | -------- | --------- | ------: | -------- | -------------- | ------ | ----: | ------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| DeepLabV3+ | R-50-D8 | 1280x1280 | 300000 | 24.04 | 17.92 | A100 | 47.35 | - | [config](https://github.com/open-mmlab/mmsegmentation/blob/dev-1.x/configs/deeplabv3plus/deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280.py) | [model](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280/deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280_20230301_110504-655f8e43.pth) \| [log](https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280/deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280_20230301_110504.json) |

Note:

- `D-8`/`D-16` here corresponding to the output stride 8/16 setting for DeepLab series.
Expand Down
22 changes: 22 additions & 0 deletions configs/deeplabv3plus/deeplabv3plus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Collections:
- Potsdam
- Vaihingen
- iSAID
- Mapillary Vistas v1.2
Paper:
URL: https://arxiv.org/abs/1802.02611
Title: Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation
Expand Down Expand Up @@ -848,3 +849,24 @@ Models:
mIoU(ms+flip): 68.02
Config: configs/deeplabv3plus/deeplabv3plus_r50-d8_4xb4-80k_isaid-896x896.py
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_4x4_896x896_80k_isaid/deeplabv3plus_r50-d8_4x4_896x896_80k_isaid_20220110_180526-598be439.pth
- Name: deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280
In Collection: DeepLabV3+
Metadata:
backbone: R-50-D8
crop size: (1280,1280)
lr schd: 300000
inference time (ms/im):
- value: 55.8
hardware: V100
backend: PyTorch
batch size: 1
mode: FP32
resolution: (1280,1280)
Training Memory (GB): 24.04
Results:
- Task: Semantic Segmentation
Dataset: Mapillary Vistas v1.2
Metrics:
mIoU: 47.35
Config: configs/deeplabv3plus/deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280.py
Weights: https://download.openmmlab.com/mmsegmentation/v0.5/deeplabv3plus/deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280/deeplabv3plus_r50-d8_4xb2-300k_mapillay_v1_65-1280x1280_20230301_110504-655f8e43.pth
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
_base_ = [
'../_base_/models/deeplabv3plus_r50-d8.py',
'../_base_/datasets/mapillary_v1_65.py',
'../_base_/default_runtime.py',
]

crop_size = (1280, 1280)
data_preprocessor = dict(size=crop_size)
model = dict(
data_preprocessor=data_preprocessor,
pretrained='open-mmlab://resnet50_v1c',
backbone=dict(depth=50),
decode_head=dict(num_classes=65),
auxiliary_head=dict(num_classes=65))

iters = 300000
# optimizer
optimizer = dict(
type='AdamW', lr=0.0001, betas=(0.9, 0.999), weight_decay=0.0001)
# optimizer
optim_wrapper = dict(
type='OptimWrapper',
optimizer=optimizer,
clip_grad=dict(max_norm=0.01, norm_type=2),
paramwise_cfg=dict(
custom_keys={'backbone': dict(lr_mult=0.1, decay_mult=1.0)}))
param_scheduler = [
dict(
type='PolyLR',
eta_min=0,
power=0.9,
begin=0,
end=iters,
by_epoch=False)
]

# training schedule for 300k
train_cfg = dict(
type='IterBasedTrainLoop', max_iters=iters, val_interval=iters // 10)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')

default_hooks = dict(
timer=dict(type='IterTimerHook'),
logger=dict(type='LoggerHook', interval=50, log_metric_by_epoch=False),
param_scheduler=dict(type='ParamSchedulerHook'),
checkpoint=dict(
type='CheckpointHook', by_epoch=False, interval=iters // 10),
sampler_seed=dict(type='DistSamplerSeedHook'),
visualization=dict(type='SegVisualizationHook'))

train_dataloader = dict(batch_size=2)

# Default setting for scaling LR automatically
# - `enable` means enable scaling LR automatically
# or not by default.
# - `base_batch_size` = (4 GPUs) x (2 samples per GPU).
auto_scale_lr = dict(enable=False, base_batch_size=8)
74 changes: 74 additions & 0 deletions docs/en/user_guides/2_dataset_prepare.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,29 @@ mmsegmentation
│ │ │ ├── training
│ │ │ ├── validation
│ │ │ ├── test
│ ├── mapillary
│ │ ├── training
│ │ │ ├── images
│ │ │ ├── v1.2
| │ │ │ ├── instances
| │ │ │ ├── labels
| │   │   │ └── panoptic
│ │ │ ├── v2.0
| │ │ │ ├── instances
| │ │ │ ├── labels
| │ │ │ ├── panoptic
| │   │   │ └── polygons
│ │ ├── validation
│ │ │ ├── images
| │ │ ├── v1.2
| │ │ │ ├── instances
| │ │ │ ├── labels
| │   │   │ └── panoptic
│ │ │ ├── v2.0
| │ │ │ ├── instances
| │ │ │ ├── labels
| │ │ │ ├── panoptic
| │   │   │ └── polygons
```

### Cityscapes
Expand Down Expand Up @@ -551,3 +574,54 @@ The script will make directory structure below:
```

It includes 400 images for training, 400 images for validation and 400 images for testing which is the same as REFUGE 2018 dataset.

## Mapillary Vistas Datasets

- The dataset could be download [here](https://www.mapillary.com/dataset/vistas) after registration.

- Mapillary Vistas Dataset use 8-bit with color-palette to store labels. No conversion operation is required.

- Assumption you have put the dataset zip file in `mmsegmentation/data/mapillary`

- Please run the following commands to unzip dataset.

```bash
cd data/mapillary
unzip An-ZjB1Zm61yAZG0ozTymz8I8NqI4x0MrYrh26dq7kPgfu8vf9ImrdaOAVOFYbJ2pNAgUnVGBmbue9lTgdBOb5BbKXIpFs0fpYWqACbrQDChAA2fdX0zS9PcHu7fY8c-FOvyBVxPNYNFQuM.zip
```

- After unzip, you will get Mapillary Vistas Dataset like this structure. Semantic segmentation mask labels in `labels` folder.

```none
mmsegmentation
├── mmseg
├── tools
├── configs
├── data
│ ├── mapillary
│ │ ├── training
│ │ │ ├── images
│ │ │ ├── v1.2
| │ │ │ ├── instances
| │ │ │ ├── labels
| │   │   │ └── panoptic
│ │ │ ├── v2.0
| │ │ │ ├── instances
| │ │ │ ├── labels
| │ │ │ ├── panoptic
| │   │   │ └── polygons
│ │ ├── validation
│ │ │ ├── images
| │ │ ├── v1.2
| │ │ │ ├── instances
| │ │ │ ├── labels
| │   │   │ └── panoptic
│ │ │ ├── v2.0
| │ │ │ ├── instances
| │ │ │ ├── labels
| │ │ │ ├── panoptic
| │   │   │ └── polygons
```

- You could set Datasets version with `MapillaryDataset_v1` and `MapillaryDataset_v2` in your configs.
View the Mapillary Vistas Datasets config file here [V1.2](https://github.com/open-mmlab/mmsegmentation/blob/dev-1.x/configs/_base_/datasets/mapillary_v1.py) and [V2.0](https://github.com/open-mmlab/mmsegmentation/blob/dev-1.x/configs/_base_/datasets/mapillary_v2.py)
4 changes: 3 additions & 1 deletion mmseg/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .isprs import ISPRSDataset
from .lip import LIPDataset
from .loveda import LoveDADataset
from .mapillary import MapillaryDataset_v1, MapillaryDataset_v2
from .night_driving import NightDrivingDataset
from .pascal_context import PascalContextDataset, PascalContextDataset59
from .potsdam import PotsdamDataset
Expand Down Expand Up @@ -49,5 +50,6 @@
'DecathlonDataset', 'LIPDataset', 'ResizeShortestEdge',
'BioMedicalGaussianNoise', 'BioMedicalGaussianBlur',
'BioMedicalRandomGamma', 'BioMedical3DPad', 'RandomRotFlip',
'SynapseDataset', 'REFUGEDataset'
'SynapseDataset', 'REFUGEDataset', 'MapillaryDataset_v1',
'MapillaryDataset_v2'
]
Loading