为了账号安全,请及时绑定邮箱和手机立即绑定

Tensorflow读取带有标签的图像

Tensorflow读取带有标签的图像

呼啦一阵风 2019-10-17 14:37:11
我正在使用Tensorflow构建标准的图像分类模型。为此,我有输入图像,每个图像都分配了一个标签({0,1}中的数字)。因此,可以使用以下格式将数据存储在列表中:/path/to/image_0 label_0/path/to/image_1 label_1/path/to/image_2 label_2...我想使用TensorFlow的排队系统读取我的数据并将其输入到我的模型中。忽略标签,可以使用string_input_producer和轻松实现wholeFileReader。这里的代码:def read_my_file_format(filename_queue):  reader = tf.WholeFileReader()  key, value = reader.read(filename_queue)  example = tf.image.decode_png(value)  return example#removing label, obtaining list containing /path/to/image_ximage_list = [line[:-2] for line in image_label_list]input_queue = tf.train.string_input_producer(image_list)                                                     input_images = read_my_file_format(input_queue)但是,在该过程中,标签丢失了,因为图像数据作为输入管道的一部分被有意地改组了。通过输入队列将标签和图像数据一起推入的最简单方法是什么?
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 1277 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信