Search code examples
tensorflowneural-networkconv-neural-networktraining-data

tensorflow: batches of variable-sized images


When one passes to tf.train.batch, it looks like the shape of the element has to be strictly defined, else it would complain that All shapes must be fully defined if there exist Tensors with shape Dimension(None). How, then, does one train on images of different sizes?


Solution

  • You could set dynamic_pad=True in the argument of tf.train.batch.

    dynamic_pad: Boolean. Allow variable dimensions in input shapes. The given dimensions are padded upon dequeue so that tensors within a batch have the same shapes.