目标检测数据集有哪些_目标检测数据集

(53) 2024-07-25 09:01:01

链接上篇简单介绍了MS COCO数据集的下载和数据结构以及API的下载安装,本文主要以官方发布的demo脚本为例,记录了COCO数据集API的使用方法。比较冗长基础,适合入门。

COCO API介绍

  • 简介
  • 安装
  • 使用方法
    • pycocoDemo.ipynb
    • pycocoEvalDemo.ipynb

简介

COCO官网中有对API的简介信息链接。
目标检测数据集有哪些_目标检测数据集 (https://mushiming.com/)  第1张
COCO API可以用于加载,解析和可视化COCO数据集。API支持COCO数据集的多种标注格式,也有支持分割掩码的MASK API。官方发布了Matlab、Python和Lua的使用接口。本文只介绍python的使用接口。
python接口在官网中只有以下简单的注解,主要解释文本都在下载安装pycocotools后的coco.py代码开头的注释内容中,可以查看检索,本文通过逐段运行demo脚本的方式来通过具体的代码学习API的使用。

Throughout the API "ann"=annotation, "cat"=category, and "img"=image. getAnnIdsGet ann ids that satisfy given filter conditions. getCatIdsGet cat ids that satisfy given filter conditions. getImgIdsGet img ids that satisfy given filter conditions. loadAnnsLoad anns with the specified ids. loadCatsLoad cats with the specified ids. loadImgsLoad imgs with the specified ids. loadResLoad algorithm results and create API for accessing them. showAnnsDisplay the specified annotations. 

安装

COCO官网发布了Linux和OSX系统的安装代码,貌似就没有考虑win系统的安装(讲道理微软的数据集没考虑到windows环境的使用接口这是出于什么考量,也是很迷啊)。这里找到了大佬修改的适用于win的COCO API地址https://github.com/philferriere/cocoapi.
四种安装方法:

  1. cmd中使用pip安装
$ pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI 
  1. 下载github压缩文件后,解压,和下载的COCO train2014/val2014文件夹在同一个目录。然后切换到cocoapi\PythonAPI目录,运行以下命令,第一种方法没有将库安装到python site-packages目录,使用时通过相对路径import支持库,第二种方法相当于pip install,使用时直接import即可。
# install pycocotools locally python setup.py build_ext --inplace # install pycocotools to the Python site-packages python setup.py build_ext install 

安装过程遇到问题可以参考一些大佬的解决方法目标检测任务数据集介绍-COCO API介绍、https://www.jianshu.com/p/8658cda3d553。

解决“unable to find vcvarsall.bat”问题:
先更新setuptools:

pip install --upgrade setuptools 

https://devblogs.microsoft.com/python/unable-to-find-vcvarsall-bat/
然后下载安装Visual C++ Build Tools 2015。

若出现VS2015报“安装包丢失或损坏”问题,则原因为:microsoft root certificate authority 2010、microsoft root certificate authority 2011证书未安装,导致文件校验未通过,下载并安装这两个证书即可。
链接:https://pan.baidu.com/s/1fbIWjuczPFTtZ_hm9aYuaw
提取码:8swi
解压出里面两个注册文件【受信任的根证书颁发机构】。右键文件选择安装证书,弹出对话框点击下一步,选择将所有证书放入下列存储,选择【受信任的根证书颁发机构】点击确定下一步直至安装完成,win+ r ,输入 certmgr.msc,在受信任的根证书颁发机构里刷新 ,看是否有"Microsoft Root Certificate Authority 2010" “Microsoft Root Certificate Authority 2011”. ,有的话就在vs2015安装下点击重试就可以了。安装过程还有其它问题可以参考博客内容。如果上述方法均不能解决,就尝试下完整安装VS,一般就没问题了。

  1. 也可以在https://pypi.org/网站中搜索pycocotools,下载压缩包解压后,通过python setup.py install安装
THE END

发表回复