- This code is GPU-only
- Tested on Ubuntu 18.04 with NVIDIA Tesla P100 and CUDA 9.0
- Implemented by Python 3.6
- Core dependencies are listed in environment.yaml
- Install Miniconda or Anaconda
- Create an environment based on the environment file
conda env create -f environment.yaml
- Activate this environment
conda activate saf
- Clone the repository
git clone https://github.com/SA-Framework/saf.pytorch cd saf.pytorch export SAF_ROOT=`pwd`
- Compile the CUDA code
cd $SAF_ROOT/libs sh make.sh
- Create data folder
mkdir -p $SAF_ROOT/data/VOC2007/ cd $SAF_ROOT/data/VOC2007/
- Download the training, validation, test data and VOCdevkit of PASCAL VOC 2007
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar
- Extract all these tars into one directory named
VOCdevkit
tar xvf VOCtrainval_06-Nov-2007.tar tar xvf VOCtest_06-Nov-2007.tar tar xvf VOCdevkit_18-May-2011.tar
- Download the COCO format pascal annotations from here and put them into the
annotations
directory - Create symlinks to image files
ln -s VOCdevkit/VOC2007/JPEGImages/
- The directory structure should look like this
$SAF_ROOT/data/VOC2007/ $SAF_ROOT/data/VOC2007/annotations $SAF_ROOT/data/VOC2007/JPEGImages -> VOCdevkit/VOC2007/JPEGImages/ $SAF_ROOT/data/VOC2007/VOCdevkit
- [Optional] Follow similar steps to get PASCAL VOC 2012
- Download and put the precomputed proposals under
$SAF_ROOT/data/precomputed_proposals/
Our trained models are available here. Put them under $SAF_ROOT/data/saf_models
.
python3 tools/test_net.py --cfg configs/baselines/vgg16_voc2007.yaml \
--set MODEL.LOAD_IMAGENET_PRETRAINED_WEIGHTS False \
--load_ckpt data/saf_models/voc2007.pth \
--dataset voc2007trainval
python3 tools/test_net.py --cfg configs/baselines/vgg16_voc2007.yaml \
--set MODEL.LOAD_IMAGENET_PRETRAINED_WEIGHTS False \
--load_ckpt data/saf_models/voc2007.pth \
--dataset voc2007test
Note: Add --multi-gpu-testing
if multiple gpus are available.
Download the backbone VGG-16 model (pre-trained on ImageNet) and put it under $SAF_ROOT/data/pretrained_model/
.
CUDA_VISIBLE_DEVICES=0 python3 tools/train_net_step.py --dataset voc2007 \
--cfg configs/baselines/vgg16_voc2007.yaml --bs 1 --nw 4 --iter_size 4
Note: The current implementation only supports single-gpu training.