python - 'ValueError: Image with id {} already added' 在 OpenImage 数据集上运行评估时
问题描述
我正在使用 Tensorflow 对象检测 API 来评估 OpenImageV5 数据集上的 SSD_mobilenet 模型。我使用了他们的模型 zoo中提供的 pretained 模型。对于管道配置,我使用的是此处ssd_mobilenet_v2_oid_v4
提供的默认管道 () 。
当我使用以下命令运行评估时:
python object_detection/model_main.py --alsologtostderr --run_once --checkpoint_dir=/Path/TO/ssd_mobilenet_v2_oid_v4_2018_12_12/ --model_dir=eval/ --pipeline_config_path=PATH/TO/ssd_mobilenet_v2_oid_v4.config
我收到此错误:
2019-05-28 12:26:09.658946: W tensorflow/core/framework/op_kernel.cc:1306] Invalid argument: ValueError: Image with id 1407414044 already added.
Traceback (most recent call last):
File "/bigSSD/tensorflow_model/v_env_tf_1.8/lib/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 157, in __call__
ret = func(*args)
File "/bigSSD/tensorflow_model/models/research/object_detection/utils/object_detection_evaluation.py", line 432, in update_op
self.add_single_ground_truth_image_info(image_id, single_example_dict)
File "/bigSSD/tensorflow_model/models/research/object_detection/utils/object_detection_evaluation.py", line 600, in add_single_ground_truth_image_info
raise ValueError('Image with id {} already added.'.format(image_id))
ValueError: Image with id 1407414044 already added.
我sample_1_of_n_examples
从 10 更改为 100 和 1000 但仍然遇到相同的错误。
解决方案
对于 faster_rcnn_inception_resnet_v2_atrous_oid_v4.config 我改变了
eval_config
{
metrics_set: "open_images_V2_detection_metrics"
}
至
eval_config {
metrics_set: "open_images_V2_detection_metrics"
num_examples: 383 #correspond to my test images
}
然后使用以下命令使用 eval.py 运行评估:
python eval.py --logtostderr --checkpoint_dir=path/to/checkpoint --eval_dir=path/to/eval_dir --pipeline_config_path=path/to/pretrained_model.config
我的错误解决了。
推荐阅读
- hibernate - 如何使用 JPA/Hibernate 在 MySQL 中存储 MultivalueMap
- java - 如何在 Kotlin 中访问上下文对象中的变量?
- javascript - 使用较新的浏览器对多显示 SELECT 标记中的选项进行排序
- c - 是否可以在 C 文件管理中使用 1 个字符串变量读取全名?
- html - 当我的搜索栏居中时,无法使我的下拉内容与我的搜索栏对齐。我能做些什么?
- javascript - 如何从 Deck.gl 中的 XY 鼠标值中提取 lat long 值?
- ansible - 为什么我会为隐式和显式 localhost 获得不同的 python 版本
- python - 来自 Flutter 的 Python Google Cloud 函数调用。响应不是有效的 JSON 对象
- swift - 单击标签栏时更改图像
- javascript - Laravel 访问器两次向 json 对象提供信息