December 2018
Beginner to intermediate
684 pages
21h 9m
English
The best-performing architecture on the original dataset has eight convolutional layers, and two final fully-connected layers. The convolutional layers are similar, so we can define a function to simplify their creation:
def svhn_layer(model, filters, strides, n, input_shape=None):
if input_shape is not None:
model.add(Conv2D(filters, kernel_size=5, padding='same', name='CONV{}'.format(n), input_shape=input_shape))
else: model.add(Conv2D(filters, kernel_size=5, padding='same', activation='relu', name='CONV{}'.format(n))) model.add(BatchNormalization(name='NORM{}'.format(n))) model.add(MaxPooling2D(pool_size=2, strides=strides, name='POOL{}'.format(n))) model.add(Dropout(0.2, name='DROP{}'.format(n))) ...