admin管理员组文章数量:1650764
InvalidArgumentError: Feature: feature (data type: string) is required but could not be found.
问题原因: 生成的.tfrecord数据中的key(键值)和你在代码中读取的 key 不匹配导致的。我们在使用不是自己产生的数据时经常会出现这样的错误。既然数据已经生成了,就不可能再去修改数据了,所以将你读取的代码中的键值改成生成时的就OK了
例:我产生报错的原因
生成时:
feature = {
'image': _bytes_feature(encoded_jpg),
'label': _int64_feature(integer_label)
}
读取时:
features = {
'image': tf.FixedLenFeature([], tf.string),
'target': tf.FixedLenFeature([], tf.int64)
}
这就很明显了,上面时 label。 下面是 target。所以会报错啦。将下面的target改成上面的label就好啦。
即:
features = {
'image': tf.FixedLenFeature([], tf.string),
'label': tf.FixedLenFeature([], tf.int64)
}
本文标签: 报错数据featureInvalidArgumentErrorTFRecord
版权声明:本文标题:tfrecord数据报错 InvalidArgumentError: Feature: feature (data type: string) is required but could not 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729532717a1205013.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论