/pedestrian_detection_attention

Pedestrian detection with attention based on faster-RCNN

Primary LanguagePythonMIT LicenseMIT

  • Modified from original git repo. ATTENTION: pytorch 1.0 branch, and prepare the project with pytorch-1.0 README.md

Preparation

  • Prepare data and HydraPlus pretrained model First of all, clone the code
git clone git@github.com:TianmingQiu/pedestrian_detection_attention.git

Then, create a folder:

cd pedestrian_detection_attention && mkdir data

Download dataset and pre-trained model:

cd data

Download bdd_data and pretrained_model here. The directroy looks like:

data
├── bdd_data
└── pretrained_model

Compilation

pip install -r requirements.txt
cd lib
python setup.py build develop

If you have the issue with "cannot import .mask", you need to prepare COCO API:

cd data
git clone https://github.com/pdollar/coco.git 
cd coco/PythonAPI
make

Train AF3

Check train.sh and run sh train.sh

Other information

  • test your training e.g.:
python trainval_net.py --dataset pascal_voc --net vgg16 --bs 24 --nw 8 --lr 0.001 --lr_decay_step 1000 --cuda --mGPUs
Custom dataset adaptation:
HydraPlus detector:

Train the MNet branch of HydraPlus net:

BATCH_SIZE=128
WORKER_NUMBER=4
LEARNING_RATE=0.01
DECAY_STEP=10

GPU_ID=0,1,2,3,4,5,6,7

CUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py \
                   --dataset bdd --net hp --hpstage MNet \
                   --bs $BATCH_SIZE --nw $WORKER_NUMBER \
                   --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \
                   --cuda  --mGPUs