Experiment about Deep Person Re-identification with EfficientNet-v2

Overview

deep-efficient-person-reid

Experiment for an uni project with strong baseline for Person Re-identification task.

We evaluated the baseline with Resnet50 and Efficienet-v2 without using pretrained models. Also Resnet50-IBN-A and Efficientnet-v2 using pretrained on ImageNet. We used two datasets: Market-1501 and CUHK03.


Pipeline

pipeline


Implementation Details

  • Random Erasing to transform input images.
  • EfficientNet-v2 / Resnet50 / Resnet50-IBN-A as backbone.
  • Stride = 1 for last convolution layer. Embedding size for Resnet50 / Resnet50-IBN-A is 2048, while for EfficientNet-v2 is 1280. During inference, embedding features will run through a batch norm layer, as known as a bottleneck for better normalization.
  • Loss function combining 3 losses:
    1. Triplet Loss with Hard Example Mining.
    2. Classification Loss (Cross Entropy) with Label Smoothing.
    3. Centroid Loss - Center Loss for reducing the distance of embeddings to its class center. When combining it with Classification Loss, it helps preventing embeddings from collapsing.
  • The default optimizer is AMSgrad with base learning rate of 3.5e-4 and multistep learning rate scheduler, decayed at epoch 30th and epoch 55th. Besides, we also apply mixed precision in training.
  • In both datasets, pretrained models were trained for 60 epochs and non-pretrained models were trained for 100 epochs.

Source Structure

.
├── config                  # hyperparameters settings
│   └── ...                 # yaml files
├
├── datasets                # data loader
│   └── ...           
├
├── market1501              # market-1501 dataset
|
├── cuhk03_release          # cuhk03 dataset
|
├── samplers                # random samplers
│   └── ...
|
├── loggers                 # test weights and visualization results      
|   └── runs
|   
├── losses                  # loss functions
│   └── ...   
|
├── nets                    # models
│   └── bacbones            
│       └── ... 
│   
├── engine                  # training and testing procedures
│   └── ...    
|
├── metrics                 # mAP and re-ranking
│   └── ...   
|
├── utils                   # wrapper and util functions 
│   └── ...
|
├── train.py                # train code 
|
├── test.py                 # test code 
|
├── visualize.py            # visualize results 

Pretrained Models (on ImageNet)

  • EfficientNet-v2: link
  • Resnet50-IBN-A: link

Notebook

  • Notebook to train, inference and visualize: Notebook

Setup


  • Install dependencies, change directory to dertorch:
pip install -r requirements.txt
cd dertorch/

  • Modify config files in /configs/. You can play with the parameters for better training, testing.

  • Training:
python train.py --config_file=name_of_config_file
Ex: python train.py --config_file=efficientnetv2_market

  • Testing: Save in /loggers/runs, for example the result from EfficientNet-v2 (Market-1501): link
python test.py --config_file=name_of_config_file
Ex: python test.py --config_file=efficientnetv2_market

  • Visualization: Save in /loggers/runs/results/, for example the result from EfficienNet-v2 (Market-1501): link
python visualize.py --config_file=name_of_config_file
Ex: python visualize.py --config_file=efficientnetv2_market

Examples


Query image 1 query1


Result image 1 result1


Query image 2 query2


Result image 2 result2


Results

  • Market-1501
Models Image Size mAP Rank-1 Rank-5 Rank-10 weights
Resnet50 (non-pretrained) 256x128 51.8 74.0 88.2 93.0 link
EfficientNet-v2 (non-pretrained) 256x128 56.5 78.5 91.1 94.4 link
Resnet50-IBN-A 256x128 77.1 90.7 97.0 98.4 link
EfficientNet-v2 256x128 69.7 87.1 95.3 97.2 link
Resnet50-IBN-A + Re-ranking 256x128 89.8 92.1 96.5 97.7 link
EfficientNet-v2 + Re-ranking 256x128 85.6 89.9 94.7 96.2 link

  • CUHK03:
Models Image Size mAP Rank-1 Rank-5 Rank-10 weights
Resnet50 (non-pretrained) ... ... ... ... ... ...
EfficientNet-v2 (non-pretrained) 256x128 10.1 10.1 21.1 29.5 link
Resnet50-IBN-A 256x128 41.2 41.8 63.1 71.2 link
EfficientNet-v2 256x128 40.6 42.9 63.1 72.5 link
Resnet50-IBN-A + Re-ranking 256x128 55.6 51.2 64.0 72.0 link
EfficientNet-v2 + Re-ranking 256x128 56.0 51.4 64.7 73.4 link

The results from EfficientNet-v2 models might be better if fine-tuning properly and longer training epochs, while here we use the best parameters for the ResNet models (on Market-1501 dataset) from this paper and only trained for 60 - 100 epochs.


Citation

@article{DBLP:journals/corr/abs-2104-13643,
  author    = {Mikolaj Wieczorek and
               Barbara Rychalska and
               Jacek Dabrowski},
  title     = {On the Unreasonable Effectiveness of Centroids in Image Retrieval},
  journal   = {CoRR},
  volume    = {abs/2104.13643},
  year      = {2021},
  url       = {https://arxiv.org/abs/2104.13643},
  archivePrefix = {arXiv},
  eprint    = {2104.13643},
  timestamp = {Tue, 04 May 2021 15:12:43 +0200},
  biburl    = {https://dblp.org/rec/journals/corr/abs-2104-13643.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}
@InProceedings{Luo_2019_CVPR_Workshops,
author = {Luo, Hao and Gu, Youzhi and Liao, Xingyu and Lai, Shenqi and Jiang, Wei},
title = {Bag of Tricks and a Strong Baseline for Deep Person Re-Identification},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
month = {June},
year = {2019}
}

Adapted from: michuanhaohao

Owner
lan.nguyen2k
Tensor Boy
lan.nguyen2k
Implementation of light baking system for ray tracing based on Activision's UberBake

Vulkan Light Bakary MSU Graphics Group Student's Diploma Project Treefonov Andrey [GitHub] [LinkedIn] Project Goal The goal of the project is to imple

Andrey Treefonov 7 Dec 27, 2022
Multi-task head pose estimation in-the-wild

Multi-task head pose estimation in-the-wild We provide C++ code in order to replicate the head-pose experiments in our paper https://ieeexplore.ieee.o

Roberto Valle 26 Oct 06, 2022
RDA: Robust Domain Adaptation via Fourier Adversarial Attacking

RDA: Robust Domain Adaptation via Fourier Adversarial Attacking Updates 08/2021: check out our domain adaptation for video segmentation paper Domain A

17 Nov 30, 2022
Library for machine learning stacking generalization.

stacked_generalization Implemented machine learning *stacking technic[1]* as handy library in Python. Feature weighted linear stacking is also availab

114 Jul 19, 2022
Dynamic Attentive Graph Learning for Image Restoration, ICCV2021 [PyTorch Code]

Dynamic Attentive Graph Learning for Image Restoration This repository is for GATIR introduced in the following paper: Chong Mou, Jian Zhang, Zhuoyuan

Jian Zhang 84 Dec 09, 2022
Syntax-Aware Action Targeting for Video Captioning

Syntax-Aware Action Targeting for Video Captioning Code for SAAT from "Syntax-Aware Action Targeting for Video Captioning" (Accepted to CVPR 2020). Th

59 Oct 13, 2022
YOLOPのPythonでのONNX推論サンプル

YOLOP-ONNX-Video-Inference-Sample YOLOPのPythonでのONNX推論サンプルです。 ONNXモデルは、hustvl/YOLOP/weights を使用しています。 Requirement OpenCV 3.4.2 or later onnxruntime 1.

KazuhitoTakahashi 8 Sep 05, 2022
Memory-efficient optimum einsum using opt_einsum planning and PyTorch kernels.

opt-einsum-torch There have been many implementations of Einstein's summation. numpy's numpy.einsum is the least efficient one as it only runs in sing

Haoyan Huo 9 Nov 18, 2022
This repo in the implementation of EMNLP'21 paper "SPARQLing Database Queries from Intermediate Question Decompositions" by Irina Saparina, Anton Osokin

SPARQLing Database Queries from Intermediate Question Decompositions This repo is the implementation of the following paper: SPARQLing Database Querie

Yandex Research 20 Dec 19, 2022
Simple data balancing baselines for worst-group-accuracy benchmarks.

BalancingGroups Code to replicate the experimental results from Simple data balancing baselines achieve competitive worst-group-accuracy. Replicating

Meta Research 29 Dec 02, 2022
2020 CCF大数据与计算智能大赛-非结构化商业文本信息中隐私信息识别-第7名方案

2020CCF-NER 2020 CCF大数据与计算智能大赛-非结构化商业文本信息中隐私信息识别-第7名方案 bert base + flat + crf + fgm + swa + pu learning策略 + clue数据集 = test1单模0.906 词向量

67 Oct 19, 2022
Finding Donors for CharityML

Finding-Donors-for-CharityML - Investigated factors that affect the likelihood of charity donations being made based on real census data.

Moamen Abdelkawy 1 Dec 30, 2021
Real-Time Multi-Contact Model Predictive Control via ADMM

Here, you can find the code for the paper 'Real-Time Multi-Contact Model Predictive Control via ADMM'. Code is currently being cleared up and optimize

17 Dec 28, 2022
Distributed Asynchronous Hyperparameter Optimization better than HyperOpt.

UltraOpt : Distributed Asynchronous Hyperparameter Optimization better than HyperOpt. UltraOpt is a simple and efficient library to minimize expensive

98 Aug 16, 2022
Soft actor-critic is a deep reinforcement learning framework for training maximum entropy policies in continuous domains.

This repository is no longer maintained. Please use our new Softlearning package instead. Soft Actor-Critic Soft actor-critic is a deep reinforcement

Tuomas Haarnoja 752 Jan 07, 2023
Official implementation of "Learning Proposals for Practical Energy-Based Regression", 2021.

ebms_proposals Official implementation (PyTorch) of the paper: Learning Proposals for Practical Energy-Based Regression, 2021 [arXiv] [project]. Fredr

Fredrik Gustafsson 10 Oct 22, 2022
Experiments for Neural Flows paper

Neural Flows: Efficient Alternative to Neural ODEs [arxiv] TL;DR: We directly model the neural ODE solutions with neural flows, which is much faster a

54 Dec 07, 2022
Using pytorch to implement unet network for liver image segmentation.

Using pytorch to implement unet network for liver image segmentation.

zxq 1 Dec 17, 2021
Official implementation of NeurIPS 2021 paper "Contextual Similarity Aggregation with Self-attention for Visual Re-ranking"

CSA: Contextual Similarity Aggregation with Self-attention for Visual Re-ranking PyTorch training code for CSA (Contextual Similarity Aggregation). We

Hui Wu 19 Oct 21, 2022
Code for IntraQ, PyTorch implementation of our paper under review

IntraQ: Learning Synthetic Images with Intra-Class Heterogeneity for Zero-Shot Network Quantization paper Requirements Python = 3.7.10 Pytorch == 1.7

1 Nov 19, 2021