Downloads · 30 days
0
simoswish/PersonRe-ID_PersonViT_PRW
PersonRe-ID_PersonViT_PRW is a machine learning model from simoswish. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as cc-by-nd-4.0.
This repository contains an evaluation and fine‑tuning pipeline for PersonViT (TransReID backbone) on the PRW (Person Re‑Identification in the Wild) dataset.
Downloads · 30 days
0
Access
Public
Updated Mar 1, 2026
Repo size
1.8 GB
Likes
0
Public
Click a slice to open those files.
.pth1.8 GB · 100%
From the Hugging Face model README
This repository contains an evaluation and fine‑tuning pipeline for PersonViT (TransReID backbone) on the PRW (Person Re‑Identification in the Wild) dataset.
The notebook is designed for Kaggle and includes:
The notebook runs an ablation study in three phases:
Pretrained evaluation (ViT‑Base)
Evaluates multiple pretrained PersonViT ViT‑Base checkpoints on PRW and selects the best baseline (highest mAP).
Phase 1 — Strategy comparison (loss fixed = ArcFace)
Compares three fine‑tuning strategies:
Phase 2 — Loss comparison (strategy fixed = best Phase 1)
With the best strategy fixed (full), compares metric learning losses:
Phase 3 — ViT‑Small (best strategy + best loss)
Fine‑tunes ViT‑Small using the best strategy+loss from Phase 1/2, then adds it to the final comparison.
Finally, it generates comparison plots and exports a summary CSV.
albumentationsopencv-python-headlessscipytorchmetricstimmeinopsyacspytorch-metric-learningthopConfigure the PRW root directory in the notebook Config:
cfg.dataset_root = '/kaggle/input/datasets/edoardomerli/prw-person-re-identification-in-the-wild'The notebook expects the standard PRW structure (frames, annotations, query_box, split mats, etc.).
The notebook evaluates multiple pretrained ViT‑Base checkpoints and uses the best one for fine‑tuning.
It also contains a Phase 3 configuration for ViT‑Small (Market‑1501 pretrained).
Make sure the checkpoint paths in Config match your Kaggle inputs.
load_results() to restore RESULTS from diskThe fine‑tuning helper automatically skips runs already present in the saved results, so you can safely re-run cells after a disconnect.
Saved every time RESULTS is updated:
evaluation_results/all_results.jsonSaved at the end:
evaluation_results/all_results.csvSaved into:
evaluation_results/plots/Typical outputs include:
/kaggle/working/personvit_finetuning/curves_<run_key>.pngBest checkpoint per run:
/kaggle/working/personvit_finetuning/best_<run_key>.pthfull: unfreeze all parameters (low LR, avoids catastrophic forgetting)partial: freeze backbone, train only headfreeze: freeze backbone, reset head modules, retrain head from scratchtriplet: TripletMarginLoss + hard miningarcface: ArcFace loss (with its own internal parameters)angular: Angular loss (configured to avoid empty mining → loss=0)full_arcface, partial_arcface, freeze_arcfaceS):
S_triplet, S_arcface (reused), S_angularvit_small_<best_strategy>_<best_loss>RESULTS[run_key] stores:
mAP, rank1, rank5, rank10, num_valid_queriestotal_params, flops_giga, inference_ms, throughputhistory (training curves data)trainable_params (number of trainable parameters) to quantify how much of the model was actually fine‑tunedstrategy, loss, plus display_name for pretrained baselinesThe notebook uses native PyTorch AMP to speed up training and reduce VRAM usage on T4-class GPUs. If you update PyTorch and see deprecation warnings, switch to the newer API:
torch.amp.GradScaler('cuda', ...)torch.amp.autocast(device_type='cuda', ...)If you disable AMP (cfg.use_amp = False), training will run in FP32 (more stable, slower, higher VRAM usage).