harveyslash
harveyslash

Reputation: 6014

Dataset API -- Variable input sizes for batching

I am training a model that can accept variable input sizes (its a fully convolutional network) that has quite a complex input pipeline.

Thats why i have to use the dataset api's from_generator method to handle all the logic.

However, I want to be able to train the network on image batches of different sizes. E.g. for first batch, the input images may be of size 200x200 , but for the next one it may be 300x300.

I want to randomise this process for a variety of size ranges (e.g. from 100x100 to 2000x2000).

This would be quite trivial using feed_dict: i would prepare a batch with the specific image size on each train step.

Is there any way to do this using the (high performance) dataset api so that I can leverage multi threading/prefetching without much work ?

Upvotes: 0

Views: 116

Answers (1)

Alexandre Passos
Alexandre Passos

Reputation: 5206

Your best bet is to start with Datasets for each different minibatch size you want to support, do batching within each such dataset, and then interleave them before building an iterator.

Upvotes: 1

Related Questions