动作识别(四)手把手教你在Win11上复现mmskeleton的ST-GCN骨架动作识别模型

手把手教你在Win11上复现mmskeleton中的ST-GCN骨架动作识别模型

一、背景

本文的写作背景源于本人研究课题——基于骨架的动作识别,由于上篇文章讲解的win10系统配置OpenPose和ST-GCN动作识别不能自制数据集问题,故转战ST-GCN移植的mm框架。本文主要讲解mmskeleton环境的配置及测试,有问题的朋友可以留言评论和咨询本人QQ:2447439418。(注意:如果需要数据等资源及代码远程配置是需要有偿服务的,创作不易,望理解!!!)强调一下:mmskeleton默认使用cascade-rcnn模型做为人体检测器、Hrnet模型作为姿态估计器及ST-GCN模型进行动作识别,因此你使用此框架学习ST-GCN的话,就不需要配置OpenPose了。

二、基础环境

(1)Win11系统(笔记本);
(2)RTX2060显卡,6G显存;
(3)显卡驱动信息:
在这里插入图片描述
(4)VS2019软件(自行安装,可搜索mmdetection2-windows环境配置参考安装,建议安装位置选择默认,避免后续麻烦);
(5)CUDA10.1信息(这里自行参考网上资料安装);
在这里插入图片描述

三、详细步骤

参考来源: link.
3.1创建虚拟环境及安装pytorch

conda create -n mmd python=3.7	
conda activate mmd
conda install pytorch=1.3 torchvision cudatoolkit=10.1 
pip install cython opencv-python pillow  matplotlib

3.2修改torch源码
1.修改 环境目录下\Lib\site-packages\torch\include\c10\util\flat_hash_map.h中的这个头文件。
(1)注释或删掉第24行,示例如下:

#include <cstdint>
#include <cstddef>
#include <functional>
#include <cmath>
#include <algorithm>
#include <iterator>
#include <utility>
#include <type_traits>
// #include <stdexcept>

(2)1379-1398行左右,注释或删掉具体如下:

//    std::pair<typename Table::iterator, bool> emplace()
//    {
//        return emplace(key_type(), convertible_to_value());
//    }
//    template<typename M>
//    std::pair<typename Table::iterator, bool> insert_or_assign(const key_type & key, M && m)
//    {
//        auto emplace_result = emplace(key, std::forward<M>(m));
//        if (!emplace_result.second)
//            emplace_result.first->second = std::forward<M>(m);
//        return emplace_result;
//    }
//    template<typename M>
//    std::pair<typename Table::iterator, bool> insert_or_assign(key_type && key, M && m)
//    {
//        auto emplace_result = emplace(std::move(key), std::forward<M>(m));
//        if (!emplace_result.second)
//            emplace_result.first->second = std::forward<M>(m);
//        return emplace_result;
//    }

(4)1473-1493行左右,注释或删掉

//    template<typename... Args>
//    std::pair<typename Table::iterator, bool> emplace(Args &&... args)
//    {
//        return Table::emplace(T(std::forward<Args>(args)...));
//    }
//    std::pair<typename Table::iterator, bool> emplace(const key_type & arg)
//    {
//        return Table::emplace(arg);
//    }
//   std::pair<typename Table::iterator, bool> emplace(key_type & arg)
//    {
//        return Table::emplace(arg);
//    }
//    std::pair<typename Table::iterator, bool> emplace(const key_type && arg)
//    {
//        return Table::emplace(std::move(arg));
//    }
//    std::pair<typename Table::iterator, bool> emplace(key_type && arg)
//    {
//        return Table::emplace(std::move(arg));
//    }

2.修改 环境目录下\Lib\site-packages\torch\include\c10\util\order_preserving_flat_hash_map.h
(1)注释或删除1499-1518行

//    std::pair<typename Table::iterator, bool> emplace()
//    {
//        return emplace(key_type(), convertible_to_value());
//    }
//    template<typename M>
//    std::pair<typename Table::iterator, bool> insert_or_assign(const key_type & key, M && m)
//    {
//        auto emplace_result = emplace(key, std::forward<M>(m));
//        if (!emplace_result.second)
//            emplace_result.first->second = std::forward<M>(m);
//        return emplace_result;
//    }
//    template<typename M>
//    std::pair<typename Table::iterator, bool> insert_or_assign(key_type && key, M && m)
//    {
//        auto emplace_result = emplace(std::move(key), std::forward<M>(m));
//        if (!emplace_result.second)
//            emplace_result.first->second = std::forward<M>(m);
//        return emplace_result;
//    }

(2)注释或删除1593-1613行

//    template<typename... Args>
//    std::pair<typename Table::iterator, bool> emplace(Args &&... args)
//    {
//        return Table::emplace(T(std::forward<Args>(args)...));
//    }
//    std::pair<typename Table::iterator, bool> emplace(const key_type & arg)
//    {
//        return Table::emplace(arg);
//    }
//    std::pair<typename Table::iterator, bool> emplace(key_type & arg)
//    {
//        return Table::emplace(arg);
//    }
//    std::pair<typename Table::iterator, bool> emplace(const key_type && arg)
//    {
//        return Table::emplace(std::move(arg));
//    }
//    std::pair<typename Table::iterator, bool> emplace(key_type && arg)
//    {
//        return Table::emplace(std::move(arg));
//    }

3.修改 环境目录下\Lib\site-packages\torch\utils\cpp_extension.py
188行修改成:

match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode("gbk").strip())

4.修改 环境目录下\Lib\site-packages\torch\include\torch\csrc\jit\argument_spec.h
190行左右修改:
static conststr size_t DEPTH_LIMIT = 128;
替换为static const size_t DEPTH_LIMIT = 128;
5.修改 环境目录下\Lib\site-packages\torch\include\pybind11\cast.h
1448行左右
explicit operator type&() { return *(this->value); }
替换为explicit operator type& () { *((type*)(this->value)); }
3.3.pycocotools安装
https://github.com/philferriere/cocoapi下载源码,并进行解压。以管理员身份打开 CMD 终端,并切换到 cocoapi\PythonAPI目录。运行以下指令:

python setup.py build_ext --inplace
python setup.py build_ext install

3.4mmdeteciton安装
1.mmcv安装,安装命令

pip install mmcv==0.4.0

2.mmdetection-1.0.0安装
官网: link.
先在官网下载mmdection-1.0.0并解压,然后windows命令窗口cd到mmdection-1.0.0目录,输入命令:

pip install -r requirements.txt

接着,修改其setup.py文件中CUDAExtension中extra_compile_args相关代码,增加cxx的"-DMS_WIN64",“-MD”,并安装:

python setup.py develop

3.5mmskeleton安装
官网: link.
安装命令:

git clone https://github.com/open-mmlab/mmskeleton.git
cd mmskeleton
python setup.py develop
  • 1
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DMK已被注册

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值