Python 如何在tensorflow中从google bucket读取文件?

Python 如何在tensorflow中从google bucket读取文件?,python,tensorflow,google-cloud-platform,google-cloud-storage,Python,Tensorflow,Google Cloud Platform,Google Cloud Storage,为了训练tensorflow模型,我正在从google云平台bucket加载一个自定义数据集,如下所示: GCP_BUCKET = "stereo-train" tfc.run( requirements_txt="requirements.txt", chief_config=tfc.MachineConfig( cpu_cores=8, memory=30, accelerator_ty

为了训练tensorflow模型,我正在从google云平台bucket加载一个自定义数据集,如下所示:

GCP_BUCKET = "stereo-train"

tfc.run(
    requirements_txt="requirements.txt",
    chief_config=tfc.MachineConfig(
        cpu_cores=8,
        memory=30,
        accelerator_type=tfc.AcceleratorType.NVIDIA_TESLA_T4,
        accelerator_count=1,
    ),
    docker_image_bucket_name=GCP_BUCKET,
)
kitti = "gs://stereo-train/data_scene_flow"


kitti_train = str(kitti + "/training/dat/data/")

img_height = 375
img_width = 1242

feature_size = 32
batch_size = 6
filenames = np.sort(np.asarray(os.listdir(kitti_train))).tolist()
# Make a Dataset of image tensors by reading and decoding the files.
ds = list(map(lambda x: tf.io.decode_image(tf.io.read_file(kitti_train + x)), filenames))

但是google云平台控制台给了我以下错误:

FileNotFoundError: [Errno 2] No such file or directory: 'gs://stereo-train/data_scene_flow/training/dat/data/'

立体声列车存储桶确实存在于目录层次结构中。

如果在本地运行,可能是连接问题,请下载GCP控制台并尝试从控制台访问存储桶。

如果在本地运行,可能是连接问题,请下载GCP控制台并尝试从控制台访问存储桶。

tf.io.read\u文件()
方法用于本地文件,不适用于
gs://
协议。相反,您应该使用。

方法
tf.io.read\u file()
用于本地文件,不适用于
gs://
协议。相反,你应该使用。

你能看一下吗?你能看一下吗?