Commit be8c48de authored by Jean Ibarz's avatar Jean Ibarz
Browse files

Added parameters in default_model_creator() for on-line data augmentation,...

Added parameters in default_model_creator() for on-line data augmentation, random scale and random shift.
parent 8153fe20
import tensorflow as tf
import tensorflow.keras.layers as tkl
from core.layers import RandomShift2DLayer, RandomScale2DLayer
def default_model_creator():
def default_model_creator(model_config):
model = tf.keras.Sequential([
RandomScale2DLayer(minval=-10, maxval=10),
RandomShift2DLayer(minval=0, maxval=100, axis=1),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(units=320, activation='relu'),
tf.keras.layers.Dropout(rate=0.05),
tf.keras.layers.Dense(units=160, activation='relu'),
tf.keras.layers.Dropout(rate=0.05),
tf.keras.layers.Dense(units=80, activation='relu'),
tf.keras.layers.Dropout(rate=0.05),
tf.keras.layers.Dense(units=40, activation='relu'),
tf.keras.layers.Dropout(rate=0.0),
tf.keras.layers.Dense(units=10, activation='relu'),
tf.keras.layers.Dense(units=10, activation='relu'),
tf.keras.layers.Dense(units=10, activation='relu'),
tf.keras.layers.Dense(units=10, activation='relu'),
tf.keras.layers.Dense(units=10, activation='relu'),
tf.keras.layers.Dense(units=1, activation='sigmoid'),
tf.keras.layers.experimental.preprocessing.Rescaling(scale=360, offset=0.0)
RandomScale2DLayer(minval=model_config['random_scale']['minval'],
maxval=model_config['random_scale']['maxval']),
RandomShift2DLayer(minval=model_config['random_shift']['minval'],
maxval=model_config['random_shift']['maxval'],
axis=1),
tkl.Flatten(),
tkl.Dense(units=320, activation='relu'),
tkl.Dropout(rate=0.05),
tkl.Dense(units=160, activation='relu'),
tkl.Dropout(rate=0.05),
tkl.Dense(units=80, activation='relu'),
tkl.Dropout(rate=0.05),
tkl.Dense(units=40, activation='relu'),
tkl.Dropout(rate=0.0),
tkl.Dense(units=10, activation='relu'),
tkl.Dense(units=10, activation='relu'),
tkl.Dense(units=10, activation='relu'),
tkl.Dense(units=10, activation='relu'),
tkl.Dense(units=10, activation='relu'),
tkl.Dense(units=1, activation='sigmoid'),
tkl.experimental.preprocessing.Rescaling(scale=360, offset=0.0)
])
return model
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment