windows下安装cocoApi和CrowdPoseApi

2023-11-01 10:58

本文主要是介绍windows下安装cocoApi和CrowdPoseApi,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1. 安装COCOAPI

1.首先git clone下载:
使用国内镜像会更快些:

git clone https://github.com.cnpmjs.org/cocodataset/cocoapi.git 

2.然后cd cocoapi/PythonAPI/

3.修改setup.py文件,将extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'] 替换为extra_compile_args=[]
如下:

from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
import numpy as np# To install and compile to your anaconda/python site-packages, simply run:
# $ pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
# Note that the original compile flags below are GCC flags unsupported by the Visual C++ 2015 build tools.
# They can safely be removed.ext_modules = [Extension('pycocotools._mask',sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'],include_dirs = [np.get_include(), '../common'],extra_compile_args=[] # originally was ['-Wno-cpp', '-Wno-unused-function', '-std=c99'],)
]setup(name='pycocotools',packages=['pycocotools'],package_dir = {'pycocotools': 'pycocotools'},version='2.0',ext_modules=cythonize(ext_modules))

4.运行文件

python setup.py build_ext --inplacepython setup.py build_ext install

5.若出现报错:

TypeError: 'numpy.float64' object cannot be interpreted as an integer

解决方案:
修改文件:cocoapi/PythonAPI/pycocotools/cocoeval.py,如下:

class Params:'''Params for coco evaluation api'''def setDetParams(self):self.imgIds = []self.catIds = []# np.arange causes trouble.  the data point on arange is slightly larger than the true value# @Author pei @Data:2020.12.18 @Content: TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.self.iouThrs = np.linspace(.5, 0.95, int(np.round((0.95 - .5) / .05)) + 1, endpoint=True)#self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True)self.recThrs = np.linspace(.0, 1.00, np.round((1.00 - .0) / .01) + 1, endpoint=True)self.maxDets = [1, 10, 100]self.areaRng = [[0 ** 2, 1e5 ** 2], [0 ** 2, 32 ** 2], [32 ** 2, 96 ** 2], [96 ** 2, 1e5 ** 2]]self.areaRngLbl = ['all', 'small', 'medium', 'large']self.useCats = 1def setKpParams(self):self.imgIds = []self.catIds = []# @Author pei @Data:2020.12.18 @Content: TypeError: 'numpy.float64' object cannot be interpreted as an integerself.iouThrs = np.linspace(.5, 0.95, int(np.round((0.95 - .5) / .05)) + 1, endpoint=True)self.recThrs = np.linspace(.0, 1.00, np.round((1.00 - .0) / .01) + 1, endpoint=True)self.maxDets = [20]self.areaRng = [[0 ** 2, 1e5 ** 2], [32 ** 2, 96 ** 2], [96 ** 2, 1e5 ** 2]]self.areaRngLbl = ['all', 'medium', 'large']self.useCats = 1def __init__(self, iouType='segm'):if iouType == 'segm' or iouType == 'bbox':self.setDetParams()elif iouType == 'keypoints':self.setKpParams()else:raise Exception('iouType not supported')self.iouType = iouType# useSegm is deprecatedself.useSegm = None

然后重新安装cocoApi

2. 安装CrowdposeAPI

1.首先git clone下载:
使用国内镜像会更快些:

git clone https://github.com.cnpmjs.org/Jeff-sjtu/CrowdPose.git 

2.然后cd CrowdPose/crowdpose-api/PythonAPI/

3.修改setup.py文件,将extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'] 替换为extra_compile_args=['-std=c99'],如下:

from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
import numpy as np# To compile and install locally run "python setup.py build_ext --inplace"
# To install library to Python site-packages run "python setup.py build_ext install"ext_modules = [Extension('crowdposetools._mask',sources=['../common/maskApi.c', 'crowdposetools/_mask.pyx'],include_dirs=[np.get_include(), '../common'],# @Pei Hongwei# @2020.11.16 # originally was extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],extra_compile_args=['-std=c99'])
]setup(name='crowdposetools',packages=['crowdposetools'],package_dir={'crowdposetools': 'crowdposetools'},version='2.0',ext_modules=cythonize(ext_modules))

4.运行文件

python setup.py build_ext --inplacepython setup.py build_ext install

这篇关于windows下安装cocoApi和CrowdPoseApi的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/322468

相关文章

Linux系统中卸载与安装JDK的详细教程

《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1

Linux卸载自带jdk并安装新jdk版本的图文教程

《Linux卸载自带jdk并安装新jdk版本的图文教程》在Linux系统中,有时需要卸载预装的OpenJDK并安装特定版本的JDK,例如JDK1.8,所以本文给大家详细介绍了Linux卸载自带jdk并... 目录Ⅰ、卸载自带jdkⅡ、安装新版jdkⅠ、卸载自带jdk1、输入命令查看旧jdkrpm -qa

MySQL Workbench 安装教程(保姆级)

《MySQLWorkbench安装教程(保姆级)》MySQLWorkbench是一款强大的数据库设计和管理工具,本文主要介绍了MySQLWorkbench安装教程,文中通过图文介绍的非常详细,对大... 目录前言:详细步骤:一、检查安装的数据库版本二、在官网下载对应的mysql Workbench版本,要是

Linux安装MySQL的教程

《Linux安装MySQL的教程》:本文主要介绍Linux安装MySQL的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux安装mysql1.Mysql官网2.我的存放路径3.解压mysql文件到当前目录4.重命名一下5.创建mysql用户组和用户并修

pip无法安装osgeo失败的问题解决

《pip无法安装osgeo失败的问题解决》本文主要介绍了pip无法安装osgeo失败的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一... 进入官方提供的扩展包下载网站寻找版本适配的whl文件注意:要选择cp(python版本)和你py

Windows Server服务器上配置FileZilla后,FTP连接不上?

《WindowsServer服务器上配置FileZilla后,FTP连接不上?》WindowsServer服务器上配置FileZilla后,FTP连接错误和操作超时的问题,应该如何解决?首先,通过... 目录在Windohttp://www.chinasem.cnws防火墙开启的情况下,遇到的错误如下:无法与

Android App安装列表获取方法(实践方案)

《AndroidApp安装列表获取方法(实践方案)》文章介绍了Android11及以上版本获取应用列表的方案调整,包括权限配置、白名单配置和action配置三种方式,并提供了相应的Java和Kotl... 目录前言实现方案         方案概述一、 androidManifest 三种配置方式

Python解析器安装指南分享(Mac/Windows/Linux)

《Python解析器安装指南分享(Mac/Windows/Linux)》:本文主要介绍Python解析器安装指南(Mac/Windows/Linux),具有很好的参考价值,希望对大家有所帮助,如有... 目NMNkN录1js. 安装包下载1.1 python 下载官网2.核心安装方式3. MACOS 系统安

Pycharm安装报错:Cannot detect a launch configuration解决办法

《Pycharm安装报错:Cannotdetectalaunchconfiguration解决办法》本文主要介绍了Pycharm安装报错:Cannotdetectalaunchconfigur... 本文主要介绍了Pycharm安装报错:Cannot detect a launch configuratio

pytorch+torchvision+python版本对应及环境安装

《pytorch+torchvision+python版本对应及环境安装》本文主要介绍了pytorch+torchvision+python版本对应及环境安装,安装过程中需要注意Numpy版本的降级,... 目录一、版本对应二、安装命令(pip)1. 版本2. 安装全过程3. 命令相关解释参考文章一、版本对