【PyTorchVideo教程02】快速安装PyTorchVideo 采用 yolov5、slowfast、deepsort对学生课堂行为进行检测

目录

  • 0 前言
  • 1 GPU平台
  • 2 安装PyTorchVideo
  • 3 安装yolov5-slowfast-deepsort-PytorchVideo
    • 3.1 下载yolov5-slowfast-deepsort-PytorchVideo
    • 3.2 安装
    • 3.3 下载文件
    • 3.4 测试
    • 3.5 结果

0 前言

本文项目:
github:https://github.com/Whiffe/yolov5-slowfast-deepsort-PytorchVideo
gitee:https://gitee.com/YFwinston/yolov5-slowfast-deepsort-PytorchVideo

b站视频:https://www.bilibili.com/video/BV1aP41137g6

在上一篇博客中:
【PyTorchVideo教程01】快速实现视频动作识别

可以发现PyTorchVideo的安装速度比较慢,其实官网提供了几种方法:
https://github.com/facebookresearch/pytorchvideo/blob/main/INSTALL.md

本文参考来自:
Yolov5+SlowFast: 基于PytorchVideo的实时行为检测算法

1 GPU平台

本文项目在极链AI中搭建:
https://cloud.videojj.com/auth/register?inviter=18452&activityChannel=student_invite

【PyTorchVideo教程02】快速安装PyTorchVideo 采用 yolov5、slowfast、deepsort对学生课堂行为进行检测_第1张图片

环境

Pytorch 1.10.1
Python 3.8
Cuda 11.1

2 安装PyTorchVideo

cd /home
git clone https://gitee.com/YFwinston/pytorchvideo.git
cd pytorchvideo
pip install -e .
apt update
apt install libgl1-mesa-glx -y

3 安装yolov5-slowfast-deepsort-PytorchVideo

3.1 下载yolov5-slowfast-deepsort-PytorchVideo

使用gitee(推荐)

cd /home
git clone https://gitee.com/YFwinston/yolov5-slowfast-deepsort-PytorchVideo.git

3.2 安装

cd /home/yolov5-slowfast-deepsort-PytorchVideo
pip install -r requirements2.txt

3.3 下载文件

[yolov5_file]
[slowfast_file]

我是将ckpt.t7放在了:/user-data/yolov5_file/
我是将SLOWFAST_8x8_R50_DETECTION.pyth放在了:/user-data/slowfast_file/
我是将yolov5l6.pt放在了:/user-data/yolov5_file/
我是将yolov5-master.zip放在了:/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

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

cp /user-data/yolov5_file/yolov5l6.pt /home/yolov5-slowfast-deepsort-PytorchVideo/yolov5l6.pt

cp /user-data/yolov5_file/yolov5-master.zip /root/.cache/torch/hub/master.zip

3.4 测试

我将1.mp4存放在了/home/yolov5-slowfast-deepsort-PytorchVideo/demo/中

cd /home/yolov5-slowfast-deepsort-PytorchVideo
mkdir demo
cd /home/yolov5-slowfast-deepsort-PytorchVideo
python yolo_slowfast.py --input ./demo/1.mp4

3.5 结果

【PyTorchVideo教程02】快速安装PyTorchVideo 采用 yolov5、slowfast、deepsort对学生课堂行为进行检测_第2张图片

b站:视频检测结果https://www.bilibili.com/video/BV1rV4y1u7uq

【PyTorchVideo教程02】检测结果 快速安装PyTorchVideo 采用 yolov5、slowfast、deepsort对学生课堂行为进行检测 视

你可能感兴趣的:(python,yolov5,slowfast,deepsort)