Skip to content

Robust Partial Matching for Person Search in the Wild

Notifications You must be signed in to change notification settings


Repository files navigation

APNet for Person Search


This is the code of Robust Partial Matching for Person Search in the Wild accepted in CVPR2020. The Align-to-Part Network(APNet) is proposed to alleviate the misalignment problem occurred in pedestrian detector, facilitating the downstream re-identification task. The code is based on maskrcnn-benchmark.

Quick start


  1. Please follow the offical installation This code does not support the mixed precision training, so feel free to skip the installation of apex.

NOTE: If you meet some problems during the installation, you may find a solution in issues of official maskrcnn-benchmark.

  1. Install APNet
git clone
cd APNet
rm -rf build/
python build develop

Dataset Preparation

Make sure you have downloaded the dataset of person search like PRW-v16.04.20.

  1. Since the training of APNet relies on the keypoint annotation, we provide the keypoint estimation file by AlphaPose in keypoint_pred/. Copy all the files into the root dir of dataset, like /path_to_prw_dataset/PRW-v16.04.20/:
cp keypoint_pred/* /path_to_prw_dataset/PRW-v16.04.20/
  1. Symlink the path to the dataset to datasets/ as follows:
ln -s /path_to_prw_dataset/PRW-v16.04.20/ maskrcnn_benchmark/datasets/PRW-v16.04.20


APNet composes of three modules, OIM, RSFE and BBA. To train the entire network, you can simply run:


which contains the training scripts of the three modules.

NOTE: Both RSFE and BBA are required to be intialised with the trained OIM. For more details, please check

You can alter the scripts in in the following aspects:

  1. We train OIM on 2 GPUS with batchsize 4. If you encounter out-of-memory (OOM) error, reduce the batchsize by setting SOLVER.IMS_PER_BATCH to a smaller number.

  2. If you want to use 1 GPU, replace the command of OIM with single GPU training script:

python tools/ --config-file "configs/reid/prw_R_50_C4.yaml" SOLVER.IMS_PER_BATCH 2 TEST.IMS_PER_BATCH 8 OUTPUT_DIR "models/prw_oim"


After each of the module has been trained, you can run exactly the same training script of that module to test the performance.


If you find this work or code is helpful in your research, please consider citing:


Robust Partial Matching for Person Search in the Wild


Code of conduct





No releases published