训练im2txt模型时出错

时间:2016-09-24 04:31:14

标签: python tensorflow deep-learning

我试图使用Tensorflow训练im2txt模型,我只是从master分支构建的,

我下载了所需的所有数据集但是当我运行训练脚本时:

bazel-bin/im2txt/train \ --input_file_pattern="${MSCOCO_DIR}/train-?????-of-00256" \ --inception_checkpoint_file="${INCEPTION_CHECKPOINT}" \ --train_dir="${MODEL_DIR}/train" \ --train_inception=false \ --number_of_steps=1000000

它显示以下内容:

Traceback (most recent call last): 
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/train.py", line 111, in  tf.app.run() 
File "/home/rvl224/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run sys.exit(main(sys.argv[:1] + flags_passthrough)) 
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/train.py", line 65, in main model.build() 
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/show_and_tell_model.py", line 358, in build self.build_inputs() 
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/show_and_tell_model.py", line 165, in build_inputs image = self.process_image(encoded_image, thread_id=thread_id) 
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/show_and_tell_model.py", line 119, in process_image image_format=self.config.image_format) 
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/ops/image_processing.py", line 114, in process_image method=tf.image.ResizeMethod.BILINEAR)
TypeError: resize_images() got an unexpected keyword argument 'new_height'

这是与函数resize_images()相关的问题还是我做错了什么?

由于

1 个答案:

答案 0 :(得分:4)

更新: fix applied

对此抱歉! TensorFlow中函数resize_images(...)的签名在上周发生了变化,导致了这种破坏。

我很快就会解决这个问题。如果您想在此之前使用此修复程序,则需要修改文件im2txt / im2txt / ops / image_processing.py。

只需更改此行:

image = tf.image.resize_images(image,
                               new_height=resize_height,
                               new_width=resize_width,
                               method=tf.image.ResizeMethod.BILINEAR)

到此:

image = tf.image.resize_images(image,
                               size=[resize_height, resize_width],
                               method=tf.image.ResizeMethod.BILINEAR)