This repository contains two implementations for Person Re-Identification in video streams using machine learning techniques. The first is an older method based on image-based similarity comparison, while the second is a more recent approach leveraging YOLOv8 and Siamese networks for multi-frame analysis.
In this implementation, we extract features from pairs of images and compare them to determine if they belong to the same person. The process involves:
- Pairwise comparison using a simple metric learning method (Mahalanobis Distance).
Results:
The results for this implementation are stored as two example images showcasing person re-identification:
Test Images
Similarity Ranks

This newer method integrates object detection with deep learning for more robust re-identification:
- YOLOv8 is used to detect and track people in video frames.
- A Siamese network is employed to compare feature vectors and compute similarity scores for re-identification.
- Multi-frame analysis and a dynamic reference management system handle occlusions and re-entries of individuals.
The results for this implementation are demonstrated in a video, which can be found at the following link: Watch the result video here
To run the code for both implementations, install the following dependencies:
pip install -r requirements.txt- PyTorch
- OpenCV
- YOLOv8
- Install the required dependencies:
pip install -r requirements.txt
- Run the
metric_learning.pyscript:python metric_learning.py
- Install the required dependencies:
pip install -r requirements.txt
- Request the model weights by contacting the repository maintainer.
- Once you have the weights, open and run
inference.ipynbto perform person re-identification on video streams.
The new implementation using YOLOv8 and Siamese networks provides more robust and accurate results for person re-identification in video streams, particularly in dynamic and crowded environments. The video-based system also handles occlusions and re-entries, making it a significant improvement over the old image-based approach.
For detailed results, refer to the example images and the linked video.