问题描述
我在将 tfrecords 转换回图像时遇到问题:
def _parse_test_image_function(img):
image_feature_description = {
'image/file_name': tf.io.FixedLenFeature([],tf.string),'image/encoded_image': tf.io.FixedLenFeature([],}
return tf.io.parse_single_example(img,image_feature_description)
test_dataset = tf.data.TFRecordDataset(temp_path)
test_dataset = test_dataset.map(_parse_test_image_function)
print(tf.__version__)
images = test_dataset.take(1)
print(images)
2.5.0
<TakeDataset shapes: {image/encoded_image: (),image/file_name: ()},types: {image/encoded_image: tf.string,image/file_name: tf.string}>
image_feature_description 中的字段正确
我也看到了 Converting TFRecords back into JPEG Images 但这对我来说不是很有帮助,因为答案中使用的一些功能已经过时。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)