This repository hosts the code for our paper Joint Detection and Identification Feature Learning for Person Search. The code is modified from the py-faster-rcnn written by Ross Girshick.
Request the dataset from lishuang[at]mit.edu or tong.xiao.work[at]gmail.com (academic only).
- Clone this repo recursively
git clone --recursive https://github.com/ShuangLI59/person_search.git
- Build Caffe with python layers and interface
We modified caffe based on Yuanjun's fork, which supports multi-gpu and memory optimization.
Apart from the official installation prerequisites, we have several other dependencies:
- cudnn-v5.1
- 1.7.4 < openmpi < 2.0.0
- boost >= 1.55 (A tip for Ubuntu 14.04:
sudo apt-get autoremove libboost1.54*
thensudo apt-get install libboost1.55-all-dev
)
Then compile and install the caffe with
cd caffe
mkdir build && cd build
cmake .. -DUSE_MPI=ON -DCUDNN_INCLUDE=/path/to/cudnn/include -DCUDNN_LIBRARY=/path/to/cudnn/lib64/libcudnn.so
make -j8 && make install
cd ../..
Please refer to this page for detailed installation instructions and troubleshooting.
- Build the Cython modules
Install some Python packages you might not have: Cython
, python-opencv
, easydict (>=1.6)
, PyYAML
, protobuf
, mpi4py
. Then
cd lib && make && cd ..
Download our trained model to output/psdb_train/resnet50/
, then
python2 tools/demo.py --gpu 0
Or you can use CPU only by setting --gpu -1
.
- Request the dataset from sli [at] ee.cuhk.edu.hk or xiaotong [at] ee.cuhk.edu.hk (academic only). Then
experiments/scripts/prepare_data.sh /path/to/the/downloaded/dataset.zip
-
Download an ImageNet pretrained ResNet-50 model to
data/imagenet_models
. -
Training with GPU=0
experiments/scripts/train.sh 0 --set EXP_DIR resnet50
It will finish in around 18 hours, or you may directly download a trained model to output/psdb_train/resnet50/
-
Evaluation
By default we use 8 GPUs for faster evaluation. Please adjust the
experiments/scripts/eval_test.sh
with your hardware settings. For example, to use only one GPU, remove thempirun -n 8
in L14 and change L16 to--gpu 0
.experiments/scripts/eval_test.sh resnet50 50000 resnet50
The result should be around
search ranking: mAP = 75.47% top- 1 = 78.62% top- 5 = 90.24% top-10 = 92.38%
-
Visualization
The evaluation will also produce a json file
output/psdb_test/resnet50/resnet50_iter_50000/results.json
for visualization. Just copy it tovis/
and runpython2 -m SimpleHTTPServer
. Then open a browser and go to http://localhost:8000/vis.
@inproceedings{xiaoli2017joint,
title={Joint Detection and Identification Feature Learning for Person Search},
author={Xiao, Tong and Li, Shuang and Wang, Bochao and Lin, Liang and Wang, Xiaogang},
booktitle={CVPR},
year={2017}
}
The first version of our paper was published in 2016. We have made substantial improvements since then and published a new version of paper in 2017. The original code was moved to branch v1
and the new code has been merged to master
. If you have checked out our code before, please be careful on this and we recommend clone recursively into a new repo instead.