A computer vision and deep learning project for counting and tracking passengers using head recognition.
This project was developed by both Swiss and Chinese students as part of a joint venture between University of Applied Science Northwestern Switzerland FHNW and Shenzhen Technology University SZTU.
Standard | Custom |
---|---|
The main task includes to count passenger flows in a metro station. Therefore YOLOv5 and Deep Sort as well as a counting mechanism were merged (from already existing Repos). In addition, new weights of both YOLO and the feature extractor of Deep Sort were trained using custom datasets.
The following repos were adapted and reused for this purpose:
YOLOv5 + Deep Sort Baseline Implementation
Setup + Training of a Siamese Network for Custom Head Tracking
First, clone the repository:
git clone git@github.com:bill-lou/YOLOv5s-pytorch-deepsort-passenger-counting.git
Use this command to install all the necessary packages. Note that we are using python3
pip install -r requirements.txt
There are two wheights available for YOLOv5, make sure to adjust the parser argument in count.py
befor running the code
You can Download the Weights from:
yolov5x.pt for standard YOLO Detection
parser.add_argument('--weights',
type=str,
default='yolov5/weights/yolov5x.pt',
help='model.pt path')
custom_train_best.pt for Custom Head Detection
parser.add_argument('--weights',
type=str,
default='yolov5/weights/custom_train_best.pt',
help='model.pt path')
Download as well the Deep Sort Checkpoints and add it to the folder deep_sort_pytorch\deep_sort\deep\checkpoint
You can Download the Checkpoints from:
IN and Out Folder
Input Video Stream Add your input Stream (Video File) into the in folder
Output Video Stream Once the code is successfully completed - you should find a video of your input + stream + the augmentend information of tracker, detector and counting in the out folder
Counting Line + YOLO + Deep Sort Standard
python3 count.py --deepsort 1
Counting Line + YOLO + Deep Sort Custom
python3 count.py --deepsort 2
YOLO + Deep Sort Standard
python3 track.py --deepsort 1
YOLO + Deep Sort Custom
python3 track.py --deepsort 2