Expanded Cross Neighborhood distance based Re-ranking (ECN)
In this repository, we provide the reranking and evaluation code used for our paper A Pose-Sensitive Embedding for Person Re-Identification with Expanded Cross Neighborhood Re-Ranking.
This includes our Expanded Cross Neighborhood Re-Ranking Matlab and Python code. The training code for our Pose Sensitive Embedding Model is located in a separate repository.
If you find our work helpful in your research, please cite:
M. Saquib Sarfraz, Arne Schumann, Andreas Eberle, Ranier Stiefelhagen, "A Pose Sensitive Embedding for Person Re-Identification with Exapanded Cross Neighborhood Re-Ranking", https://arxiv.org/abs/1711.10378 2017. [accepted at CVPR 2018]
Usage of Expanded Cross Neighborhood Re-ranking
Our matlab implementation of ECN can be found in the file ECN_rerank and Python implementation can be found in ecn.py. The script can be called with default parameters in the following way to calculate the re-ranked distance for a query and a test set.
ECN_dist= ECN_rerank(queryset, testset);
python3 ecn.py --queryset=path-to-your-query-features-csv-file --testset=path-to-your-test-features-csv-file --outputpath=path-to-write-ECN-distance
This will run ECN with the default parameters
method=rankdist. The returned
ECN_dist can then be used to calculate the scores.
Alternatively, you can also supply different values for these parameters by running it like
ECN_dist= ECN_rerank(queryset, testset, 'k',25, 't',3, 'q',8, 'method','rankdist') (Matlab) python3 ecn.py --queryset=path-to-your-query-features-csv-file --testset=path-to-your-test-features-csv-file --outputpath=path-to-write-ECN-distance --method='rankdist' --k=25 --t=3 --q=8 (Python)
Supported values for parameter
rankdist(default): Using the rank distance for ECN re-ranking
origdist: Using the original euclidian distance for ECN re-ranking
Query and Test Set Format
Our ECN_rerank script expects the query and testsets in the following format:
- queryset: probe matrix (#_of_probes x feature_dimension); feature vectors in rows
- testset = gallery matrix (#_of_gallery_images x feature_dimension); feature vectors in rows
You can download our PSE model's features for the Market-1501 and Duke datasets here
You can then run the evaluation by setting the evalPath to your download features folder in the function evalECNRerankingForPath.