# In[51]: WEIGHTS_PATH = "/home/rishabh/siamese/keras-oneshot/weights" # siamese_net.load_weights(WEIGHTS_PATH) # In[ ]: history = siamese_net.fit_generator( datagen.next_train(), steps_per_epoch=STEPS_PER_EPOCH, epochs=500, validation_data = datagen.next_val(), validation_steps = VALIDATION_STEPS, callbacks = [scheduler, reduce_lr, early_stopping, loss_history, checkpointer]) # In[30]: #get_ipython().magic(u'matplotlib inline') f, (ax1, ax2) = plt.subplots(1, 2, sharey=True) f.set_figheight(8) f.set_figwidth(14) ax1.plot(history.history['loss']) ax1.set_title('model loss') ax1.set_ylabel('loss')
from keras.optimizers import Adam adam = Adam(1e-3) triplet_net.compile(loss=triplet_loss, optimizer=adam) triplet_net.load_weights(INIT_WEIGHTS) # In[36]: # triplet_net.load_weights(CHECKPOINTED_WEIGHTS) history = triplet_net.fit_generator( datagen.next_train(), steps_per_epoch=STEPS_PER_EPOCH, epochs=500, validation_data=datagen.next_val(), validation_steps=VALIDATION_STEPS, callbacks = [reduce_lr, loss_history, checkpointer, early_stopping]) # In[ ]: triplet_net.load_weights(CHECKPOINTED_WEIGHTS) # In[ ]: # triplet_net.load_weights(CHECKPOINTED_WEIGHTS) history = triplet_net.evaluate_generator(