检测方面
1 coco val 2017的图片有5000张
2 annotations 中用的图片只有 4952张
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> a=json.load(open('instances_val2017.json'))
>>> print(type(a))
<class 'dict'>
>>> print(a.keys())
dict_keys(['images', 'annotations', 'info', 'categories', 'licenses'])
>>> print(len(a['images']))
5000
>>> print(len(a['annotations']))
36781
统计coco2017 验证集 标注所用图片的代码
def get_anns_image_id(json_file):
"""
函数的作用是json文件中的image_id
:param result_file: json文件名
:return:
"""
a = json.load(open(json_file))
image_id_chongfu = []
for i in range(len(a['annotations'])):
image_id_chongfu.append(a['annotations'][i]['image_id'])
image_id = set(image_id_chongfu)
return list(image_id)
输出结果是4952
因此标注用的的图片为 4952 张 (意味着一些图片没有标注)