打印
[应用相关]

复现STGCN CPU版(ubuntu16.04+pytorch0.4.0+openpose+caffe)

[复制链接]
720|13
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
前提:ubuntu下将python3.5.2设为默认(百度)

一.下载stgcn

(gitbub上fork后导入到gitee快些):  https://gitee.com/chenhongqiong/st-gcn.git

二.开始配置
1.安装pytorch0.4.0:

sudo pip3 install torch==0.4.0 -f https://download.pytorch.org/whl/cup/stable -i https://pypi.tuna.tsinghua.edu.cn/simple

2.openpose pythonAPI

https://blog.csdn.net/weixin_42661709/article/details/104771419

3.下载依赖包:

sudo apt-get install ffmpeg

pip3 install -r requirements.txt

使用特权

评论回复
沙发
远芳侵古道|  楼主 | 2021-5-21 14:00 | 只看该作者
4.安装
cd st-gcn
cd torchlight;
sudo python3 setup.py install;
cd ..

使用特权

评论回复
板凳
远芳侵古道|  楼主 | 2021-5-21 14:02 | 只看该作者
5.下载模型
法一(相当慢):bash tools/get_models.sh 

使用特权

评论回复
地板
远芳侵古道|  楼主 | 2021-5-21 14:05 | 只看该作者
法二:从别人的网盘下载(https://editor.csdn.net/md/?articleId=105060886)

           pose_iter_440000.caffemodel放到st-gcn/models/pose/coco中

           st_gcn.kinetics.pt等文件  放到 st-gcn/models中

使用特权

评论回复
5
远芳侵古道|  楼主 | 2021-5-21 14:06 | 只看该作者

使用特权

评论回复
6
远芳侵古道|  楼主 | 2021-5-21 14:07 | 只看该作者
6.运行Demo(配置差可以试个短视频就几帧那种。想跑图片就把.jpg改成.mp4)
python main.py demo [--video ${PATH_TO_VIDEO}] [--openpose ${PATH_TO_OPENPOSE}]

使用特权

评论回复
7
远芳侵古道|  楼主 | 2021-5-21 14:09 | 只看该作者
新版STGCN:python3 main.py demo --openpose '/home/chq/openpose/build' --video '/home/chq/st-gcn/resource/media/skateboarding.mp4'

旧版:python3 main.py demo_old --video /home/chq/st-gcn/resource/media/test.mp4 --openpose  /home/chq/openpose/build

旧版默认保存在 ./data/demo_result/下,也可以自己设置保存位置如:--output_dir /home/chq/st-gcn/resource/media_out

使用特权

评论回复
8
远芳侵古道|  楼主 | 2021-5-21 14:10 | 只看该作者
第一个图是10秒的视频我跑了两天.....第二个图是改图片后缀了测试的图片

使用特权

评论回复
9
远芳侵古道|  楼主 | 2021-5-21 14:13 | 只看该作者

使用特权

评论回复
10
远芳侵古道|  楼主 | 2021-5-21 14:14 | 只看该作者
6.解决错误:
1.cpu版的cuda问题

使用特权

评论回复
11
远芳侵古道|  楼主 | 2021-5-21 14:15 | 只看该作者
device = torch.device("cuda" if args.cuda else "cpu")。将io.py中103行True修改为False

使用特权

评论回复
12
远芳侵古道|  楼主 | 2021-5-21 14:16 | 只看该作者

使用特权

评论回复
13
远芳侵古道|  楼主 | 2021-5-21 14:17 | 只看该作者
2.RuntimeError: Error(s) in loading state_dict for Model

使用特权

评论回复
14
远芳侵古道|  楼主 | 2021-5-21 14:19 | 只看该作者
问题解决:
原因是作者提供(bash tools/get_models.sh)的模型参数—— st_gcn.kinetics.pt 有问题。所以要下载从另外的途径下载可用的文件https://pan.baidu.com/s/1JrfpRqt0uF8AydiJuxANZw#list/path=%2F&parentPath=%2Fsharelink53688367-280314025530152

(password: j4rt )。放到models下后重新测试运行。\

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

67

主题

757

帖子

0

粉丝