Creating the network

Keras allows building the deep neural networks by adding new layers one by one. Note, that all layers should be familiar to you to this moment.

from keras.models import Sequential from keras.layers import Activation, Dropout, Flatten, Dense, BatchNormalization, Conv2D, MaxPool2D model = Sequential() model.add(Conv2D(16, (3, 3), padding='same', activation='relu', input_shape=(height, width, depth))) model.add(Conv2D(16, (3, 3), padding='same')) model.add(BatchNormalization()) model.add(Activation('relu')) model.add(MaxPool2D((2,2))) model.add(Conv2D(32, (3, 3), padding='same', activation='relu')) model.add(Conv2D(32, (3, 3), padding='same')) model.add(BatchNormalization()) model.add(Activation('relu')) model.add(MaxPool2D((2,2))) ...

Get Machine Learning with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.