Is there a way to parse multiple images on the model?



Sorry if this is a easy question, this isn’t really my background.

The demo from here:

Works great however this line

output = model.demo(img)

Only accepts one image.

If there a way to send multiple images?

Would sending more be more efficient than just looping the model.demo call?



You can just feed a batch of images into model.demo() or model(). So instead of having only one image with the shape of (1L, 3L, 512L, 669L), you would then have (batch, 3L, 512L, 669L).


Hey Thanks for the reply.

Try as I might with batches I just cannot seem to get them to work. I think part of the problem is I can’t seem to find any documentation / official demo’s on how to use them. People just seem to assume you can figure it out.

I managed to find a sort of example from someone on Github which looks like this:

However this is still not working as for some reason it is not possible to debug the outputs of the model, my IDE’s just freeze so I have no idea what the model is out putting.

Is there any examples / decent documentation on the batches?


You can use the Gluon Dataloader:

dataloader ="/home/").transform_first(transform_fn),batch_size=batch_size)

for i, batch in enumerate(dataloader):

ImageFolderDataset is expecting a folder images in the home directory. This will automatically load all images located in images, normalize them and when iterating over the dataloader, it will give a batch of images.