I am trying to fine-tune a VGG16 model. I have removed the last 5 layers
(*block5_pool (MaxPooling2D),flatten(Flatten),fc1 (Dense),fc2 (Dense),predictions (Dense)*).
Now, I want to add a global average pooling layer, but I am getting this error
Input 0 is incompatible with layer global_average_pooling2d_4: expected ndim=4, found ndim=2**
what seems to be the problem here?
model = VGG16(weights='imagenet', include_top=True)
model.layers.pop()
model.layers.pop()
model.layers.pop()
model.layers.pop()
model.layers.pop()
x = model.output
x = GlobalAveragePooling2D()(x)