记录一下 学习 将cifa10 转为tfrecord ,pytho3.5
def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[str(value)]))
报 TypeError: 'b\';+2Dbw\\x8b\\x91\\x95\ ..... has type str, but expected one of: bytes
参考相关文章 将 str(value) 改为 str.encode(value) 等仍然报错
最后参考
def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
改为同样的
def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
可以生成 tfrecord 文件