是否可以从.tfrecord文件获取记录(数据项)的路径?例如,为了获取记录总数,我们可以使用tf.python_io.tf_record_iterator
。
例如 如果我有100张原始图像,然后将它们转换为.tfrecords格式。现在我可以将它们加载到我的tensorflow模型中以访问它们。有没有一种方法可以使用.tfrecords访问这些映像的磁盘(路径)位置?
答案 0 :(得分:0)
从一批图像创建tfrecord文件时,这意味着这些图像中的数据以字节格式存储在tfrecord文件中。您可以将原始图像的路径存储到tfrecord文件中,例如:
def image_example(image_string, label, path):
feature = {
'label': _int64_feature(label),
'image_raw': _bytes_feature(image_string),
'path': _bytes_feature(path),
}
return tf.train.Example(features=tf.train.Features(feature=feature))