如何在 google colaboratory 中加载 s3 开放数据集?

Uma*_*aid 7 python amazon-s3 amazon-web-services deep-learning google-colaboratory

我正在尝试访问google colaboratory 中的spacenet 挑战数据集(https://registry.opendata.aws/spacenet/)。如何在 google colaboratory 中获取它?

Kan*_*yan 5

您需要创建一个AWS账户并配置IAM用户并生成AccessKey和Secret AccessKey。

与 CoLab 合作,

s3r = boto3.resource('s3', aws_access_key_id='XXXXXXXXXXXXXXXXXXXX',
    aws_secret_access_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
buck = s3r.Bucket('bucket name')
buck.download_file(remotefilename,localfilename)
Run Code Online (Sandbox Code Playgroud)

这是 boto3 文档。

http://boto3.readthedocs.io/en/latest/guide/s3-example-download-file.html

还有一件事需要注意。当您下载数据时,AWS 将向您的账户收费,该帐户可能属于您的免费套餐。

这就是您需要执行所有这些操作的原因,下载存储桶配置为请求者付费。

您可以在此处了解 Amazon S3 定价,

https://aws.amazon.com/s3/pricing/

编辑1:

从以下链接安装 aws s3 cli 工具,

https://aws.amazon.com/cli/

并按照此处的 spacenet 数据访问说明进行操作,

https://medium.com/the-downlinq/getting-started-with-spacenet-data-827fd2ec9f53

希望能帮助到你。