1. Environment
ubuntu16.04
cuda10.1
cudnn7
python3.6
Cython
matplotlib>=3.2.2
numpy>=1.18.5
opencv-python>=4.1.2
Pillow
PyYAML>=5.3
scipy>=1.4.1
tensorboard>=2.2
torch>=1.7.0
torchvision>=0.8.1
tqdm>=4.41.0
seaborn>=0.11.0
easydict
2. Preparation
2.0 Prepare code and data
Code:
git clone --recurse-submodules https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch.git
TownCentreXVID.avi test video data: https://download.csdn.net/download/qq_35975447/12495835
2.1 Re-identification/classification model
Download ckpt.t7 in the following directory
https://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6
Put it in the directory:
2.2 yolov5 target detection model
In the following directory, download a minimal model yolov5s.pt . If the speed is too slow, right click to copy the link, and then use the wget command to download.
https://github.com/ultralytics/yolov5/releases
Put it in the directory:
3. Test
3.1 Modification
Change all f"{a}" in yolov5/utils/datasets.py to "{}".format(a).
E.g:
# line 1016
assert cv2.imwrite(str(f), im[b[1]:b[3], b[0]:b[2]]), f'box failure in {f}'
#改为:
assert cv2.imwrite(str(f), im[b[1]:b[3], b[0]:b[2]]), 'box failure in {}'.format(f)
3.2 Test
python track.py --source TownCentreXVID.avi --save-txt
Since the author has given a dynamic gif, here I only give a static picture.