Created
January 17, 2020 13:34
-
-
Save Cospel/43d95f9b884bb7e7cd8227bf2b191652 to your computer and use it in GitHub Desktop.
normalized_model.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create the base model | |
| base_model = tf.keras.applications.MobileNetV2(include_top=False, weights="imagenet", input_shape=shape) | |
| # apply normalization on input | |
| inputs = tf.keras.Input(shape=shape, name="input") | |
| x = PreprocessTFLayer()(inputs) | |
| x = base_model(x) | |
| x = tf.keras.layers.GlobalAveragePooling2D()(x) | |
| outputs = tf.keras.layers.Dense(2, activation="softmax", name="probs")(x) | |
| # create the model | |
| model = tf.keras.Model(inputs=inputs, outputs=outputs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment