Python tensorflow.python.keras.layers.GlobalAveragePooling2D() Examples
The following are 1
code examples of tensorflow.python.keras.layers.GlobalAveragePooling2D().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.python.keras.layers
, or try the search function
.
Example #1
Source File: model_util.py From image-similarity with MIT License | 5 votes |
def _define_model(output_layer=-1): '''Define a pre-trained MobileNet model. Args: output_layer: the number of layer that output. Returns: Class of keras model with weights. ''' base_model = MobileNet(weights='imagenet', include_top=False, input_shape=(224, 224, 3)) output = base_model.layers[output_layer].output output = GlobalAveragePooling2D()(output) model = Model(inputs=base_model.input, outputs=output) return model