0

How can I modify the iterator in this example (https://github.com/dmlc/mxnet/blob/master/example/fcn-xs/data.py) to read images from AWS s3. I have .png images in a folder in AWS s3. I tried passing the rootdir as s3://bucketname/folder. I have also tried to change the function that reads images from Image (by PIL) to imdecode (by mx.image). I had no luck in both cases. I have an image segmentation problem. my input is an image and my output is an image too.

MAS
  • 4,503
  • 7
  • 32
  • 55
  • 1
    How did you install (or get) your MXNet? You need to make sure that you are using the version that was compiled with USE_S3 flag, or that you are using the latest version of the deep learning AMI from AWS (Amazon Linux – 2.3_Jun2017 or Ubuntu – 1.5_Jun2017) – Guy Jul 15 '17 at 23:12

1 Answers1

1

It seems like you want to retrieve individual images stored in s3. You could use the python boto library for that. I suggest you modify line 56 to load images from s3.

Here is an example:

    import StringIO
    from boto.s3.connection import S3Connection
    from PIL import Image

    aws_connection = S3Connection(AWS_KEY, AWS_SECRET)
    bucket = aws_connection.get_bucket(BUCKET_NAME)

    content = bucket.get_key(FILE_NAME).get_contents_as_string()
    image = Image.open(StringIO.StringIO(content))