Closed sunjieee closed 7 years ago
对于问题1,我觉得直接用reshape是完全没问题的。 对于问题2, 可以参考Google提供的inception是如何从TFRecords里面读取数值的:https://github.com/tensorflow/models/blob/master/inception/inception/image_processing.py#L394
您好,我在学习本书的时候也遇到这样的问题,原链接已经打不开了,请明示,谢谢
你在说什么?
发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用
发件人: zhanglong notifications@github.com 发送时间: Wednesday, April 3, 2019 1:51:40 PM 收件人: caicloud/tensorflow-tutorial 抄送: Subscribed 主题: Re: [caicloud/tensorflow-tutorial] 书本代码问题 (#9)
您好,我在学习本书的时候也遇到这样的问题,原链接已经打不开了,请明示,谢谢
― You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/caicloud/tensorflow-tutorial/issues/9#issuecomment-479349690, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhUPMwlWj9_v0wmyWQptHikmEUBvpS4Sks5vdEFsgaJpZM4MplfQ.
首先感谢作者,通过阅读这本书收获很大,学到很多。 我在运行书本中的代码中遇到如下问题: 书本P195,第7.3.4输入数据处理框架(这里github库相应章节中代码和书中不同) features = tf.parse_single_example( serializerd_example, features={ 'image': tf.FixedLenFeature([], tf.string), 'label': tf.FixedLenFeature([], tf.int64), 'height': tf.FixedLenFeature([], tf.int64), 'width': tf.FixedLenFeature([], tf.int64), 'channels': tf.FixedLenFeature([], tf.int64) })
image, label = features['image'], features['label'] height, width = features['height'], features['width'] channels = features['channels'] decoded_image = tf.decode_raw(image, tf.uint8) decoded_image.set_shape([height, width, channels]) (1)
这里(1)处的height, width, channels是从TFRecords文件中读取的,是Tensor, 代码运行时出现以下错误: TypeError: int() argument must be a string or a number, not 'Tensor'
即使我把height,width,channels直接替换为数字, decoded_image.set_shape([224, 224, 3]) 也会报错 ValueError: Shapes (?,) and (224, 224, 3) are not compatible
最后通过尝试以下方式是可行的,但还是要通过tf.reshape来恢复图片shape decoded_image.set_shape([224 224 3])
所以我想问