The final goal of this project is to bring a technique that aims to generate Visual Question answering datasets specialised in choosen domains. This repository focuses on the domain of "indoor scenes", hence this notebook generates an indoor scenes VQA dataset, this could be adapted to other datasets with minor code changing.
There are 3 notebooks out there:
- visualGenome.ipynb: generates a domaine specific dataset from visual genome by filtering images that contain objects provided in a keyword text file. We add a negative filtering to minimize false positive results.
- VQA2_Dataset.ipynb : generate a domaine specific dataset from VQA v2 dataset by filtering questions that contain keyword provided in a keyword text file.
- Raw_images_generator : generate a domain specific dataset from raw images. We apply an object detection algorithm (in this case yolo 9000) and apply some question templates to the detected objects to generate questions. The questions of course are very limited compared to human generated questions in other datasets.
This program was tested on a google colab, hence it was tested on the hardware provided by colab.
- Ubuntu 18.04
- Python 3.7
- YOLO 9000
If you want to run the code on the notebooks, you must follow the steps below :
- Run install.ipynb. This notebook sets up the environment by downloading files and creating a file hierarchy.
- Run VQA_V2_Dataset.ipynb. This notebook filters the VQA V2 dataset and extracts indoor scenes.
- Run VisualGenome.ipynb. This notebook filters VG and GQA datasets and extracts indoor scenes.
- Run Questions_answers_generation.ipynb to generate an indoor VQA dataset from NUY Depth V2 dataset.
- Run Fusion.ipynb. This code must be executed after VQA_V2_Dataset.ipynb and VisualGenome.ipynb. It fuses all the datasets in one dataset and then split it to train and val. (The dataset generated by Questions_answers_generation.ipynb is not included but could be very easily).
Note : Each notebook contains a variables section. Any user must fill the variable with his specific needs to have the notebooks work fine. Generally, the only variable that needs a value assignment is data_root
which is the directory containing all the needed files. This last is first specified in install.ipynb, then must have the same value in all notebooks.
There are some sections that are specific to the generation of indoor scenes like the room template questions,the transformation from an image extention to JPG or the section "Special usecase applyed to NUY Depth V2 dataset" or the keywords files. If you don't need them, just remove them. (see inside notebooks there are commented sections)
I have used Google Colab when writing this code, so in each notebook, there is a code that mounts drive on colab, you can skip that one if you don't use Colab or drive on Colab.
Use the Yolo directory contained in this project because I modified him to get additional commands.
Copyright (c) 2019 Nabih Nebbache
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.