Gcloud FileNotFound - 机器学习引擎

Gcloud FileNotFound - ML Engine

我正在尝试对 Google Cloud ML Engine 进行预测。我已将输入上传到 Google Cloud Storage 的存储桶中。我正在使用以下标志:

--file='gs://MyBucket/Photo/example3.jpg'

我也试过:

--file=gs://MyBucket/Photo/example3.jpg

在我的 python 应用程序中,我以这种方式打开图像:

image = misc.imread(filename)

但任务产生以下错误:

 "FileNotFoundError: [Errno 2] No such file or directory: 'gs://MyBucket/Photo/example3.jpg'"  

我不知道 Google 云存储权限或我打开图像的方式是否有问题。

提前致谢!

要从 Google 云存储中读取图像文件,请使用像这样的 tensorflow 代码,因为本机 Python 无法从 blob 存储中读取:

image_contents = tf.read_file(filename)
image = tf.image.decode_jpeg(image_contents, channels=3)
image = tf.image.convert_image_dtype(image, dtype=tf.float32) # 0-1