ST-GCN可视化(python mmskl.py pose_demo)

运行该命令获取的视频结果与运行HRNet中的demo/inference.py效果相同。

一、遵循官网程序运行命令

python mmskl.py pose_demo [--gpus $GPUS]
# or "python mmskl.py pose_demo_HD [--gpus $GPUS]" for a higher accuracy

运行过程:
mmskl.py——>./configs/pose_estimation/pose_demo.yaml——>(pose_demo.py)mmskeleton.processor.pose_demo.inference——>(pose_demo.py)mmskeleton.apis.estimation.init_pose_estimator(姿态估计hrnet)——>(estimation.py)mmdet.apis.inference.init_detector(目标检测cascade_rcnn)——>(estimation.py)mmskeleton.processor.apis.init_twodimestimator——>(apis.py)mmskeleton.utils.load_checkpoint(加载人体姿态估计模型权重文件)

~注:此过程只加载目标检测模型和人体姿态估计模型,无需加载动作识别模型。

二、
报错:权重文件不存在

OSError: F:/Action Recognition/st-gcn/checkpoints/cascade_rcnn_r50_fpn_20e_20181123-db483a09.pth is not a checkpoint file
(open) F:\Action_Recognition\st-gcn>python mmskl.py pose_demo --video resource/data_example/50.mp4
Load configuration information from ./configs/pose_estimation/pose_demo.yaml

Pose estimation:
Traceback (most recent call last):
  File "mmskl.py", line 147, in <module>
    main()
  File "mmskl.py", line 126, in main
    call_obj(**cfg.processor_cfg)
  File "F:\Action_Recognition\st-gcn\mmskeleton\utils\importer.py", line 34, in call_obj
    return import_obj(type)(**kwargs)
  File "F:\Action_Recognition\st-gcn\mmskeleton\processor\pose_demo.py", line 80, in inference
    model = init_pose_estimator(detection_cfg, estimation_cfg, device=0)
  File "F:\Action_Recognition\st-gcn\mmskeleton\apis\estimation.py", line 23, in init_pose_estimator
    device='cuda:0')
  File "H:\Anaconda3\envs\open\lib\site-packages\mmdet-1.0+unknown-py3.6-win-amd64.egg\mmdet\apis\inference.py", line 36, in init_detector
    checkpoint = load_checkpoint(model, checkpoint)
  File "H:\Anaconda3\envs\open\lib\site-packages\mmcv\runner\checkpoint.py", line 184, in load_checkpoint
    checkpoint = _load_checkpoint(filename, map_location)
  File "H:\Anaconda3\envs\open\lib\site-packages\mmcv\runner\checkpoint.py", line 161, in _load_checkpoint
    raise IOError('{} is not a checkpoint file'.format(filename))
OSError: F:/Action Recognition/st-gcn/checkpoints/cascade_rcnn_r50_fpn_20e_20181123-db483a09.pth is not a checkpoint file

原因:文件路径名错误
解决:将Action Recognition改为Action_Recognition即可成功运行。
前提:将mmskeleton.apis.estimation.py中的权重加载路径改为绝对路径。
在这里插入图片描述

三、
报错:加载到的模型权重不完全匹配。

The model and loaded state dict do not match exactly

在这里插入图片描述
原因:pose_demo.py只输出二维目标检测框和人体姿态,所以无需加载ST-GCN模型。
解决:修改权重加载文件mmskeleton.utils.checkpoint.py中的路径为原程序中的路径即可。

def load_checkpoint(model, filename, *args, **kwargs):
    try:
#         filename = "F:/Action_Recognition/st-gcn/checkpoints/st_gcn.kinetics-6fa43f73.pth"################################
#         filename = "F:/Action_Recognition/st-gcn/work_dir/recognition/ST_GCN_18/kinetics-skeleton/epoch_50.pth"################################
#         filename = "F:/Action_Recognition/st-gcn/work_dir/recognition/ST_GCN_18/kinetics-skeleton_all/epoch_50.pth"################################                
        filename = get_mmskeleton_url(filename)

在这里插入图片描述
四、运行成功
获取到包含检测框和关键点的人体动作视频。
在这里插入图片描述

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值