Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python TensorFlow图像字幕教程出错_Python_Tensorflow - Fatal编程技术网

Python TensorFlow图像字幕教程出错

Python TensorFlow图像字幕教程出错,python,tensorflow,Python,Tensorflow,我正在谷歌Colab上运行TensorFlow的图像字幕和视觉注意教程 () 我想用训练有素的模型来描述我自己的图片。作为测试,我想看看维基百科上一张随机的猫图片的结果。但是,我得到了我粘贴在此消息下的错误。它希望我的输入是“已经是张量” 比如说,如果我的笔记本电脑上本地有10幅图像,我会想要添加标题——我该如何继续?非常感谢您的建议-我是一个初学者,所以这些论坛很重要 #image_url = 'https://en.wikipedia.org/wiki/Kitten#/media/File:

我正在谷歌Colab上运行TensorFlow的图像字幕和视觉注意教程 ()

我想用训练有素的模型来描述我自己的图片。作为测试,我想看看维基百科上一张随机的猫图片的结果。但是,我得到了我粘贴在此消息下的错误。它希望我的输入是“已经是张量”

比如说,如果我的笔记本电脑上本地有10幅图像,我会想要添加标题——我该如何继续?非常感谢您的建议-我是一个初学者,所以这些论坛很重要

#image_url = 'https://en.wikipedia.org/wiki/Kitten#/media/File:KITTEN_on_BAMBOO_top_C_11JUN94.jpg'
#image_extension = image_url[-4:]
#image_path = tf.keras.utils.get_file('image'+image_extension,
                                     #origin=image_url)
image_path = 'https://en.wikipedia.org/wiki/Kitten#/media/File:KITTEN_on_BAMBOO_top_C_11JUN94.jpg'
result, attention_plot = evaluate(image_path)
print ('Prediction Caption:', ' '.join(result))
plot_attention(image_path, result, attention_plot)
# opening the image
Image.open(image_path)

_FallbackException                        Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_io_ops.py in read_file(filename, name)
    548         _ctx._context_handle, tld.device_name, "ReadFile", name,
--> 549         tld.op_callbacks, filename)
    550       return _result

_FallbackException: This function does not handle the case of the path where all inputs are not already EagerTensors.

During handling of the above exception, another exception occurred:

UnimplementedError                        Traceback (most recent call last)
5 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     58     ctx.ensure_initialized()
     59     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60                                         inputs, attrs, num_outputs)
     61   except core._NotOkStatusException as e:
     62     if name is not None:

UnimplementedError: File system scheme 'https' not implemented (file: 'https://en.wikipedia.org/wiki/Kitten#/media/File:KITTEN_on_BAMBOO_top_C_11JUN94.jpg') [Op:ReadFile]