costapt / vess2ret

A Keras implementation of pix2pix code adapted to generate retinal images from vessel networks.
MIT License
94 stars 42 forks source link

fit_generator with LearningRateScheduler #10

Closed 32nguyen closed 6 years ago

32nguyen commented 6 years ago

Hi, I would like to have a question about fit_generator. As I know, I can set the LearningRateScheduler thought callback =[learning rate]) when I run fit_generator one time such as:

fit_generator(it_train, steps_per_epoch=params.step_per_epoch_train, epochs=params.epochs, verbose=1, validation_data=it_val, validation_steps=params.steps_batch_valid, callbacks=[history, lrate, checkpoint])

def step_decay(epoch): initial_lrate = 0.001

initial_lrate = 9.765625e-07

drop = 0.5 epochs_drop = 10.0 lrate = initial_lrate * math.pow(drop, math.floor((1 + epoch) / epochs_drop)) return lrate lrate = LearningRateScheduler(step_decay)

However, is that possible to set the learningrate when you called it many time in epochs iteration. I think the learning will be reset. Sorry I do not know how to insert the code with correct indentation Bests, Thanh