How to setup this codebase?
This codebase requires Python 3.6+ or higher. We recommend using Anaconda or Miniconda. We walk through installation and data preprocessing here.
Install Dependencies
For these steps to install through Anaconda (or Miniconda).
Install Anaconda or Miniconda distribution based on Python 3+ from their downloads site.
Clone the repository first.
git clone https://www.github.com/kdexd/virtex
Create a conda environment and install all the dependencies.
cd virtex conda create -n virtex python=3.8 conda activate virtex pip install -r requirements.txt
Install additional packages from Github.
pip install git+git://github.com/facebookresearch/fvcore.git#egg=fvcore pip install git+git://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI
Install this codebase as a package in development version.
python setup.py develop
Now you can import virtex
from anywhere as long as you have this conda
environment activated.
Setup Datasets
Datasets are assumed to exist in ./datasets
directory (relative to the
project root) following the structure specified below. COCO is used for
pretraining, and rest of the datasets (including COCO) are used for downstream
tasks. This structure is compatible when using
Detectron2 for downstream
tasks.
COCO
datasets/coco/
annotations/
captions_{train,val}2017.json
instances_{train,val}2017.json
train2017/
# images in train2017 split
val2017/
# images in val2017 split
LVIS
datasets/coco/
train2017/
val2017/
datasets/lvis/
lvis_v1.0_{train,val}.json
PASCAL VOC
datasets/VOC2007/
Annotations/
ImageSets/
Main/
trainval.txt
test.txt
JPEGImages/
datasets/VOC2012/
# Same as VOC2007 above
ImageNet
datasets/imagenet/
train/
# One directory per category with images in it
val/
# One directory per category with images in it
ILSVRC2012_devkit_t12.tar.gz
iNaturalist 2018
datasets/inaturalist/
train_val2018/
annotations/
train2018.json
val2018.json
Build vocabulary
Build a vocabulary out of COCO Captions train2017
split.
python scripts/build_vocabulary.py \ --captions datasets/coco/annotations/captions_train2017.json \ --vocab-size 10000 \ --output-prefix datasets/vocab/coco_10k \ --do-lower-case
That’s it! You are all set to use this codebase.