Matting Datasets¶
It is recommended to symlink the dataset root to $MMEDITING/data
. If your folder structure is different, you may need to change the corresponding paths in config files.
MMEditing supported matting datasets:
Composition-1k Dataset¶
Introduction¶
[DATASET]
@inproceedings{xu2017deep,
title={Deep image matting},
author={Xu, Ning and Price, Brian and Cohen, Scott and Huang, Thomas},
booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
pages={2970--2979},
year={2017}
}
The Adobe Composition-1k dataset consists of foreground images and their corresponding alpha images. To get the full dataset, one need to composite the foregrounds with selected backgrounds from the COCO dataset and the Pascal VOC dataset.
Obtain and Extract¶
Please follow the instructions of paper authors to obtain the Composition-1k (comp1k) dataset.
Composite the full dataset¶
The Adobe composition-1k dataset contains only alpha
and fg
(and trimap
in test set).
It is needed to merge fg
with COCO data (training) or VOC data (test) before training or evaluation.
Use the following script to perform image composition and generate annotation files for training or testing:
## The script is run under the root folder of MMEditing
python tools/data/matting/comp1k/preprocess_comp1k_dataset.py data/adobe_composition-1k data/coco data/VOCdevkit --composite
The generated data is stored under adobe_composition-1k/Training_set
and adobe_composition-1k/Test_set
respectively.
If you only want to composite test data (since compositing training data is time-consuming), you can skip compositing the training set by removing the --composite
option:
## skip compositing training set
python tools/data/matting/comp1k/preprocess_comp1k_dataset.py data/adobe_composition-1k data/coco data/VOCdevkit
Currently, only
GCA
supports online composition of training data. But you can modify the data pipeline of other models to perform online composition instead of loading composited images (we called itmerged
in our data pipeline).
Check Directory Structure¶
The result folder structure should look like:
mmediting
├── mmedit
├── tools
├── configs
├── data
│ ├── adobe_composition-1k
│ │ ├── Test_set
│ │ │ ├── Adobe-licensed images
│ │ │ │ ├── alpha
│ │ │ │ ├── fg
│ │ │ │ ├── trimaps
│ │ │ ├── merged (generated by tools/data/matting/comp1k/preprocess_comp1k_dataset.py)
│ │ │ ├── bg (generated by tools/data/matting/comp1k/preprocess_comp1k_dataset.py)
│ │ ├── Training_set
│ │ │ ├── Adobe-licensed images
│ │ │ │ ├── alpha
│ │ │ │ ├── fg
│ │ │ ├── Other
│ │ │ │ ├── alpha
│ │ │ │ ├── fg
│ │ │ ├── merged (generated by tools/data/matting/comp1k/preprocess_comp1k_dataset.py)
│ │ │ ├── bg (generated by tools/data/matting/comp1k/preprocess_comp1k_dataset.py)
│ ├── coco
│ │ ├── train2014 (or train2017)
│ ├── VOCdevkit
│ │ ├── VOC2012