Person_reID_baseline_pytorch: a 2GB promise with a bf16 asterisk
:bouncing_ball_person: Pytorch ReID: A tiny, friendly, strong pytorch implement of person re-id / vehicle re-id baseline. Tutorial 👉https://github.com/layumi/Person_reID_baseline_pytorch/tree/master/tutorial
At a glance
- What is it?
- layumi's Person_reID_baseline_pytorch is a PyTorch re-identification baseline that sells itself on a 2GB training floor, a wide menu of switches and a reported Rank@1=88.24%. Those points sit next to settings the page itself calls far from optimal, one pinned dependency out of nine, and a heatmap script linked from a branch that is not the default.
- Who is it for?
- Treat this as a research baseline, not a product. It earns a place when you want a re-identification pipeline where every trick is a switch you can flip off, and you plan to read the code instead of the headline numbers.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 34 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 10, 2026, and from our analysis. They are not legal advice.
Star history
- layumi/Person_reID_baseline_pytorch4,460 ★ · +13
| Repository | 2026-09-23 | 2026-11-10 |
|---|---|---|
| layumi/Person_reID_baseline_pytorch | 4.4k | 4.5k |
13 Stars in the last 48 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The 2GB memory claim rests on a precision mode tagged years later
The pitch line promises that the baseline could be trained with only 2GB GPU memory once bf16 or fp16 is switched on, and the training feature list credits that saving to native pytorch rather than to the apex extension it replaces.
The promise is real, but the chronology is untidy. Repository tags stop at v1.1.0 dated 2025-05-07 with the title Updating bfloat16, and the last push landed on 2026-10-08, so the working tree sits well past the newest tagged build. A researcher matching the baseline claim the project dates to 2017, or the 2019 conference results it compares itself against, had no native bf16 path to shrink memory with at that time.
That makes 2GB a property of a configuration that arrived years after the ranking numbers printed next to it, and the page never separates the two. Precision is also a switch rather than a default here, since bf16 and fp16 sit in the feature list as training options.
Rank@1=88.24% is reported beside settings its own author calls far from optimal
The README reports Rank@1=88.24% and mAP=70.68% reached with softmax loss alone, and puts that line next to three papers it says the baseline stays consistent with: the CVPR19 joint discriminative and generative learning paper, the ECCV18 refined part pooling paper, and the CVPR18 camera style adaptation paper.
A few lines later the hyperparameter note says that some of those values, with learning rate named explicitly, are far from optimal, and invites you to change them and see the effect. Two Matconvnet lines further down report Rank@1=87.74% and mAP=69.46% at `batchsize=8` with `dropout=0.75`, and the explanation offered is that different framework need to be tuned in a slightly different way.
So the headline number and its own disclaimer point the same direction. This is a tuned-by-hand starting point rather than a frozen recipe, which is the honest reading of a page that hands you the settings and then tells you the settings are unfinished. If you reproduce the figure, write down which loss option and which backbone you used, because softmax alone is credited with the result and the rest of the menu is left unattributed.
The heatmap feature points at a branch the default does not serve
Every entry in the testing feature list resolves to master or to a subfolder of it, with one exception. Visualize Heatmap links `https://github.com/layumi/Person_reID_baseline_pytorch/blob/dev/visual_heatmap.py`, a dev branch path, while the repository default branch is master and no visual_heatmap.py file appears among the top-level entries there.
Anyone who copies that link lands on a branch the project does not publish by default, and if the file never merged, that feature is reachable only after you switch branches yourself. The same listing explains the rest of the shape: root files carry the losses, the dataset preparers and the evaluators, while GPU-Re-Ranking/, colab/, docs/, tool/ and tutorial/ keep their own subtrees.
Two root entries show how long this has been running. A .travis.yml file holds continuous integration configuration and sitemap.xml holds search metadata, both parked next to the training code rather than in a tooling folder. Nothing in the listing separates research scaffolding from the pipeline itself, so the files you need for a first run have to be picked out by name.
requirements.txt names nine packages and never names torch
The dependency file fits on one screen, and exactly one line carries a constraint:
pyyaml
pretrainedmodels
timm >= 0.6.0
scipy
efficientnet_pytorch
pytorch_metric_learning
tqdm
gdown
matplotlib`timm >= 0.6.0` is that single floor. The other eight entries float and resolve to whatever the package index serves on the day you install, which means two checkouts made a month apart can end up on different versions of scipy, timm above the floor, and the metric learning stack.
torch is absent from the list entirely, which fits the project's insistence on native pytorch features such as bf16, fp16 and torch.compile, but it also means pip installs nothing that could detect a framework mismatch. There is no line for TensorRT either, even though a dedicated inference entry point, `test_with_TensorRT.py`, sits at the root.
Version skew therefore surfaces on the first run rather than at install time. The framework build, the CUDA build and the driver all have to agree before a loss is computed, and no installer will warn you first.
Losses beyond softmax ship as separate modules at the repository root
The training feature list enumerates Circle, Triplet, Contrastive, Sphere, Lifted, Arcface, Cosface and Instance Loss, then adds part-based PCB, random erasing and linear warm-up as separate options, and the tree on master mirrors that spread with `circle_loss.py`, `instance_loss.py` and `random_erasing.py` sitting beside `model.py`, `train.py` and `utils.py`.
Instance loss arrived in the v1.0.3 tag dated 2021-12-31, whose title pairs it with a feature dimension change.
On the backbone side the same list spans ResNet, ResNet-ibn and DenseNet alongside Swin Transformer, EfficientNet and HRNet, with 10x synthetic data from DG-Market offered as a training source. Nothing in that menu says which combination produced the reported ranking numbers, and the tutorial path starts from the other direction anyway, an 8 min read that ends in an answers file for quick questions.
Six prepare scripts and three evaluators define the data and ranking surface
Dataset handling is one script per corpus rather than one configurable loader. `prepare.py` sits beside `prepare_CUB.py`, `prepare_Duke.py`, `prepare_MSMT.py`, `prepare_VeRi.py`, `prepare_VehicleID.py`, `prepare_static.py` and `prepare_viper.py`, which is how the repository covers person and vehicle benchmarks side by side.
Evaluation splits three ways as well, with `evaluate.py` for the standard protocol, `evaluate_gpu.py`, and `evaluate_rerank.py` on top of `re_ranking.py` and the `GPU-Re-Ranking/` folder, alongside `test.py`, `test_MSMT.py` and `test_with_TensorRT.py` for inference and `demo.py` for a single-shot run. Multiple Query Evaluation and both CPU and GPU re-ranking are listed as supported.
TensorRT support is old enough to have its own tag, v1.0.4 dated 2022-07-25 and titled Tensor RT & Adversarial training, yet it never got a line in the dependency file. Three leaderboard directories, `leaderboard/`, `leaderboard-3D/` and `leaderboard-RGB-Infrared/`, plus a March 2023 news line announcing Market-1501 in 3D, show the repository tracking cross-modality work alongside the RGB baseline.
Two training entry points cover single-GPU Colab and multi-GPU DDP
Training is reachable through `train.py`, with `train_DDP.py` and a `DDP.sh` script at the root for the multiple-GPU path listed as DDP, and a `colab/` folder, contributed by ronghao233, that runs the code on a Google Colab free GPU.
That split matters because the memory ceiling quoted in the pitch is tied to those precision flags rather than to how many devices you own. A user without a large card is expected to reach for bf16 first and DDP second, and the README keeps those two ideas in separate lists.
Newer additions arrive as single flags rather than new files. torch.compile is listed for faster training, and the February 2026 news entry adds support for the latest DinoV3 through one option:
--use_dinoThat news entry gives no full command line.
Workshops, a language model and a geo-localization benchmark sit beside the code
A large share of the front page is project news rather than code. It announces a Multimedia Object Re-ID workshop at ACM ICMR 2024 in Phuket, opened on 12 Jan 2024 with a submission deadline of 15 April 2024 and good papers recommended to an ACM TOMM special issue, then a second workshop at ACM WWW 2025 announced on 22 Dec 2024 with a 1 Jan 2025 deadline.
An IEEE Intelligent Transportation Systems Conference special session announced on 19 Mar 2023 asks submitters to enter the session code `w7r4a`, with a paper deadline of May 15 2023 and notification on June 30 2023. An August 2023 entry points at a Large Person Language Model accepted by ACM MM, hosted in a separate repository.
The clearest statement of where the code is meant to lead is the closing pitch: the same retrieval and metric learning skills transfer to cross-view geo-localization across drone, satellite and street views, with the sibling University-1652 benchmark carrying 500+ citations. That is a pointer to other work by the same author, not a feature you enable inside this checkout.
Editorial conclusion
Treat this as a research baseline, not a product. It earns a place when you want a re-identification pipeline where every trick is a switch you can flip off, and you plan to read the code instead of the headline numbers. Not a fit if you need a packaged install or a pinned environment: eight of nine dependencies float, the newest version tag predates the working tree, and the memory figure depends on precision flags you choose yourself. Before quoting the reported Rank@1, find out which loss, backbone and precision mode produced it, since the page calls its own hyperparameters far from optimal.
Frequently asked questions
What does Person_reID_baseline_pytorch actually train?
A person and vehicle re-identification baseline written in PyTorch, described by its author as a tiny, friendly, strong Object-reID baseline since 2017, with Rank@1=88.24% and mAP=70.68% reported from softmax loss alone.
Can Person_reID_baseline_pytorch train on a 2GB GPU?
Its own pitch line says that with bf16 or fp16, supported by native pytorch, the baseline could be trained with only 2GB GPU memory. A colab/ folder covers Google Colab free GPU runs.
Which losses and backbones does Person_reID_baseline_pytorch offer?
Circle, Triplet, Contrastive, Sphere, Lifted, Arcface, Cosface and Instance Loss, plus part-based PCB, random erasing and linear warm-up. Backbones cover ResNet, ResNet-ibn, DenseNet, Swin Transformer, EfficientNet and HRNet.
What does Person_reID_baseline_pytorch need in requirements.txt?
Nine packages, of which only timm >= 0.6.0 carries a version floor. The file does not name torch, TensorRT or apex, so framework and driver compatibility is checked at run time rather than at install time.
Does Person_reID_baseline_pytorch support multi-GPU training and DinoV3?
Multi-GPU training is handled by train_DDP.py and DDP.sh at the root, torch.compile is listed for faster training, and a February 2026 news entry adds the latest DinoV3 through a single `--use_dino` flag.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/layumi-person-reid-baseline-pytorch)Star history chart for your README
[](https://hysenlabs.com/projects/layumi-person-reid-baseline-pytorch)Was this useful?