titu1994 / keras-efficientnets

Keras Implementation of EfficientNets
MIT License
188 stars 63 forks source link

EfficientNet default pooling parameter is incorrect #12

Closed ebursztein closed 5 years ago

ebursztein commented 5 years ago

pooling=None in line 218 should be pooling='avg' so that when including top the correct pooling layers is added or the maxpool in an elif and have the else do nothing so it is up to the user to add its merging layers.

As it is by default x = layers.GlobalMaxPooling2D()(x) is included when use_top=False which is not what you want given that the default for the network is GlobalAveragePooling2D

titu1994 commented 5 years ago

If you refer to the Keras Applications module, all model builders use pooling=False. This argument is used only when the include_top argument is False.

If it is false, the user has 3 choices, get the raw outputs of the final layer without spatial pooling, or chose between max or avg spatial pooling. They are dictated by None, max and avg for the pooling argument respectively. https://github.com/keras-team/keras-applications/blob/master/keras_applications/nasnet.py#L71

By default, since pooling is not specified, it will not add any pooling layer at the end at all.

ebursztein commented 5 years ago

Agree seems fine. Read the code too quickly. sorry for the bother. Closing

titu1994 commented 5 years ago

No worries. Glad issue is resolved.