【发布时间】:2018-11-15 13:37:59
【问题描述】:
我有一个数据集图像和相应的标签,每个图像文件都有一个 .txt 文件,其中包含一个热编码:
0
0
0
0
1
0
我的代码如下所示:
imageString = tf.read_file('image.jpg')
imageDecoded = tf.image.decode_jpeg(imageString)
labelString = tf.read_file(labelPath)
# decode csv string
但 labelString 看起来像这样:
tf.Tensor(b'0\n0\n0\n0\n1\n', shape=(), dtype=string)
有没有办法将其转换为 tensorflow 中的数字数组?
【问题讨论】:
标签: python tensorflow tensorflow-datasets