Skip to content

TeCSAR-UNCC/person-reid

Repository files navigation

Person Re-identification (person-reid)

A framewrok enabled mixed precision person re-identification. Currently it supports two ResNet-50 and MobileNet-V2. The pre-trained networks for both half-precision and single precision are avaialable in expt_res folder. POWERED BY TeCSAR

Prerequisites

  • PyTorch (V 1.0.0)
  • Apex: available here
  • Python 3

Installation

Datasets and pre-requirements

The core of this code is based on provided framework available here. Please follow the mentioned instruction about datasets and switches.

Different networks

I added two switches named --net, and --net_pretrained_path for seclecting the network model and pre-trained model based on ImageNet dataset respectively. The --net switch can be assigned to mobilenetV2 and resnet50 options. I also provided a pretrained mobilenet-v2 file named mobilenet_v2.pth.tar from here.

Mixed precision

A new added switch named --opt-level selects the precision as follows:

  • O0: pure 32-bit (single precision) training and inference.
  • O2: Assigned error-tollorant operations, such as GeMM ,to 16-bit (half) precision.

Training will not converge for O3 opttions. Morover, even for O2 options, loss function should be calculated in single precision. More information can be find here.

Demo

I have provided a shell script for each of the following tasks:

Train

Run the trainMe.sh:

./trainMe.sh

Test

Run the testMe.sh:

./testMe.sh

Visualization

Run the vis_res.sh:

./vis_res.sh

Extracting witghts model and exporting ONNX file

Run the extractModels.sh:

./extractModels.sh

Citing the Real-Time Person Re-identification

Please cite the following paper if it helps your research work:

@InProceedings{10.1007/978-3-030-27272-2_3,
author="Baharani, Mohammadreza
and Mohan, Shrey
and Tabkhi, Hamed",
editor="Karray, Fakhri
and Campilho, Aur{\'e}lio
and Yu, Alfred",
title="Real-Time Person Re-identification at the Edge: A Mixed Precision Approach",
booktitle="Image Analysis and Recognition",
year="2019",
publisher="Springer International Publishing",
address="Cham",
pages="27--39",
isbn="978-3-030-27272-2"
}

License

Copyright (c) 2018, University of North Carolina at Charlotte. All rights reserved. - see the LICENSE file for details.

To do:

[ ] Supporting ShuffleNet-V2 I was able to train the shuffleNetV2 in python2.7; however, I couldn't make Nvidia Apex working in python 2.7. I am not sure why this network cannot be trained in python3 with PyTorch v1.0.0.

Acknowledgments

About

A mixed precision approach for person-reid

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published