vehicle-reid-veri776
a model for matching vehicles across different cameras
2 min readupdated
This model tackles vehicle re-identification (vehicle Re-ID): it takes a photo of a car and converts it into a 2048-dimensional vector (embedding). Capture the same vehicle from different angles or on other cameras, and the resulting vectors will sit very close to each other. Built on a ResNet50 backbone with architectural enhancements (including BNNeck and center loss) and trained on the VeRi-776 dataset, it is well-suited for video analytics developers, computer vision researchers, and anyone working on duplicate detection or visual object matching.
Key features
- High accuracy: reaches 78.3% mAP and 96.0% Rank-1 on the VeRi-776 test set.
- Re-ranking post-processing: applying k-reciprocal encoding boosts mAP to 80.6%.
- Solid architecture: pairs a strong ResNet50 baseline with triplet loss and center loss for better class separation.
- Efficient training: trained on a single RTX 4050 GPU in just 8.8 hours using mixed precision.
What you can do
- Search vehicles in a database: compare a target car's vector against an image gallery to automatically retrieve matching frames.
- Integrate into a pipeline: use the ready-made PyTorch implementation to extract vehicle embeddings from surveillance footage.
- Experiment with re-ranking: apply the k-reciprocal algorithm to refine result ordering in your search gallery.
- Explore the code: inspect a clean PyTorch strong baseline implementation with detailed augmentation and loss configurations.
Example
import torch
from reid.models.baseline import Baseline
from reid.data.transforms import build_transforms
from PIL import Image
model = Baseline(num_classes=576, pretrained=False)
model.load_state_dict(torch.load("vehicle_reid_baseline.pt", map_location="cpu"))
model.eval()
transform = build_transforms(train=False)
image = transform(Image.open("carro.jpg").convert("RGB")).unsqueeze(0)
with torch.no_grad():
embedding = torch.nn.functional.normalize(model(image), dim=1)
Read more
DetailsBenchmarks: 78.3% mAP (80.6% with re-ranking), 96.0% Rank-1 (96.5% with re-ranking).
Hardware requirements: trained on 1x RTX 4050 (6 GB VRAM).
Limitations: trained solely on daytime VeRi-776 data from 20 cameras; sensitive to severe lighting changes and does not recognize license plates.










Comments