การติดตามการเรียนรู้

การสร้างโมเดลภาพด้วย Keras

Ariel Rokem

Senior Data Scientist, University of Washington

เส้นโค้งการเรียนรู้: การฝึก

การสร้างโมเดลภาพด้วย Keras

เส้นโค้งการเรียนรู้: การตรวจสอบ

การสร้างโมเดลภาพด้วย Keras

เส้นโค้งการเรียนรู้: การ overfit

การสร้างโมเดลภาพด้วย Keras
training = model.fit(train_data, train_labels, 
                     epochs=3, validation_split=0.2)

import matplotlib.pyplot as plt plt.plot(training.history['loss'])
plt.plot(training.history['val_loss'])
plt.show()

การสร้างโมเดลภาพด้วย Keras

การบันทึกพารามิเตอร์ที่ดีที่สุด

from keras.callbacks import ModelCheckpoint

# This checkpoint object will store the model parameters 
# in the file "weights.hdf5"
checkpoint = ModelCheckpoint('weights.hdf5', monitor='val_loss', 
                             save_best_only=True)

# Store in a list to be used during training callbacks_list = [checkpoint]
# Fit the model on a training set, using the checkpoint as a #callback model.fit(train_data, train_labels, validation_split=0.2, epochs=3, callbacks=callbacks_list)
การสร้างโมเดลภาพด้วย Keras

การโหลดพารามิเตอร์ที่บันทึกไว้

model.load_weights('weights.hdf5')

model.predict_classes(test_data)
array([2, 2, 1, 2, 0, 1, 0, 1, 2, 0])
การสร้างโมเดลภาพด้วย Keras

มาฝึกกันเถอะ!

การสร้างโมเดลภาพด้วย Keras

Preparing Video For Download...