0
我試圖訓練一個神經網絡,我傳遞一系列圖像。我想創造出通過每個圖像的發電機作爲numpy的陣列如何使用boto3遍歷S3存儲桶?
from skimage import io
image_array = io.imread(url)
但這僅僅是針對一個特定的亞馬遜AWS網址。我知道使用博託庫的標準方法是這樣的:
s3 = boto3.resource('s3')
s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt')
但同樣在這裏,好像你正朝着一個特定的資源指向
我想是這樣的:
def my_generator():
for object in s3_bucket(): # does an s3_bucket() iterator like this exist?
image_array = io.imread(object)
yield image_array
我該怎麼做?