如何在TensorFlow中批量处理任意大小的图像?

时间:2018-01-16 15:35:08

标签: tensorflow

Acually在Caffe中,似乎有一种方法可以在调整图像大小后保持纵横比,使得较小的维度等于500或者其他。

但我找不到任何方法来解决这个问题。

在这paper中,我们可以看到, We implemented our model using the Caffe library [15] and optimized it using SGD with momentum. Training on the AVA dataset’s approximately 250k training images took 2 weeks on a single Nvidia M40 GPU. Although our network can train and evaluate with images of arbitrary dimensions, very large images drastically decrease training and evaluation speed and pose memory issues due to GPU memory constraints. Therefore, in practice we resize each image such that the smaller image dimension equaled 500, while maintaining the original aspect ratio. This resulted in significant loss of resolution in some cases, but is a signifi- cantly higher resolution than is typically used for convolutional networks. We used a batch size of 128, a learning rate of 10−3 , momentum of 0.9 and weight decay of 5 · 10−4 . We reduced the learning rate after every 20k iterations. The convolutional layers were pre-trained on ImageNet [6].

1 个答案:

答案 0 :(得分:0)

您可以像对待自己喜欢的库一样简单地调整图像大小,例如,您可以使用scipy.misc.imresize。