简体   繁体   中英

Keras Image Classification for Different Input Sizes

I want to use Tensorflow and Keras to train a dataset composed of images with very different sizes in order to classify them. But some of them are horizontal (1400x100) and some of them are vertical (100x1000). As far as I understand, Keras accepts same size input images. I'm not sure if it's wise to convert all of them to a classical resolution like 150x150 or 180x180 since they are horizontal and vertical.

How can I solve this problem?

A few methods have been developed to process images with multiple sizes, including images with unequal horizontal and vertical dimensions. For example, spatial pyramid pooling or scale recurrent neural networks . You could also set network dimensions to be variable , then use a pooling operation (eg global average pooling) to get fixed size dimensions before fully connected or other layers than need a fixed size.

The simplest approach is cropping or padding images (eg with zeros) so that they are all the same size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM