【发布时间】:2019-12-30 20:03:52
【问题描述】:
我创建了一个 S3 存储桶“testshivaproject”并在其中上传了一张图片。当我尝试在 sagemaker notebook 中访问它时,它会抛出错误“没有这样的文件或目录”。
# import libraries
import boto3, re, sys, math, json, os, sagemaker, urllib.request
from sagemaker import get_execution_role
import numpy as np
# Define IAM role
role = get_execution_role()
my_region = boto3.session.Session().region_name # set the region of the instance
print("success :"+my_region)
输出:成功:us-east-2
role
输出:'arn:aws:iam::847047967498:role/service-role/AmazonSageMaker-ExecutionRole-20190825T121483'
bucket = 'testprojectshiva2'
data_key = 'ext_image6.jpg'
data_location = 's3://{}/{}'.format(bucket, data_key)
print(data_location)
输出: s3://testprojectshiva2/ext_image6.jpg
test = load_img(data_location)
输出:没有这样的文件或目录
有类似问题提出(Load S3 Data into AWS SageMaker Notebook)但没有找到任何解决方案?
【问题讨论】:
标签: amazon-s3 amazon-sagemaker