Skip to content

danzschulman/refer

 
 

Repository files navigation

ReferIt Data Augmentation

This fork is part of the work of Dan Schulman's Thesis that can be found here

The Jupyter Notebook augment_dataset_dan.ipynb contains the code for augmenting the original dataset, doubling its size and still keep it valid. This is done by simply flipping all images left-to-right and updating the referring expressions accordingly.

Original README:

Note

This API is able to load all 4 referring expression datasets, i.e., RefClef, RefCOCO, RefCOCO+ and RefCOCOg. They are with different train/val/test split by UNC, Google and UC Berkeley respectively. We provide all kinds of splits here. Note, RefCOCO+ may change in the future as we are still cleaning it. Notification will be announced if we made changes.

Mountain View

Citation

If you used the following three datasets RefClef, RefCOCO and RefCOCO+ that were collected by UNC, please consider cite our EMNLP2014 paper; if you want to compare with our recent results, please check our ECCV2016 paper.

Kazemzadeh, Sahar, et al. "ReferItGame: Referring to Objects in Photographs of Natural Scenes." EMNLP 2014.
Yu, Licheng, et al. "Modeling Context in Referring Expressions." ECCV 2016.

Setup

Run "make" before using the code. It will generate _mask.c and _mask.so in external/ folder. These mask-related codes are copied from mscoco API.

Download

Download the cleaned data and extract them into "data" folder

Prepare Images:

Besides, add "mscoco" into the data/images folder, which can be from mscoco COCO's images are used for RefCOCO, RefCOCO+ and refCOCOg. For RefCLEF, please add saiapr_tc-12 into data/images folder. We extracted the related 19997 images to our cleaned RefCLEF dataset, which is a subset of the original imageCLEF. Download the subset and unzip it to data/images/saiapr_tc-12.

How to use

The "refer.py" is able to load all 4 datasets with different kinds of data split by UNC, Google and UC Berkeley.

# locate your own data_root, and choose the dataset_splitBy you want to use
refer = REFER(data_root, dataset='refclef',  splitBy='unc')
refer = REFER(data_root, dataset='refclef',  splitBy='berkeley')  # 2 training and 1 testing images missed
refer = REFER(data_root, dataset='refcoco',  splitBy='unc')
refer = REFER(data_root, dataset='refcoco',  splitBy='google')
refer = REFER(data_root, dataset='refcoco+', splitBy='unc')
refer = REFER(data_root, dataset='refcocog', splitBy='google')  # testing data haven't been released yet

About

Referring Expression Datasets API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 95.1%
  • Python 4.9%