-
-
Save vortexkd/6069c9446151d110ca202e2746e71f7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
model = build_model() #ここに学習させたいモデルをロードするか、作成する | |
# 大量のデータで学習しているからこそチェックポイントなどをつけましょう。 | |
ckpt = tf.keras.callbacks.ModelCheckpoint('models/ckpt.hdf5', monitor='val_loss', | |
verbose=0, save_best_only=True, | |
save_weights_only=False, mode='auto', period=3) | |
lr = tf.keras.callbacks.ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=5, | |
verbose=1, mode='auto', min_delta=0.0001, | |
cooldown=3, min_lr=0) | |
model.fit_generator( | |
generate_input_data(class_map, path), | |
steps_per_epoch=train_size // batch_size, | |
validation_data=generate_input_data(path=test_data_path), | |
validation_steps= test_size // batch_size, | |
epochs=30, | |
callbacks=[ckpt, lr] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment