当前位置: 首页 > news >正文

上海专业网站建设服/如何做运营推广

上海专业网站建设服,如何做运营推广,网站设计公司 广州,网页访问自动跳转中文章目录1 Alphapose2 环境配置2.1 官方安装说明2.2 Anaconda创建虚拟环境Alphapose2.3 获取Alphapose仓库2.4 安装相关依赖库2.4.1 激活虚拟环境Alphapose2.4.2 安装Pytorch和torchvision2.4.3 安装cython2.4.4 运行python setup.py build develop --user2.5 踩的坑2.5.1 pyco…

文章目录

  • 1 Alphapose
  • 2 环境配置
    • 2.1 官方安装说明
    • 2.2 Anaconda创建虚拟环境Alphapose
    • 2.3 获取Alphapose仓库
    • 2.4 安装相关依赖库
      • 2.4.1 激活虚拟环境Alphapose
      • 2.4.2 安装Pytorch和torchvision
      • 2.4.3 安装cython
      • 2.4.4 运行python setup.py build develop --user
    • 2.5 踩的坑
      • 2.5.1 pycocotools
      • 2.5.2 deform_conv_cuda
      • 2.5.3 deform_conv_cuda编译出错时的解决方案
    • 2.6 nonzero(Tensor input, *, Tensor out)的警告
    • 2.7 所有的依赖库
  • 3 下载预训练模型和配置文件
  • 4 demo试运行

1 Alphapose

github地址:https://github.com/MVIG-SJTU/AlphaPose

Alphapose最初发布采用的是pytorch 0.4.0版本,不过现在使用的都是Pytorch 1.1+版本。

目前Pytorch 1.1+版本不像之前pytorch 0.4.0版本的安装只需要使用:

pip install -r requirements.txt

安装即可,目前这里面有很多坑,下面来一步一步的进行说明。

截止写博客的时间,当前的版本为0.4.0。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ykAjc01h-1617008869158)(https://www.stubbornhuang.com/wp-content/uploads/2021/03/wp_editor_md_1c3210b78d0f30e288a6e02771f6ba31.jpg)]

2 环境配置

2.1 官方安装说明

文档地址:https://github.com/MVIG-SJTU/AlphaPose/blob/master/docs/INSTALL.md

依赖说明:

  • 操作系统:Linux和Windows均可
  • Cuda
  • Python 3.5+
  • Cython
  • PyTorch 1.1+, 如果使用Pytorch 1.5以及更高版本,需要在拉取仓库之后合并远程代码:git pull origin pull/592/head
  • torchvision 0.3.0+
  • numpy

从这里看出需要首先安装好Cuda,Python版本需要在3.5以上,Pytorch版本最好使用1.1.0,如果需要使用Pytorch 1.5以及1.5+版本的则需要在已有分支上再合并代码,同时torchvision的版本最好使用0.3.0,另外的就是安装numpy。

下面我们根据上述官方安装文档一步一步配置Alphapose的环境,揭露下在windows中配置环境遇到的一些坑。

2.2 Anaconda创建虚拟环境Alphapose

使用Anaconda创建一个新的虚拟环境Alphapose,在系统命令行工具中输入以下命令,我现在使用的命令行工具为Cmder:

conda create -n Alphapose python=3.6

上述命令在创建一个Alphapose的虚拟环境的设置Python版本为3.6并自动安装了Python版本。

2.3 获取Alphapose仓库

使用git将Alphapose克隆到本地,这里不再赘述。

2.4 安装相关依赖库

2.4.1 激活虚拟环境Alphapose

在命令行工具使用:

activate Alphapose

激活当前虚拟环境,将Alphapose虚拟环境作为当前操作环境。

2.4.2 安装Pytorch和torchvision

在虚拟环境Alphapose下使用以下命令安装pytorch 1.1.0 torchvision 0.3.0:

conda install pytorch=1.1.0 torchvision=0.3.0 -c pytorch

2.4.3 安装cython

在虚拟环境Alphapose下使用以下命令安装cpython:

pip install cython

2.4.4 运行python setup.py build develop --user

安装完上述三个库之后,我们使用:

python setup.py build develop --user

安装更多的依赖库,可能有些库会因为网络问题安装失败,多次尝试或者修改Anaconda的conda镜像源以及pip镜像源即可,根据错误提示,一个一个依次安装未安装好的库即可。

2.5 踩的坑

在运行2.4.4的命令过程中,会遇到一些坑,这里详细进行说明并给出解决方案,不过之前先说明下本机已经安装了vs2015和vs2019,至于没有安装这两个开发环境导致其他的问题不在本节说明的范围之内。

2.5.1 pycocotools

在Alphapose仓库的setup.py中的main函数中,我们发现进行了这样一行说明:

Windows need pycocotools here: https://github.com/philferriere/cocoapi#subdirectory=PythonAPI

这个pycocotools在这个 https://github.com/philferriere/cocoapi 的子目录PythonAPI下,而官方强调了windows系统需要安装这个库,但是在安装过程中,经常会因为网络问题失败,不能使用pip远程安装github仓库,所以我们需要将这个仓库克隆下来手动切换到该仓库的PythonAPI文件夹下,使用该文件夹下的setup.py文件手动安装pycocotools库,操作步骤如下。

记住所有的操作必须处于Alphapose虚拟环境之下,在PythonAPI目录下执行以下命令:

# 编译
python setup.py build
# 安装
python setup.py install

通过这种方式即可完成pycocotools的安装。

我们可以再次运行2.4.4中的

python setup.py build develop --user

查看所有依赖是否安装完成。

2.5.2 deform_conv_cuda

官方安装指南对于Windows系统特别的添加了下面一段话:

The installation process is same as above. But note that Windows users may face problem when installing cuda extension. Thus we disable the cuda extension in the setup.py by default. The affect is that models ended with “-dcn” is not supported. If you force to make cuda extension by modify this line to True, you should install Visual Studio due to the problem mentioned here. We recommend Windows users to run models like FastPose, FastPose-duc, etc., as they also provide good accuracy and speed.

对于windows用户在安装cuda扩展上可能会出现问题,所以官方在setup.py的124行默认设置为False。这导致即使我们按照2.4.4节安装了所有的依赖库,在我们运行demo的时候会出现以下错误:

cannot import name 'deform_conv_cuda'

导致demo运行不成功,所以我们必须手动的将setup.py的124行修改为True:

在这里插入图片描述

强制编译cuda扩展。

修改完成之后,再次运行2.4.4节中的命令行:

python setup.py build develop --user

上述官方说明是需要安装visual studio,正如前文提到的,我已经在本机上安装了visual studio 2015和visual studio 2019,但是还是出现了以下的错误:

unsupported Microsoft Visual Studio version! Only the versions between 2013 and 2017 (inclusive) are supported!

可是我明明装了vs2015啊!

我以为到这一步所做的工作都白费了,但是皇天不服有心人!

直到我看见这两位大神的解决方案:

  • http://blog.zhazhafang.cn/?p=177
  • http://blog.sina.com.cn/s/blog_6ebfb74c0102x7zl.html

先使用everything全局搜索host_config.h文件,在我本机上该文件的路径为:

D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include\crt

果然在该文件的143行找到了错误提示

在这里插入图片描述

根据上述两篇博文的提示,将该文件的141行,从:

#if _MSC_VER < 1700 || _MSC_VER >= 1920

修改为:

#if _MSC_VER < 1700 || _MSC_VER >= 2000 /*1920*/

保存。

然后再次运行2.4.4安装依赖,发现没有出现那个错误,编译正常,所有库都安装完成,bingo!!!

注意:编译完成之后建议马上恢复默认!

2.5.3 deform_conv_cuda编译出错时的解决方案

如果按照2.5.2节编译出现了错误,其实也没有很大的关系,官方是这么说的:

The installation process is same as above. But note that Windows users may face problem when installing cuda extension. Thus we disable the cuda extension in the setup.py by default. The affect is that models ended with “-dcn” is not supported.

如果cuda extension没有安装成功只是会影响-dcn结尾的模型加载,也就是说只影响以下模型的加载:
在这里插入图片描述
所以我们大可以保持默认,即setup.py第124行

force_comile=False

保持不变。

然后修改两处地方:

  • alphapose\models\layers\dcn\deform_conv.py注释第9行:from . import deform_conv_cuda
  • alphapose\models\layers\dcn\deform_pool.py注释第7行:from . import deform_pool_cuda

这样就不会再出现

ImportError: cannot import name ‘deform_conv_cuda’ from ‘alphapose.models.layers.dcn’

这种错误了,只要不是加载-dcn的模型,其他模型还是可以正常使用的!

2.6 nonzero(Tensor input, *, Tensor out)的警告

当使用Pytorch1.5+版本时,会出现以下类似的警告:

nonzero(Tensor input, *, Tensor out)
Consider using one of the following signatures instead:
nonzero(Tensor input, *, bool as_tuple) (Triggered internally at …\torch\csrc\utils\python_arg_parser.cpp:766.)
ind_nz = torch.nonzero(prediction[:,:,4]).transpose(0,1).contiguous()

参考链接:https://blog.csdn.net/dong_liuqi/article/details/106526403以及官方文档

即将:

ind_nz = torch.nonzero(prediction[:,:,4]).transpose(0,1).contiguous()

修改为:

ind_nz = torch.nonzero(prediction[:,:,4],as_tuple =False).transpose(0,1).contiguous()

即可消除警告。

as_tuple未true的时候意思就是返回一个bool元组。而我们一般都是想让其返回一个tensor,因此这里该参数就赋值为false。

2.7 所有的依赖库

所有安装的依赖库可参照如下:

blas                      1.0                         mkl    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
certifi                   2020.12.5        py36haa95532_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cffi                      1.14.5           py36hcd4344a_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
chardet                   4.0.0                    pypi_0    pypi
cudatoolkit               10.0.130                      0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cycler                    0.10.0                   pypi_0    pypi
cython                    0.29.22                  pypi_0    pypi
cython-bbox               0.1.3                    pypi_0    pypi
freetype                  2.10.4               hd328e21_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
idna                      2.10                     pypi_0    pypi
intel-openmp              2020.2                      254    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
jpeg                      9b                   hb83a4c4_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
jsonpatch                 1.32                     pypi_0    pypi
jsonpointer               2.1                      pypi_0    pypi
kiwisolver                1.3.1                    pypi_0    pypi
libpng                    1.6.37               h2a8f88b_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libtiff                   4.2.0                hd0e1b90_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
lz4-c                     1.9.3                h2bbff1b_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
matplotlib                3.3.4                    pypi_0    pypi
mkl                       2020.2                      256    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl-service               2.3.0            py36h196d8e1_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl_fft                   1.3.0            py36h46781fe_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl_random                1.1.1            py36h47e9c7a_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
ninja                     1.10.2           py36h6d14046_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy                     1.19.2           py36hadc3359_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy-base                1.19.2           py36ha3acd2a_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
olefile                   0.46                     py36_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
opencv-python             4.5.1.48                 pypi_0    pypi
pillow                    8.1.2            py36h4fa10fc_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pip                       21.0.1           py36haa95532_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pycocotools               2.0                      pypi_0    pypi
pycparser                 2.20                       py_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pyparsing                 2.4.7                    pypi_0    pypi
python                    3.6.13               h3758d61_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python-dateutil           2.8.1                    pypi_0    pypi
pytorch                   1.1.0           py3.6_cuda100_cudnn7_1    pytorch
pyzmq                     22.0.3                   pypi_0    pypi
requests                  2.25.1                   pypi_0    pypi
scipy                     1.1.0                    pypi_0    pypi
setuptools                52.0.0           py36haa95532_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
six                       1.15.0           py36haa95532_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
sqlite                    3.35.2               h2bbff1b_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
terminaltables            3.1.0                    pypi_0    pypi
tk                        8.6.10               he774522_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
torchfile                 0.1.0                    pypi_0    pypi
torchvision               0.3.0              py36_cu100_1    pytorch
tornado                   6.1                      pypi_0    pypi
urllib3                   1.26.4                   pypi_0    pypi
vc                        14.2                 h21ff451_1    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vs2015_runtime            14.27.29016          h5e58377_2    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
websocket-client          0.58.0                   pypi_0    pypi
wheel                     0.36.2             pyhd3eb1b0_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wincertstore              0.2              py36h7fe50ca_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
xz                        5.2.5                h62dcd97_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
zlib                      1.2.11               h62dcd97_4    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
zstd                      1.4.5                h04227a9_0    http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

3 下载预训练模型和配置文件

  1. Download the object detection model manually: yolov3-spp.weights(Google Drive | Baidu pan). Place it into detector/yolo/data.
  2. Download our pose models. Place them into pretrained_models. All models and details are available in our Model Zoo.
  3. For pose tracking, please refer to our tracking docments for model download
  1. 下载目标检测模型yolov3-spp.weights放到目录detector/yolo/data文件夹下
  2. 下载姿态模型,放置到pretrained_models文件夹下,除了下载配置文件之外还需要下载cfg配置文件,具体下载地址参考:https://github.com/MVIG-SJTU/AlphaPose/blob/master/docs/MODEL_ZOO.md

4 demo试运行

官方文档:https://github.com/MVIG-SJTU/AlphaPose/blob/master/docs/GETTING_STARTED.md

具体使用可参考如上文档,这里放一下我的命令行:

python scripts/demo_inference.py --cfg pretrained_models/256x192_res50_lr1e-3_1x.yaml --checkpoint pretrained_models/fast_res50_256x192.pth --video pretrained_models/P01_01_00_0_color.avi --outdir examples/res --save_video

然后经典的cxk篮球课堂来了!

在这里插入图片描述
如果有兴趣可以访问我的个人站哦:https://www.stubbornhuang.com

http://www.lbrq.cn/news/736381.html

相关文章:

  • 企业网站维护更新/长尾词和关键词的区别
  • 开发网站需要哪些技术/免费创建网站平台
  • 技术支持 优府网络太原网站建设/广告加盟
  • wordpress插件用户权限/东莞seo网站优化排名
  • 苏州网站设计公司/2023疫情最新消息今天
  • 青岛百度快速排名优化/什么是seo优化
  • 家用电脑和宽带做网站/发布友情链接
  • 织梦制作html 网站地图/四川seo哪里有
  • 在哪个网站做图片视频带音乐/网站建站开发
  • 电子政务网站建设/百度关键词首页排名
  • 购买 做网站 客户/石家庄百度推广优化排名
  • 免费空间申请free/广州网站优化外包
  • 哪个网站可以改字体/seo关键词优化软件app
  • 怎么做网站或APP/德芙巧克力的软文500字
  • 如何在旅游网站上做攻略/东莞网络营销推广软件
  • 网站空间提供商/如何做网站营销
  • 上海网站设计公司推荐亿企邦/腾讯广点通
  • 网站建设模块一项目三/值得收藏的五个搜索引擎
  • 攀枝花网站建设兼职/苏州首页排名关键词优化
  • 龙岗 网站建设/如何建网站教程
  • 外贸 网站外链交换/第三方网站流量统计
  • 客户为什么要做网站/文大侠seo博客
  • 优质做网站费用/外贸网站优化
  • 张家口做网站价格/百度新闻排行榜
  • 在线制作图片的网站/百度推广如何办理
  • 重庆官方推广网站/cps推广联盟
  • 个人建站模板/广告投放平台都有哪些
  • 找事做搜索网站/北京网站推广助理
  • 怎样成立一个网站/市场营销推广
  • 教育门户网站系统建设方案/seoer是什么意思
  • mac的m3芯片安装JDK8、JDK17
  • 亚马逊站外推广效能重构:自然排名提升的逻辑与实操边界
  • Linux Shell 常用操作与脚本示例详解
  • React框架超详细入门到实战项目演练【前端】【React】
  • linux内核源码下载
  • ansible playbook 实战案例roles | 实现db2自动安装