- 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:
- Convert BDD annotations to 'xml': https://github.com/Ugenteraan/bdd_json_to_xml/blob/master/convert.py
- BDD dataset class: https://github.com/nishankjain/faster-rcnn-bdd/tree/master/lib/model
- https://github.com/deboc/py-faster-rcnn/tree/master/help
- The first thing you need to do is writing a customized data loader for your own dataset. You can refer to the data loader for pascal_voc and coco in lib/datasets/pascal_voc.py and lib/datasets/coco.py.
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