Prepare Dataset ๐
March 21, 2024 ยท View on GitHub
This guide outlines the datasets required for opensource fine-tuning of GLaMM, which encompasses tasks like Grounded Conversation Generation (GCG), Image-level captioning, Visual-question answering, Region-level captioning, and Referring Expression Segmentation. These datasets are used for fine-tuning to achieve the model demonstrated in our demo. We will also highlight the specific datasets needed for each task.
To achieve all the capabilities of GLaMM, the following dataset types are used:
- GranD-f Grounded Conversation Generation (GCG) Dataset
- Semantic Segmentation Datasets
- Referring Expression Datasets (Expression Comprehension)
- Region-level Captioning Datasets (Expression Generation)
- Image Captioning
- Visual Question Answering
- GranD pretraining Datasets
Overall, they must be arranged in the following format:
โโโ GranDf
โ โโโ annotations
โ โ โโโ train
โ โ โ โโโ GranDf_HA_GCG_train.json
โ โ โ โโโ OpenPsgGCG_train.json
โ โ โ โโโ OpenPsgGCG_val.json
โ โ โ โโโ RefCOCOg_GCG_train.json
โ โ โ โโโ RefCOCOg_GCG_val.json
โ โ โ โโโ flickr_mergedGT_GCG_train.json
โ โ โ โโโ flickr_mergedGT_GCG_val.json
โ โ โโโ val_test
โ โ โ โโโ test_gcg_coco_caption_gt.json
โ โ โ โโโ test_gcg_coco_mask_gt.json
โ โ โ โโโ val_gcg_coco_caption_gt.json
โ โ โ โโโ val_gcg_coco_mask_gt.json
โโโ GranDf_HA_images
โ โโโ train
โ โ โโโ sa_10010541.jpg
โ โ โโโ sa_10014079.jpg
โ โโโ val_test
โ โ โโโ sa_10010541.jpg
โ โ โโโ sa_10014079.jpg
โ
โโโ Semantic_Segm
โ โโโ ade20k
โ โ โโโ annotations
โ โ โ โโโ training
โ โ โ โ โโโ ADE_train_00000001.png
โ โ โ โ โโโ ADE_train_00000002.png
โ โ โโโ images
โ โ โ โโโ training
โ โ โ โ โโโ ADE_train_00000001.jpg
โ โ โ โ โโโ ADE_train_00000002.jpg
โโโ coco_stuff
โ โ โโโ train2017
โ โ โ โโโ 000000000009.png
โ โ โ โโโ 000000000025.png
โโโ mapillary
โ โ โโโ config_v2.0.json
โ โ โโโ training
โ โ โ โโโ v2.0
โ โ โ โ โโโ labels
โ โ โ โ โ โโโ 0035fkbjWljhaftpVM37-g.png
โ โ โ โ โ โโโ 00qclUcInksIYnm19b1Xfw.png
โ โ โ โโโ images
โ โ โ โ โโโ 0035fkbjWljhaftpVM37-g.jpg
โ โ โ โ โโโ 00qclUcInksIYnm19b1Xfw.jpg
โโโ paco_lvis
โ โ โโโ annotations
โ โ โ โโโ paco_lvis_v1_train.json
โโโ pascal_part
โ โ โโโ train.json
โ โ โโโ VOCdevkit
โ โ โ โ โโโ VOC2010
โ โ โ โ โ โโโ JPEGImages
โ โ โ โ โ โ โโโ 2007_000027.jpg
โ โ โ โ โ โ โโโ 2007_000032.jpg
โ
โโโ Refer_Segm
โ โโโ refcoco
โ โโโ refcoco+
โ โโโ refcocog
โ โโโ refclef
โ โโโ images
โ โ โโโ saiapr_tc-12
โ โ โ โโโ 00
โ โ โ โโโ 01
โ
โโโ RefCoco_Reg
โ โโโ mdetr_annotations
โ โ โโโ finetune_refcoco_train.json
โ โ โโโ finetune_refcocog_train.json
โ โ โโโ finetune_refcocog_val.json
โ โ โโโ finetune_refcoco+_train.json
โ โ โโโ final_flickr_mergedGT_train.json
โโโ visual_genome
โ โ โโโ test_caption.json
โ โ โโโ train.json
โ โ โโโ images
โ โ โ โโโ 1000.jpg
โ โ โ โโโ 1001.jpg
โ
โโโ llava_dataset
โ โโโ llava_instruct_150k.json
โ
โโโ coco_2017
โ โโโ train2017
โ โ โโโ 000000000009.jpg
โ โ โโโ 000000000025.jpg
โ โโโ annotations
โ โ โโโ captions_train2017.json
โ โ โโโ captions_val2017.json
โ
โโโ coco_2014
โ โโโ train2014
โ โ โโโ COCO_train2014_000000000009.jpg
โ โ โโโ COCO_train2014_000000000025.jpg
โ
โโโ flikcr_30k
โ โโโ train
โ โ โโโ 1000092795.jpg
โ โ โโโ 10002456.jpg
1) GranD-f Grounded Conversation Generation (GCG) Dataset
The GranD-f datasets comprise four datasets: one high-quality human-annotated set proposed in our GLaMM paper, and 3 other datasets repurposed for the GCG task.
Download links and structure:
- Annotations: MBZUAI/GranD-f
- Images:
GranDf_HA_imagesDownload - Other necessary datasets:
- Open-PSG GCG:
coco_2017- COCO-2017 (train2017) - RefCOCO-g GCG:
coco_2014- COCO-2014 (train2014) - Flickr-30k GCG:
flikcr_30k- flikcr_30k (train) - Download the train images from the Flickr30K webpage or use download from the following link.
- Open-PSG GCG:
โโโ GranDf
โ โโโ annotations
โ โ โโโ train
โ โ โ โโโ GranDf_HA_GCG_train.json
โ โ โ โโโ OpenPsgGCG_train.json
โ โ โ โโโ OpenPsgGCG_val.json
โ โ โ โโโ RefCOCOg_GCG_train.json
โ โ โ โโโ RefCOCOg_GCG_val.json
โ โ โ โโโ flickr_mergedGT_GCG_train.json
โ โ โ โโโ flickr_mergedGT_GCG_val.json
โ โ โโโ val_test
โ โ โ โโโ test_gcg_coco_caption_gt.json
โ โ โ โโโ test_gcg_coco_mask_gt.json
โ โ โ โโโ val_gcg_coco_caption_gt.json
โ โ โ โโโ val_gcg_coco_mask_gt.json
โโโ GranDf_HA_images
โ โโโ train
โ โ โโโ sa_10010541.jpg
โ โ โโโ sa_10014079.jpg
โ โโโ val_test
โ โ โโโ sa_10010541.jpg
โ โ โโโ sa_10014079.jpg
โโโ coco_2017
โ โโโ train2017
โ โ โโโ 000000000009.jpg
โ โ โโโ 000000000025.jpg
โโโ coco_2014
โ โโโ train2014
โ โ โโโ COCO_train2014_000000000009.jpg
โ โ โโโ COCO_train2014_000000000025.jpg
โโโ flikcr_30k
โ โโโ train
โ โ โโโ 1000092795.jpg
โ โ โโโ 10002456.jpg
2) Semantic Segmentation Datasets
For semantic segmentation, we use five open-source datasets providing segmentation masks and semantic class labels: - ADE20K, COCO-Stuff, PASCAL-Part, PACO-LVIS, and Mapillary.
Download links and structure:
- ADE20K
- COCO-Stuff
- PASCAL-Part
- PACO-LVIS
- Mapillary
- COCO images:
coco_2017- COCO-2017 (train2017)
Download and arrange as shown in the directory structure below.
โโโ Semantic_Segm
โ โโโ ade20k
โ โ โโโ annotations
โ โ โ โโโ training
โ โ โ โ โโโ ADE_train_00000001.png
โ โ โ โ โโโ ADE_train_00000002.png
โ โ โโโ images
โ โ โ โโโ training
โ โ โ โ โโโ ADE_train_00000001.jpg
โ โ โ โ โโโ ADE_train_00000002.jpg
โโโ coco_stuff
โ โ โโโ train2017
โ โ โ โโโ 000000000009.png
โ โ โ โโโ 000000000025.png
โโโ mapillary
โ โ โโโ config_v2.0.json
โ โ โโโ training
โ โ โ โโโ v2.0
โ โ โ โ โโโ labels
โ โ โ โ โ โโโ 0035fkbjWljhaftpVM37-g.png
โ โ โ โ โ โโโ 00qclUcInksIYnm19b1Xfw.png
โ โ โ โโโ images
โ โ โ โ โโโ 0035fkbjWljhaftpVM37-g.jpg
โ โ โ โ โโโ 00qclUcInksIYnm19b1Xfw.jpg
โโโ paco_lvis
โ โ โโโ annotations
โ โ โ โโโ paco_lvis_v1_train.json
โโโ pascal_part
โ โ โโโ train.json
โ โ โโโ VOCdevkit
โ โ โ โ โโโ VOC2010
โ โ โ โ โ โโโ JPEGImages
โ โ โ โ โ โ โโโ 2007_000027.jpg
โ โ โ โ โ โ โโโ 2007_000032.jpg
โโโ coco_2017
โ โโโ train2017
โ โ โโโ 000000000009.jpg
โ โ โโโ 000000000025.jpg
3) Referring Expression Datasets
For Referring Expression segmentation - we use COCO referring expression comprehension datasets: RefCOCO, RefCOCO+, RefCOCOg, and RefCLEF.
Download links and structure:
- RefCOCO
- RefCOCO+
- RefCOCOg
- RefCLEF
- RefCOCO images:
coco_2014- COCO-2014 (train2014) - For RefCLEF, you need images
[saiapr_tc-12](https://web.archive.org/web/20220515000000/http://bvisionweb1.cs.unc.edu/licheng/referit/data/images/saiapr_tc-12.zip)
Download the data from the source links, and arrange as follows:
โโโ Refer_Segm
โ โโโ refcoco
โ โโโ refcoco+
โ โโโ refcocog
โ โโโ refclef
โ โโโ images
โ โ โโโ saiapr_tc-12
โ โ โ โโโ 00
โ โ โ โโโ 01
โโโ coco_2014
โ โโโ train2014
โ โ โโโ COCO_train2014_000000000009.jpg
โ โ โโโ COCO_train2014_000000000025.jpg
4) Region-level Captioning Datasets (Expression Generation)
For region-level captioning, we use five open source datasets with region(bbox) grounding: RefCOCO, RefCOCOg, RefCOCO+, Visual Genome(V1.2) and Flickr30K.
Download links and structure:
- Annotations - mdetr_annotations: Download
- Visual Genome: train.json, test_caption.json images
- Flickr30k: Download the train images from the Flickr30K webpage or use download from the following link.
- RefCOCO images:
coco_2014- COCO-2014 (train2014) Download the data from the source links, and arrange as follows:
โโโ RefCoco_Reg
โ โโโ mdetr_annotations
โ โ โโโ finetune_refcoco_train.json
โ โ โโโ finetune_refcocog_train.json
โ โ โโโ finetune_refcocog_val.json
โ โ โโโ finetune_refcoco+_train.json
โ โ โโโ final_flickr_mergedGT_train.json
โโโ visual_genome
โ โ โโโ test_caption.json
โ โ โโโ train.json
โ โ โโโ images
โ โ โ โโโ 1000.jpg
โ โ โ โโโ 1001.jpg
โโโ flikcr_30k
โ โโโ train
โ โ โโโ 1000092795.jpg
โ โ โโโ 10002456.jpg
โโโ coco_2014
โ โโโ train2014
โ โ โโโ COCO_train2014_000000000009.jpg
โ โ โโโ COCO_train2014_000000000025.jpg
5) Image Captioning
We use the COCO caption dataset.
Download links and structure:
- Annotations - COCO - 2017 annotations
- Images:
coco_2017- COCO-2017 (train2017)
Structure as shown in the directory structure above.
โโโ coco_2017
โ โโโ train2017
โ โ โโโ 000000000009.jpg
โ โ โโโ 000000000025.jpg
โ โโโ annotations
โ โ โโโ captions_train2017.json
โ โ โโโ captions_val2017.json
6) Visual Question Answering
We use the LLaVA-instruct-150k set for visual question answering. Download and arrange as detailed below.
Download links and structure:
- Annotations - LLaVA-instruct-150k
- Images:
coco_2017- COCO-2017 (train2017)
โโโ llava_dataset
โ โโโ llava_instruct_150k.json
โโโ coco_2017
โ โโโ train2017
7) GranD pretraining Datasets
We convert the GranD dataset to multiple annotations in LMDB form for pretraining based on the tasks. For details on how to prepare the annotations, please refer to: Pretraining Annotations from GranD.
- For image-level captioning:
- Short Captioning: GrandShortCaptionDataset
- For referring expression generation and referring expression segmentation:
- Region-level captioning (referring expression generation): GrandReferRegDataset
- Referring expression segmentation: GrandReferSegmDataset