# How to change the pooling to adaptpooling before FC layer in the Inception-ResnetV2 model in keras

Now I am using the keras model: Inception-ResnetV2 to do image classification using transfer learning. The main code about this model is as following:

 def model_InceptionResNetV2(img_dim, num_label):
print('begin to get model')
input_tensor = Input(shape=img_dim)
#InceptionResNetV2
#     base_model = InceptionV3(include_top=False,
#                    weights='imagenet',
#                    input_shape=img_dim)
base_model = InceptionResNetV2(include_top=False, input_shape=img_dim, weights='imagenet')
bn = BatchNormalization()(input_tensor)
x = base_model(bn)
x = GlobalAveragePooling2D()(x)
x = Dropout(0.5)(x)
output = Dense(num_label, activation='softmax')(x)
model = Model(input_tensor, output)
print('finish getting model')
return model


But the model is not good for my image classification, some guys suggest me changing the pooling to adaptpooling before FC layer in model_InceptionResNetV2 so that the mode is not sensitive to image size, I want to use 512*512 size not just 299*299. Could you guys suggest me how to do it. Thanks!