-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 <[email protected]>
- Loading branch information
1 parent
7254f53
commit 057155d
Showing
33 changed files
with
518 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# dataset settings | ||
dataset_type = 'BDD100KDataset' | ||
data_root = 'data/bdd100k/' | ||
|
||
crop_size = (512, 1024) | ||
train_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict(type='LoadAnnotations'), | ||
dict( | ||
type='RandomResize', | ||
scale=(2048, 1024), | ||
ratio_range=(0.5, 2.0), | ||
keep_ratio=True), | ||
dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75), | ||
dict(type='RandomFlip', prob=0.5), | ||
dict(type='PhotoMetricDistortion'), | ||
dict(type='PackSegInputs') | ||
] | ||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict(type='Resize', scale=(2048, 1024), keep_ratio=True), | ||
# add loading annotation after ``Resize`` because ground truth | ||
# does not need to do resize data transform | ||
dict(type='LoadAnnotations'), | ||
dict(type='PackSegInputs') | ||
] | ||
img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] | ||
tta_pipeline = [ | ||
dict(type='LoadImageFromFile', backend_args=None), | ||
dict( | ||
type='TestTimeAug', | ||
transforms=[ | ||
[ | ||
dict(type='Resize', scale_factor=r, keep_ratio=True) | ||
for r in img_ratios | ||
], | ||
[ | ||
dict(type='RandomFlip', prob=0., direction='horizontal'), | ||
dict(type='RandomFlip', prob=1., direction='horizontal') | ||
], [dict(type='LoadAnnotations')], [dict(type='PackSegInputs')] | ||
]) | ||
] | ||
train_dataloader = dict( | ||
batch_size=2, | ||
num_workers=2, | ||
persistent_workers=True, | ||
sampler=dict(type='InfiniteSampler', shuffle=True), | ||
dataset=dict( | ||
type=dataset_type, | ||
data_root=data_root, | ||
data_prefix=dict( | ||
img_path='images/10k/train', | ||
seg_map_path='labels/sem_seg/masks/train'), | ||
pipeline=train_pipeline)) | ||
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, | ||
data_prefix=dict( | ||
img_path='images/10k/val', | ||
seg_map_path='labels/sem_seg/masks/val'), | ||
pipeline=test_pipeline)) | ||
test_dataloader = val_dataloader | ||
|
||
val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) | ||
test_evaluator = val_evaluator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
|
||
from mmseg.datasets.basesegdataset import BaseSegDataset | ||
from mmseg.registry import DATASETS | ||
|
||
|
||
@DATASETS.register_module() | ||
class BDD100KDataset(BaseSegDataset): | ||
METAINFO = dict( | ||
classes=('road', 'sidewalk', 'building', 'wall', 'fence', 'pole', | ||
'traffic light', 'traffic sign', 'vegetation', 'terrain', | ||
'sky', 'person', 'rider', 'car', 'truck', 'bus', 'train', | ||
'motorcycle', 'bicycle'), | ||
palette=[[128, 64, 128], [244, 35, 232], [70, 70, 70], [102, 102, 156], | ||
[190, 153, 153], [153, 153, 153], [250, 170, | ||
30], [220, 220, 0], | ||
[107, 142, 35], [152, 251, 152], [70, 130, 180], | ||
[220, 20, 60], [255, 0, 0], [0, 0, 142], [0, 0, 70], | ||
[0, 60, 100], [0, 80, 100], [0, 0, 230], [119, 11, 32]]) | ||
|
||
def __init__(self, | ||
img_suffix='.jpg', | ||
seg_map_suffix='.png', | ||
reduce_zero_label=False, | ||
**kwargs) -> None: | ||
super().__init__( | ||
img_suffix=img_suffix, | ||
seg_map_suffix=seg_map_suffix, | ||
reduce_zero_label=reduce_zero_label, | ||
**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# BDD100K Dataset | ||
|
||
Support **`BDD100K Dataset`** | ||
|
||
## Description | ||
|
||
Author: CastleDream | ||
|
||
This project implements **`BDD100K Dataset`** | ||
|
||
### Dataset preparing | ||
|
||
Preparing `BDD100K Dataset` dataset following [BDD100K Dataset Preparing Guide](https://github.com/open-mmlab/mmsegmentation/tree/main/projects/mapillary_dataset/docs/en/user_guides/2_dataset_prepare.md#bdd100k) | ||
|
||
```none | ||
mmsegmentation/data | ||
└── bdd100k | ||
├── images | ||
│ └── 10k | ||
│ ├── test [2000 entries exceeds filelimit, not opening dir] | ||
│ ├── train [7000 entries exceeds filelimit, not opening dir] | ||
│ └── val [1000 entries exceeds filelimit, not opening dir] | ||
└── labels | ||
└── sem_seg | ||
├── colormaps | ||
│ ├── train [7000 entries exceeds filelimit, not opening dir] | ||
│ └── val [1000 entries exceeds filelimit, not opening dir] | ||
├── masks | ||
│ ├── train [7000 entries exceeds filelimit, not opening dir] | ||
│ └── val [1000 entries exceeds filelimit, not opening dir] | ||
├── polygons | ||
│ ├── sem_seg_train.json | ||
│ └── sem_seg_val.json | ||
└── rles | ||
├── sem_seg_train.json | ||
└── sem_seg_val.json | ||
``` | ||
|
||
### Training commands | ||
|
||
```bash | ||
%cd mmsegmentation | ||
!python tools/train.py projects/bdd100k_dataset/configs/pspnet_r50-d8_4xb2-80k_bdd100k-512x1024.py\ | ||
--work-dir your_work_dir | ||
``` | ||
|
||
## Thanks | ||
|
||
- [\[Datasets\] Add Mapillary Vistas Datasets to MMSeg Core Package. #2576](https://github.com/open-mmlab/mmsegmentation/pull/2576/files) | ||
- [\[Feature\] Support CIHP dataset #1493](https://github.com/open-mmlab/mmsegmentation/pull/1493/files) |
Oops, something went wrong.