Last active
July 16, 2021 15:55
-
-
Save Yuvnish017/e0e5f5810ae355e713a73bdce489795b to your computer and use it in GitHub Desktop.
OCR
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
def step_decay(epoch): | |
initial_learning_rate = 0.001 | |
dropEvery = 10 | |
factor = 0.5 | |
lr = initial_learning_rate*(factor**np.floor((1 + epoch)/dropEvery)) | |
return float(lr) | |
checkpoint = ModelCheckpoint('maths_symbol_and_digits_recognition.h5', | |
monitor='val_loss', save_best_only=True, | |
verbose=1, mode='min') | |
callbacks = [checkpoint, LearningRateScheduler(step_decay)] | |
aug = ImageDataGenerator(zoom_range=0.1, | |
width_shift_range=0.05, | |
height_shift_range=0.05) | |
hist = model.fit(aug.flow(X_train, Y_train, batch_size=128), | |
batch_size=128, epochs=100, | |
validation_data=(X_test, Y_test)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment