神经网络正则化

使用 Keras 进行图像建模

Ariel Rokem

Senior Data Scientist, University of Washington

Dropout(随机失活)

在每次学习步骤中:

  • 选择一部分单元
  • 在前向传播中忽略它们
  • 在误差反向传播中也忽略
使用 Keras 进行图像建模

Dropout(随机失活)

使用 Keras 进行图像建模

Keras 中的 Dropout

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'))
使用 Keras 进行图像建模

批归一化

  • 重新缩放输出
使用 Keras 进行图像建模

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'))
使用 Keras 进行图像建模

一起用要谨慎!

Dropout 与批归一化的不协调

使用 Keras 进行图像建模

¡Vamos a practicar!

使用 Keras 进行图像建模

Preparing Video For Download...