我正在训练自己的数据集,我在tf.image.decode_jpeg中得到了InvalidArgumentError

时间:2017-04-06 04:12:45

标签: tensorflow

部分代码:

label = input_queue[1]
image_contents = tf.read_file(input_queue[0])    
image = tf.image.decode_jpeg(image_contents, channels=3)    
image = tf.image.resize_image_with_crop_or_pad(image, image_W, image_H)

错误:

INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, Invalid JPEG data, size 300
         [[Node: DecodeJpeg_2 = DecodeJpeg[acceptable_fraction=1, channels=3, dct_method="", fancy_upscaling=true, ratio=1, try_recover_truncated=false, _device="/job:localhost/replica:0/task:0/cpu:0"](ReadFile_3)]]

  File "C:/Users/MCRC/made/catdog/training.py", line 97, in <module>
    run_training()

  File "C:/Users/MCRC/made/catdog/training.py", line 60, in run_training
    CAPACITY)

  File "C:\Users\MCRC\made\catdog\input_data.py", line 100, in get_batch
    image = tf.image.decode_jpeg(image_contents, channels=3)

  File "D:\A3\lib\site-packages\tensorflow\python\ops\gen_image_ops.py", line 345, in decode_jpeg
    dct_method=dct_method, name=name)

我在Windows中使用Tensorflow-GPU 1.0和Python3.5。有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

听起来像图像(或其中一个图像,我无法分辨,因为它取决于input_queue的构造方式)不是有效的JPEG图像(文件内容是300字节)。