Person Re-identification using Siamese Neural Networks

Overview

This project explores various models and datasets for person re-identification and evaluates their performance. Person re-identification (ReID) aims to identify individuals across different camera views, which is critical for surveillance, security, and retail applications.

Models Used

  • ResNet50 Baseline: Following the Bag of Tricks paper.
  • OSNet: Optimized network designed specifically for ReID tasks.
  • Custom MobileNetV3 Large Backbone: Lightweight yet effective model tailored for efficiency.

Key Features

  • Training pipeline adapted from this repository with modifications for Weights & Biases (WandB) integration.
  • Additional scripts for streamlined training, fine-tuning, evaluation, and automation:
    • train_model.py
    • finetune.py
    • autorunner.sh
    • auto_evaluator.sh
  • Custom distance metrics and plotting functions for insightful evaluations.

Environment Setup

To set up the environment, use the provided Conda configuration file siamese_net.yml. Run the following commands:

        conda env create -f environment.yml
        conda activate pytorch
                

Usage

Follow the instructions below to train and test the person ReID models:

Training

        python train_model.py --batch_size 64 --lr 0.00035 --model_name siamese --max_epochs 50 --train 1 --logs_dir /home/ronak/data/logs --dataset market1501 --log_wandb 1 --run_name siamese_market --data_dir /home/ronak/data/
                

Testing

        python3 train_model.py --model baseline --train 0 --dataset market1501 --logs_dir /home/ronak/datasets/market1501/logs/baseline --data_dir /home/ronak/datasets/
                

Arguments

  • logs_dir: Path to store checkpoints.
  • run_name: Identifier for the WandB run and saved plots.
  • model: Choose between siamese, baseline (ResNet50), and osnet_x0_25.
  • dataset: Supported options include market1501, dukemtmc, and last.
  • data_dir: Path to the selected dataset.

Resources

View on GitHub