Dataset generation code for the CLEVR-Singles dataset from the AAAI 2021 paper
Attribute-Guided Adversarial Training for Robustness to Natural Perturbations
Tejas Gokhale, Rushil anirudh, Bhavya Kailkhura, Jayaraman J. Thiagarajan, Chitta Baral, Yezhou Yang
(to appear in) AAAI 2021
https://arxiv.org/abs/2012.01806
This codebase is directly based on the CLEVR dataset generation code from https://github.com/facebookresearch/clevr-dataset-gen
Images are rendered by using Blender. Our code works with Blender v2.79b. It may work with other versions too, but I have not tested it. For specific instructions on installation of Blender and it's Python version, please refer to https://github.com/facebookresearch/clevr-dataset-gen/tree/master/image_generation
Once you set up blFor rendering CLEVR-Singles images, please run the following commands
cd image_generation
bash run_rendering.sh
- Line-1 sets BLENDER_DIR, i.e. the path where you have installed Blender. Please edit this for your version and system.
- Line-2 sets the Blender Version. 2.79 is default.
- Blender ships with its own version of Python 3.5, and it uses its bundled Python to execute scripts. Line-3 add this directory to the Python path of Blender's bundled Python.
Image generation is run via the python script render_image.py as :
CUDA_VISIBLE_DEVICES=1 nohup $BLENDER_DIR/blender -noaudio --background --python render_images.py \
-- --use_gpu 1 --num_images 60000 \
--start_idx 0 --split train \
--min_objects 1 --max_objects 1 --min_pixels_per_object 400 \
--output_scene_dir ../output/singles_train/scenes \
--output_image_dir /home/tgokhale/work/data/clevr/CLEVR_singles/images/train/ \
> ./render_singles_log.out &
--use_gpucan be turned on (1) or off (0). The code runs in both modes.--num_imagesis the number of images you want to generation (default: 60000)start_idxis the image index you want to start from. Note that sometimes Blender quits unexpectedly, so you may need to restart image generation from the last index.--splitdenotes train/val/test splits--min_objectsand-max_objectsmust both be set to 1. In the original CLEVR code multiple objects are allowed in each image, but in CLEVR-Singles (as the name suggests), each object only has one object.--min_pixels_per_objectshould be set at 400 for the current resolution--output_scene_dirandoutput_image_dirare the paths where you want to save the generated images
If you find our dataset and our AGAT paper useful, please use the following citation:
@misc{gokhale2020attributeguided,
title={Attribute-Guided Adversarial Training for Robustness to Natural Perturbations},
author={Tejas Gokhale and Rushil Anirudh and Bhavya Kailkhura and Jayaraman J. Thiagarajan and Chitta Baral and Yezhou Yang},
year={2020},
eprint={2012.01806},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
For citing the original CLEVR dataset generation code, use:
@inproceedings{johnson2017clevr,
title={CLEVR: A Diagnostic Dataset for Compositional Language and Elementary Visual Reasoning},
author={Johnson, Justin and Hariharan, Bharath and van der Maaten, Laurens
and Fei-Fei, Li and Zitnick, C Lawrence and Girshick, Ross},
booktitle={CVPR},
year={2017}
}