将张量流模型从本地计算机转换为 AWS SageMaker 时读取 S3 存储桶时出现问题



当在Python的本地机器上进行测试时,我通常会使用以下方法来读取带有所有类和文件/类的子目录的训练集:

train_path = r"C:tempcoinsPCGS - Goldtrain"
train_batches = ImageDataGenerator().flow_from_directory(train_path, target_size=(100,100), classes=['0','1',2','3' etc...], batch_size=32)

找到属于 22 个类的 4100 张图像。

但在 AWS SageMaker 的 Jupyter 笔记本上,我现在正在从 S3 存储桶中提取文件。 我尝试了以下方法:

bucket = "coinpath"
train_path = 's3://{}/{}/train'.format(bucket, "v1")   #note that the directory structure is coinpath/v1/train where coinpath is the bucket
train_batches = ImageDataGenerator().flow_from_directory(train_path, target_size=(100,100), classes=
['0','1',2','3' etc...], batch_size=32)

但我得到: ** 找到属于 0 个类的 22 张图像。

寻找有关从 S3 提取训练数据的正确方法的一些指导。

从 在 Google Cloud Platform 中读取存储桶存储批量数据以进行 Keras ML 训练的理想方法?"ImageDataGenerator.flow_from_directory(( 目前不允许您直接从 GCS 存储桶流式传输数据。

我必须先从S3下载图像。 出于延迟原因,这也是最好的。

最新更新