The official MSCOCO API is hard to use for me.
This script creates images for semantic/instance segmentation, object detection and image caption.
clone the official API
git clone https://github.com/rkuga/MSCOCO.git
cd MSCOCO
git clone https://github.com/pdollar/coco.git
make init.py
vim coco/__init__.py
vim coco/PythonAPI/__init__.py
download the dataset
your data_dir is
yourpath|---annotations
|---train2014
|---val2014
for instance segmentations
python coco.py --data_dir yourpath --data_type train --mode instances
for semantic segmentations
python coco.py --data_dir yourpath --data_type train --mode semantics
with categorical images
for bounding boxs
python coco.py --data_dir yourpath --data_type train --mode bboxs
Bbox's color means its object class
for captions
python coco.py --data_dir yourpath --data_type train --mode captions
instances mode takes so much time.