Python tensorflow.python.keras.layers.MaxPooling2D() Examples
The following are 2
code examples of tensorflow.python.keras.layers.MaxPooling2D().
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: small_cnn.py From camera-trap-classifier with MIT License | 5 votes |
def architecture(inputs): """ Architecture of model """ conv1 = Conv2D(32, kernel_size=(3, 3), activation='relu')(inputs) max1 = MaxPooling2D(pool_size=(2, 2))(conv1) conv2 = Conv2D(32, (3, 3), activation='relu')(max1) max2 = MaxPooling2D(pool_size=(2, 2))(conv2) conv3 = Conv2D(64, (3, 3), activation='relu')(max2) max3 = MaxPooling2D(pool_size=(2, 2))(conv3) flat1 = Flatten()(max3) dense1 = Dense(64, activation='relu')(flat1) drop1 = Dropout(0.5)(dense1) return drop1
Example #2
Source File: pbt_tune_cifar10_with_keras.py From ray with Apache License 2.0 | 4 votes |
def _build_model(self, input_shape): x = Input(shape=(32, 32, 3)) y = x y = Convolution2D( filters=64, kernel_size=3, strides=1, padding="same", activation="relu", kernel_initializer="he_normal")(y) y = Convolution2D( filters=64, kernel_size=3, strides=1, padding="same", activation="relu", kernel_initializer="he_normal")(y) y = MaxPooling2D(pool_size=2, strides=2, padding="same")(y) y = Convolution2D( filters=128, kernel_size=3, strides=1, padding="same", activation="relu", kernel_initializer="he_normal")(y) y = Convolution2D( filters=128, kernel_size=3, strides=1, padding="same", activation="relu", kernel_initializer="he_normal")(y) y = MaxPooling2D(pool_size=2, strides=2, padding="same")(y) y = Convolution2D( filters=256, kernel_size=3, strides=1, padding="same", activation="relu", kernel_initializer="he_normal")(y) y = Convolution2D( filters=256, kernel_size=3, strides=1, padding="same", activation="relu", kernel_initializer="he_normal")(y) y = MaxPooling2D(pool_size=2, strides=2, padding="same")(y) y = Flatten()(y) y = Dropout(self.config.get("dropout", 0.5))(y) y = Dense( units=10, activation="softmax", kernel_initializer="he_normal")(y) model = Model(inputs=x, outputs=y, name="model1") return model