yolov5-slowfast-deepsort-PytorchVideo
yolov5-slowfast-deepsort-PytorchVideo copied to clipboard
Yolov5+SlowFast+deepsort: Action Detection(PytorchVideo)
A realtime action detection frame work based on PytorchVideo.
Here are some details about our modification:
- we choose yolov5 as an object detector instead of Faster R-CNN, it is faster and more convenient
- we use a tracker(deepsort) to allocate action labels to all objects(with same ids) in different frames
- our processing speed reached 24.2 FPS at 30 inference batch size (on a single RTX 2080Ti GPU)
参考:
Demo comparison between original and ours.

Installation
使用AI平台:https://cloud.videojj.com/auth/register?inviter=18452&activityChannel=student_invite
-
environment 环境
Pytorch 1.10.1 Python 3.8 Cuda 11.1 -
安装PytorchVideo:
cd /home git clone https://gitee.com/YFwinston/pytorchvideo.git cd pytorchvideo pip install -e .apt update apt install libgl1-mesa-glx -
clone this repo:
使用github
cd /home git clone https://github.com/Whiffe/yolov5-slowfast-deepsort-PytorchVideo.git或者使用gitee
cd /home git clone https://gitee.com/YFwinston/yolov5-slowfast-deepsort-PytorchVideo.git -
create a new python environment (optional 可选):
conda create -n {your_env_name} python=3.8.12 conda activate {your_env_name} -
install requiments:
cd /home/yolov5-slowfast-deepsort-PytorchVideo pip install -r requirements2.txt -
download weights file(ckpt.t7) from [yolov5_file] to this folder:
./deep_sort/deep_sort/deep/checkpoint/我是将ckpt.t7放在了:/user-data/yolov5_file/
所以执行:
mkdir -p /home/yolov5-slowfast-deepsort-PytorchVideo/deep_sort/deep_sort/deep/checkpoint/ cp /user-data/yolov5_file/ckpt.t7 /home/yolov5-slowfast-deepsort-PytorchVideo/deep_sort/deep_sort/deep/checkpoint/ckpt.t7 -
download file(SLOWFAST_8x8_R50_DETECTION.pyth) from [slowfast_file] to this folder:
我是将SLOWFAST_8x8_R50_DETECTION.pyth放在了:/user-data/slowfast_file/
所以执行:
mkdir -p /root/.cache/torch/hub/checkpoints/ cp /user-data/slowfast_file/SLOWFAST_8x8_R50_DETECTION.pyth /root/.cache/torch/hub/checkpoints/SLOWFAST_8x8_R50_DETECTION.pyth -
download file(yolov5l6.pt) from [yolov5_file] to this folder:
我是将yolov5l6.pt放在了:/user-data/yolov5_file/
所以执行:
cp /user-data/yolov5_file/yolov5l6.pt /home/yolov5-slowfast-deepsort-PytorchVideo/yolov5l6.pt -
download file(master.zip) from [yolov5_file] to this folder:
我是将yolov5-master.zip放在了:/user-data/yolov5_file/
所以执行:
cp /user-data/yolov5_file/yolov5-master.zip /root/.cache/torch/hub/master.zip -
test on your video:
python yolo_slowfast.py --input {path to your video}我将1.mp4存放在了/home/yolov5-slowfast-deepsort-PytorchVideo/demo/中
所以执行:
cd /home/yolov5-slowfast-deepsort-PytorchVideo mkdir democd /home/yolov5-slowfast-deepsort-PytorchVideo python yolo_slowfast.py --input ./demo/1.mp4The first time execute this command may take some times to download the yolov5 code and it's weights file from torch.hub, keep your network connection.
References
Thanks for these great works:
[2] ZQPei/deepsort
[4] AVA: A Video Dataset of Spatio-temporally Localized Atomic Visual Actions. paper
[5] SlowFast Networks for Video Recognition. paper
Citation
If you find our work useful, please cite as follow:
{ yolo_slowfast,
author = {Wu Fan},
title = { A realtime action detection frame work based on PytorchVideo},
year = {2021},
url = {\url{https://github.com/wufan-tb/yolo_slowfast}}
}