In keras pretrained model (keras applications page). tutorial uses GlobalAveragePooling2D() before feeding to customized top layers. What GlobalAveragePooling2D() does? and why not using Flatten(), since these are going to be fed to FC layers? what would be the best practice in this matter if I use VGG16 or VGG19, or inception V3 with customized top layers?
Thanks.
Both Flatten
and GlobalAveragePooling2D
are valid options. So is GlobalMaxPooling2D
.
Flatten
will result in a larger Dense
layer afterwards, which is more expensive and may result in worse overfitting. But if you have lots of data, it might also perform better.
As usual, it depends completely on your problem.
Most helpful comment
Both
Flatten
andGlobalAveragePooling2D
are valid options. So isGlobalMaxPooling2D
.Flatten
will result in a largerDense
layer afterwards, which is more expensive and may result in worse overfitting. But if you have lots of data, it might also perform better.As usual, it depends completely on your problem.