Neural network regularization

Mô hình hóa ảnh với Keras

Ariel Rokem

Senior Data Scientist, University of Washington

Dropout

In each learning step:

  • Select a subset of the units
  • Ignore it in the forward pass
  • And in the back-propagation of error
Mô hình hóa ảnh với Keras

Dropout

Mô hình hóa ảnh với Keras

Dropout in Keras

from keras.models import Sequential
from keras.layers import Dense, Conv2D, Flatten, Dropout

model = Sequential() model.add(Conv2D(5, kernel_size=3, activation='relu', input_shape=(img_rows, img_cols, 1)))
model.add(Dropout(0.25))
model.add(Conv2D(15, kernel_size=3, activation='relu')) model.add(Flatten()) model.add(Dense(3, activation='softmax'))
Mô hình hóa ảnh với Keras

Batch normalization

  • Rescale the outputs
Mô hình hóa ảnh với Keras

Batch Normalization in Keras

from keras.models import Sequential
from keras.layers import Dense, Conv2D, Flatten, BatchNormalization 


model = Sequential() model.add(Conv2D(5, kernel_size=3, activation='relu', input_shape=(img_rows, img_cols, 1)))
model.add(BatchNormalization())
model.add(Conv2D(15, kernel_size=3, activation='relu')) model.add(Flatten()) model.add(Dense(3, activation='softmax'))
Mô hình hóa ảnh với Keras

Be careful when using them together!

The disharmony between dropout and batch normalization

Mô hình hóa ảnh với Keras

Let's practice!

Mô hình hóa ảnh với Keras

Preparing Video For Download...