因此,我正在尝试在tensorflow上训练自定义对象检测模型,以识别raspberrypi2的图像。一切都已在我的硬件上设置并运行,但由于我的gpu的限制,我决定使用云。我上传了我的数据(火车和测试记录和csv文件)和我的检查点模型。这就是我从日志中得到的:
tensorflow:Restoring parameters from /mobilenet/model.ckpt
tensorflow:Starting Session.
tensorflow:Saving checkpoint to path training/model.ckpt
tensorflow:Starting Queues.
tensorflow:Error reported to Coordinator: <class tensorflow.python.framework.errors_impl.InvalidArgumentError'>,
indices[0] = 0 is not in [0, 0)
我还有一个名为images的文件夹,其中包含实际的.jpg文件,它也在云端,但由于某种原因,我必须使用前面的正斜杠指定每个目录/这可能是一个问题,因为我目前正在做不知道是否有些文件试图导入这些图像,但由于缺少/而无法找到路径。 如果你们中的任何一个碰巧分享了解决方案,我会非常感激。
编辑:我通过在tensorflow中下载旧版本的models文件夹来修复它,模型开始训练,所以请注意tf团队。答案 0 :(得分:1)
改变我创建TF记录的方式。看看下面的代码-
example = tf.train.Example(
features= tf.train.Features(
feature={
'image/height': dataset_util.int64_feature(height),
'image/width': dataset_util.int64_feature(width),
'image/filename': dataset_util.bytes_feature(filename_str.encode('utf-8')),
'image/source_id': dataset_util.bytes_feature(filename_str.encode('utf-8')),
'image/format': dataset_util.bytes_feature(image_format),
'image/encoded': dataset_util.bytes_feature(image_data),
'image/object/bbox/xmin': dataset_util.float_list_feature(xmin),
'image/object/bbox/xmax': dataset_util.float_list_feature(xmax),
'image/object/bbox/ymin': dataset_util.float_list_feature(ymin),
'image/object/bbox/ymax': dataset_util.float_list_feature(ymax),
'image/object/class/text': dataset_util.bytes_list_feature(labels_text),
'image/object/class/label': dataset_util.int64_list_feature(labels),
}
)
)
确保TF记录具有与上述相同的键。这是由于您使用的模型期望使用与上述相似的密钥。我希望这会有所帮助。
之前,我利用了以下方法,但这些方法无法解决问题
example = tf.train.Example(
features= tf.train.Features(
feature={
'image/height': dataset_util.int64_feature(shape[0]),
'image/width': dataset_util.int64_feature(shape[1]),
'image/channels': dataset_util.int64_feature(shape[2]),
'image/shape': dataset_util.int64_list_feature(shape),
'image/object/bbox/xmin': dataset_util.float_list_feature(xmin),
'image/object/bbox/xmax': dataset_util.float_list_feature(xmax),
'image/object/bbox/ymin': dataset_util.float_list_feature(ymin),
'image/object/bbox/ymax': dataset_util.float_list_feature(ymax),
'image/object/bbox/class/label': dataset_util.int64_list_feature(labels),
'image/object/bbox/class/text': dataset_util.bytes_list_feature(labels_text),
'image/object/bbox/difficult': dataset_util.int64_list_feature(difficult),
'image/object/bbox/truncated': dataset_util.int64_list_feature(truncated),
'image/format': dataset_util.bytes_feature(image_format),
'image/encoded': dataset_util.bytes_feature(image_data),
'image/filename': dataset_util.bytes_feature(filename_str.encode('utf-8')),
'image/source_id': dataset_util.bytes_feature(filename_str.encode('utf-8'))
}
)
)
如您所见,我写的是image / object / bbox / class / label而不是image / object / class / label。我希望这会有所帮助。