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

support coco stuff-10k/164k #625

Merged
merged 49 commits into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
282f3c8
support coco stuff-10k/164k
DerrickWang005 Jun 22, 2021
e7fe11c
update docs
DerrickWang005 Jun 22, 2021
16790e3
fix docs
DerrickWang005 Jun 23, 2021
0a0552c
update docs
DerrickWang005 Jun 23, 2021
1454fb4
fix import lints
DerrickWang005 Jun 23, 2021
663a202
Update docs/dataset_prepare.md
Junjun2016 Jul 5, 2021
5ca18e1
Update docs/dataset_prepare.md
Junjun2016 Jul 5, 2021
410dc29
Update tools/convert_datasets/coco_stuff164k.py
Junjun2016 Jul 5, 2021
fb2c2be
Update tools/convert_datasets/coco_stuff10k.py
Junjun2016 Jul 5, 2021
c94d809
Update tools/convert_datasets/coco_stuff10k.py
Junjun2016 Jul 5, 2021
6b91c06
Update tools/convert_datasets/coco_stuff10k.py
Junjun2016 Jul 5, 2021
370b917
Update tools/convert_datasets/coco_stuff10k.py
Junjun2016 Jul 5, 2021
41cca53
Update coco_stuff.py
DerrickWang005 Jul 5, 2021
68060de
Update dataset_prepare.md
DerrickWang005 Jul 5, 2021
acac3c5
Update coco_stuff10k.py
DerrickWang005 Jul 5, 2021
d0292df
Update coco_stuff.py
DerrickWang005 Jul 5, 2021
a2e4b73
Update coco_stuff164k.py
DerrickWang005 Jul 5, 2021
c9f6a15
Update coco_stuff10k.py
DerrickWang005 Jul 5, 2021
a74f5eb
Update coco_stuff.py
DerrickWang005 Jul 5, 2021
afdf78e
Update dataset_prepare.md
DerrickWang005 Jul 5, 2021
0df1188
Merge branch 'coco-stuff' of github.com:DerrickWang005/mmsegmentation…
Junjun2016 Jul 5, 2021
7b29ad9
Update dataset_prepare.md
DerrickWang005 Jul 5, 2021
154049e
Merge branch 'coco-stuff' of github.com:DerrickWang005/mmsegmentation…
Junjun2016 Jul 5, 2021
f646c69
Merge branch 'open-mmlab:master' into coco-stuff
DerrickWang005 Jul 5, 2021
c99bda4
Merge branch 'master' of https://github.com/open-mmlab/mmsegmentation…
Junjun2016 Jul 6, 2021
728863d
modify coco stuff convertor
Junjun2016 Jul 6, 2021
500cbfe
Merge branch 'coco-stuff' of github.com:DerrickWang005/mmsegmentation…
Junjun2016 Jul 6, 2021
112f807
Remove redundant code
Junjun2016 Jul 6, 2021
f65f828
fix 164k convert bug
Junjun2016 Jul 6, 2021
aba1107
remove redundant comment
Junjun2016 Jul 6, 2021
54748fc
add deeplabv3 configs and more iterations
Junjun2016 Jul 6, 2021
b98882c
replace shutil.move with shtil.copyfile
Junjun2016 Jul 6, 2021
b8556b8
Update deeplabv3_r50-d8_512x512_4x4_80k_coco_stuff10k.py
Junjun2016 Jul 6, 2021
fc6572d
Update deeplabv3_r101-d8_512x512_4x4_80k_coco_stuff164k.py
Junjun2016 Jul 6, 2021
8e43c52
Merge branch 'coco-stuff' of https://github.com/DerrickWang005/mmsegm…
Junjun2016 Jul 6, 2021
5946215
fix wrong configs
Junjun2016 Jul 6, 2021
61188ae
fix wrong configs
Junjun2016 Jul 6, 2021
f2b6baa
fix wrong path for coco stuff 10k
Junjun2016 Jul 7, 2021
63196df
fix convert bugs
Junjun2016 Jul 7, 2021
eab4c06
fix seg_filename bug
DerrickWang005 Jul 7, 2021
adadc33
when nproc=0, use track progress
Junjun2016 Jul 7, 2021
963ccb5
rename configs: coco_stuff --> coco-stuff
Junjun2016 Sep 14, 2021
c612014
merge master
Junjun2016 Sep 14, 2021
e4e8d7f
add coco-stuff 10k and 164k to README.md
Junjun2016 Sep 17, 2021
dcd7fb1
update configs
Junjun2016 Sep 17, 2021
281548c
Merge branch 'master' of https://github.com/open-mmlab/mmsegmentation…
Junjun2016 Sep 17, 2021
345e2e7
add deeplabv3 benchmark
Junjun2016 Sep 17, 2021
53c282a
add pspnet benchmark
Junjun2016 Sep 17, 2021
186161e
remove redundant comma
Junjun2016 Sep 22, 2021
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
Next Next commit
support coco stuff-10k/164k
  • Loading branch information
DerrickWang005 committed Jun 22, 2021
commit 282f3c834e8470a05b0250c0302a28437f8933b7
57 changes: 57 additions & 0 deletions configs/_base_/datasets/coco_stuff10k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# dataset settings
dataset_type = 'COCOStuffDataset'
data_root = 'data/coco_stuff10k'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
crop_size = (512, 512)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', reduce_zero_label=True),
dict(type='Resize', img_scale=(2048, 512), ratio_range=(0.5, 2.0)),
dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75),
dict(type='RandomFlip', prob=0.5),
dict(type='PhotoMetricDistortion'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_semantic_seg']),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(2048, 512),
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
])
]
data = dict(
samples_per_gpu=4,
workers_per_gpu=4,
train=dict(
type=dataset_type,
data_root=data_root,
reduce_zero_label=True,
img_dir='images/train2014',
ann_dir='masks/train2014',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_root=data_root,
reduce_zero_label=True,
img_dir='images/test2014',
ann_dir='masks/test2014',
pipeline=test_pipeline),
test=dict(
type=dataset_type,
data_root=data_root,
reduce_zero_label=True,
img_dir='images/test2014',
ann_dir='masks/test2014',
pipeline=test_pipeline))
54 changes: 54 additions & 0 deletions configs/_base_/datasets/coco_stuff164k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# dataset settings
dataset_type = 'COCOStuffDataset'
data_root = 'data/coco_stuff164k'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
crop_size = (512, 512)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations'),
dict(type='Resize', img_scale=(2048, 512), ratio_range=(0.5, 2.0)),
dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75),
dict(type='RandomFlip', prob=0.5),
dict(type='PhotoMetricDistortion'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_semantic_seg']),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(2048, 512),
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
])
]
data = dict(
samples_per_gpu=4,
workers_per_gpu=4,
train=dict(
type=dataset_type,
data_root=data_root,
img_dir='images/train2017',
ann_dir='masks/train2017',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_root=data_root,
img_dir='images/val2017',
ann_dir='masks/val2017',
pipeline=test_pipeline),
test=dict(
type=dataset_type,
data_root=data_root,
img_dir='images/val2017',
ann_dir='masks/val2017',
pipeline=test_pipeline))
2 changes: 2 additions & 0 deletions configs/pspnet/pspnet_r101-d8_512x512_80k_coco-stuff10k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_base_ = './pspnet_r50-d8_512x512_80k_coco-stuff10k.py'
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
2 changes: 2 additions & 0 deletions configs/pspnet/pspnet_r101-d8_512x512_80k_coco-stuff164k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_base_ = './pspnet_r50-d8_512x512_80k_coco-stuff164k.py'
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
6 changes: 6 additions & 0 deletions configs/pspnet/pspnet_r50-d8_512x512_80k_coco-stuff10k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_base_ = [
'../_base_/models/pspnet_r50-d8.py', '../_base_/datasets/coco_stuff10k.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'
]
model = dict(
decode_head=dict(num_classes=171), auxiliary_head=dict(num_classes=171))
8 changes: 8 additions & 0 deletions configs/pspnet/pspnet_r50-d8_512x512_80k_coco-stuff164k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_base_ = [
'../_base_/models/pspnet_r50-d8.py',
'../_base_/datasets/coco_stuff164k.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_80k.py'
]
model = dict(
decode_head=dict(num_classes=171), auxiliary_head=dict(num_classes=171))
70 changes: 70 additions & 0 deletions docs/dataset_prepare.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ mmsegmentation
│ │ │ ├── images
│ │ │ │ ├── training
│ │ │ │ ├── validation
│ ├── coco_stuff10k
│ │ ├── images
│ │ │ ├── train2014
│ │ │ ├── test2014
│ │ ├── masks
│ │ │ ├── train2014
│ │ │ ├── test2014
│ │ ├── annotations
│ │ ├── imagesLists
│ │ │ ├── train.txt
│ │ │ ├── test.txt
│ │ │ ├── all.txt
│ ├── coco_stuff164k
│ │ ├── images
│ │ │ ├── train2017
│ │ │ ├── val2017
│ │ ├── masks
│ │ │ ├── train2017
│ │ │ ├── val2017
│ │ ├── annotations
│ │ │ ├── train2017
│ │ │ ├── val2017
│ ├── CHASE_DB1
│ │ ├── images
│ │ │ ├── training
Expand Down Expand Up @@ -85,6 +107,54 @@ to generate `**labelTrainIds.png`.
python tools/convert_datasets/cityscapes.py data/cityscapes --nproc 8
```

### COCO Stuff 10k

The data could be downloaded [here](http://calvin.inf.ed.ac.uk/wp-content/uploads/data/cocostuffdataset/cocostuff-10k-v1.1.zip) by wget.

If you would like to use COCO Stuff 10k dataset, please run following command to convert augmentation annotations into proper format.

```shell
# --nproc means 8 process for conversion, which could be omitted as well.
python tools/convert_datasets/coco_stuff10k.py data/coco_stuff10k --nproc 8
```

By convention, masks in `data/coco_stuff10k/masks/*.png` are used for COCO Stuff 10k training and testing.


### COCO Stuff 164k

The data could be downloaded and converted augmentation annotations into proper format. by following command.

```shell
cd data

# create file
mkdir -p coco_stuff164k
cd coco_stuff164k

# Download everything
wget --directory-prefix=downloads http://images.cocodataset.org/zips/train2017.zip
wget --directory-prefix=downloads http://images.cocodataset.org/zips/val2017.zip
wget --directory-prefix=downloads http://calvin.inf.ed.ac.uk/wp-content/uploads/data/cocostuffdataset/stuffthingmaps_trainval2017.zip

# Unpack everything
mkdir -p images
mkdir -p annotations
unzip downloads/train2017.zip -d images/
unzip downloads/val2017.zip -d images/
unzip downloads/stuffthingmaps_trainval2017.zip -d annotations/

cd ../..

# --nproc means 8 process for conversion, which could be omitted as well.
python tools/convert_datasets/coco_stuff164k.py data/coco_stuff164k --nproc 8
```

By convention, masks in `data/coco_stuff164k/masks/*.png` are used for COCO Stuff 164k training and testing.

The details of this dataset could be found at [here](https://github.com/nightrome/cocostuff#downloads).


### Pascal VOC

Pascal VOC 2012 could be downloaded from [here](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar).
Expand Down
3 changes: 2 additions & 1 deletion mmseg/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
from .pascal_context import PascalContextDataset, PascalContextDataset59
from .stare import STAREDataset
from .voc import PascalVOCDataset
from .coco_stuff import COCOStuffDataset

__all__ = [
'CustomDataset', 'build_dataloader', 'ConcatDataset', 'RepeatDataset',
'DATASETS', 'build_dataset', 'PIPELINES', 'CityscapesDataset',
'PascalVOCDataset', 'ADE20KDataset', 'PascalContextDataset',
'PascalContextDataset59', 'ChaseDB1Dataset', 'DRIVEDataset', 'HRFDataset',
'STAREDataset'
'STAREDataset', 'COCOStuffDataset'
]
Loading