Official training/evaluation code for the paper.
Paper: From Global to Local: Rethinking CLIP Feature Aggregation for Person Re-Identification
This open-source package includes the standalone training/evaluation pipeline:
train.pyis the main entrypoint
Tested with Python 3.8+, PyTorch 2.4, CUDA 12.
Option A (Conda, recommended):
conda create -n saga-reid python=3.10 -y
conda activate saga-reidOption B (venv):
python -m venv .venv
# Linux/macOS
source .venv/bin/activate
# Windows (PowerShell)
.\.venv\Scripts\Activate.ps1Install the PyTorch build that matches your system and CUDA version.
CUDA 12.1 example:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121CPU-only example:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpupip install -r requirements.txtpython -c "import torch; print('torch:', torch.__version__); print('cuda_available:', torch.cuda.is_available())"
python -c "import timm, ftfy, regex, PIL, scipy, sklearn, numpy; print('dependencies_ok')"market1501dukemtmcocc_dukeocc_marketocc_reidmmmp
python train.py --config configs/market1501.jsonSet this in your config file:
"use_v1_features": true# resume from Stage-2 checkpoint
python train.py --config configs/market1501.json --start_stage 3
# start Stage 3b directly
python train.py --config configs/market1501.json --start_stage 3 --start_s3bStage 4 training is disabled by default ("enable_stage4": false).
# fusion (default, using Stage-3 checkpoint)
python train.py --config configs/market1501.json --eval output/structured_anchor_guided/model_stage3_best.pthtrain.py
configs/
market1501.json
occ_market1501.json
occ_dukemtmcreid.json
datasets/
loss/
model/
utils/
visual_modules.py