参考博客:https://blog.csdn.net/ccbrid/article/details/79368639
在linux上
步骤
- 1.git clone cocoapi
- 2.进入文件夹
- 3.放入image和annotation
- 4.安装pythoncocoapi接口
- 5.在python中import pycocotools不报错,即安装成功
- 6.使用clone内容内pythonapi中的demo代码,就能用caption了
1.git clone cocoapi
github:
git clone https://github.com/pdollar/coco.git
gitee镜像(我用的这个):
git clone https://gitcode.net/mirrors/cocodataset/cocoapi.git
2.进入文件夹
cd coco
或者是
cd cocoapi
总之进入刚刚clone下来的文件夹
3.放入image和annotation
mkdir images
mkdir annotations
分别放官网https://cocodataset.org/#download下载的image和annotation文件夹(里面包含json),这里我只放了annotation就可以跑api里的demo了
我下载的数据如下:
解压后长这样:
我需要用的是captions
4.安装pythoncocoapi接口
cd PythonAPI
make
这里make报错
error: pycocotools/_mask.c: No such file or directory
解决参考:https://blog.csdn.net/ITtjt/article/details/122062849
解决方案:
pip install Cython
pip install pycocotools
将makefile文件中的python换成python3
5.在python中import pycocotools不报错,即安装成功
6.使用clone内容内pythonapi中的demo代码,就能用caption了
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)