gpt4 book ai didi

python - 如何从 tensorflow 中的谷歌存储桶中读取文件?

转载 作者:行者123 更新时间:2023-12-05 07:02:47 24 4
gpt4 key购买 nike

为了训练一个 tensorflow 模型,我从谷歌云平台 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))

但是谷歌云平台控制台,给我以下错误:

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

stereo-train 桶确实存在于目录层次结构中。

最佳答案

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

关于python - 如何从 tensorflow 中的谷歌存储桶中读取文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63443893/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com