Skip to content
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Code for ICCV 2019 Paper "Mixed High-Order Attention Network for Person Re-Identification"

This code is developed based on pytorch framework and the baseline code.


  • Aug 16, 2019

    • The codes of training and testing for our ICCV19 paper are released.
    • We have cleared up and tested the codes on Market, Duke datasets, the expected retrieval performances are as follows:
    Market R@1 R@5 R@10 mAP Reference
    IDE+ERA 89.9% 96.4% 97.6% 75.6%
    IDE+MHN6 93.1% 97.7% 98.7% 83.2%
    PCB+ERA 91.7% 97.4% 98.3% 76.4% train_smallPCB
    PCB+MHN4 94.3% 98.0% 98.8% 83.9% train_smallPCB
    PCB+MHN6 94.8% 98.3% 98.9% 85.2%
    Duke R@1 R@5 R@10 mAP Reference
    IDE+ERA 82.7% 91.8% 94.1% 68.1%
    IDE+MHN6 87.8% 94.2% 95.8% 74.6%
    PCB+ERA 82.9% 91.7% 93.8% 67.7% train_smallPCB
    PCB+MHN4 88.5% 94.5% 96.1% 76.9% train_smallPCB
    PCB+MHN6 89.5% 94.7% 96.1% 77.5%



    • files for training and testing on IDE framework

    • files for training and testing on PCB framework, when using MHN, the maximized order is limited to 4 due to the GPU memory.

    • files for training, if you want to test MHN6, please use this file for training with multi gpus. The testing file is also

    • auto-testing code.


  • Pytorch(0.4.0+)
  • python3.6
  • 2GPUs, each > 11G


  1. Clone our code.
  2. Download the training images {google drive, baidu}, including Market1501, DukeMTMC, CUHK03-NP.
  3. Go into the MHN/ dir and mkdir datasets/, then unzip the downloaded to datasets/
  4. Run to preprocess the datasets.
  5. Then you can try our methods
python3 --gpu_ids 0 --name ide --data_dir datasets/Market/datasets/pytorch/ --train_all --batchsize 32 --erasing_p 0.4 --balance_sampler
python3 --gpu_ids 0 --name ide_mhn6 --data_dir datasets/Market/datasets/pytorch/ --train_all --batchsize 32 --erasing_p 0.4 --balance_sampler --alpha 1.4 --parts 6 --mhn
python3 --gpu_ids 0 --name pcb --data_dir datasets/Market/datasets/pytorch/ --train_all --batchsize 32 --erasing_p 0.4 --balance_sampler
python3 --gpu_ids 0 --name pcb_mhn4 --data_dir datasets/Market/datasets/pytorch/ --train_all --batchsize 32 --erasing_p 0.4 --balance_sampler --alpha 2 --parts 4 --mhn
python3 --gpu_ids 0,1 --name pcb_mhn6 --data_dir datasets/Market/datasets/pytorch/ --train_all --batchsize 32 --erasing_p 0.4 --balance_sampler --alpha 2 --parts 6 --mhn

the trained models are stored in folder "model/($name)".


We provide the auto-testing code in, you can replace the corresponding code for testing. For example,

python3 --gpu_ids $gpu_ids --name ide --test_dir datasets/Market/datasets/pytorch/ --batchsize 32 --which_epoch $i
python3 --gpu_ids $gpu_ids --name ide_mhn6 --test_dir datasets/Market/datasets/pytorch/ --batchsize 20 --which_epoch $i --mhn --parts 6
python3 --gpu_ids $gpu_ids --name pcb --test_dir datasets/Market/datasets/pytorch/ --batchsize 32 --which_epoch $i
python3 --gpu_ids $gpu_ids --name pcb_mhn4 --test_dir datasets/Market/datasets/pytorch/ --batchsize 15 --which_epoch $i --mhn --parts 4
python3 --gpu_ids $gpu_ids --name pcb_mhn6 --test_dir datasets/Market/datasets/pytorch/ --batchsize 10 --which_epoch $i --mhn --parts 6



You are encouraged to cite the following papers if this work helps your research.

  title={Mixed High-Order Attention Network for Person Re-Identification},
  author={Chen, Binghui and Deng, Weihong and Hu, Jiani},
  booktitle={Proceedings of the IEEE International Conference on Computer Vision (ICCV)},
author = {Chen, Binghui and Deng, Weihong},
title = {Energy Confused Adversarial Metric Learning for Zero-Shot Image Retrieval and Clustering},
booktitle = {AAAI Conference on Artificial Intelligence},
year = {2019}


Copyright (c) Binghui Chen

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

You can’t perform that action at this time.