Calling fit multiple times in keras not working

15 views
Skip to first unread message

sagar.dat...@gmail.com

unread,
Apr 26, 2018, 8:07:56 PM4/26/18
to Keras-users

Hello All , 


Based on this post : Calling "fit" multiple times in Keras


I tried to call multiple times model.fit() with different training chunk data and then check model accuracy but it saved training on the last piece of data.it'll overwrite all previously fitted coefficients, weights, intercept (bias), etc.

I have 800 GB of Training Data and developed Segmentation CNN (with ADAM Batch Optimizer to work on 64GB RAM using GTX 1080 Ti GPU).


for i in range(noofImgChunks):
 tngData=np.load(str(int(i))+".npy")
 tngMaskData=np.load(str(int(i))+".npy")      

 model_checkpoint = ModelCheckpoint(modelPath, monitor='val_loss', verbose=2, save_best_only=True)

 history = model.fit(tngData, tngMaskData, batch_size=5, nb_epoch=10, validation_split=0.2, verbose=1, callbacks=[model_checkpoint])

Some help understanding this would be much appreciated.

Thank you

Sagar Soni

unread,
May 6, 2018, 7:00:32 PM5/6/18
to Keras-users

Hello All , 

Based on this post : Calling "fitmultiple times in Keras

I tried to call multiple times model.fit() with different training chunk data and then check model accuracy but it saved training on the last piece of data. it'll overwrite all previously fitted coefficients, weights, intercept (bias), etc.

I have 800 GB of Training Data and developed Segmentation CNN (with ADAM Batch Optimizer to work on 64GB RAM using GTX 1080 Ti GPU).

#load model

model.compile(optimizer=Adam(learningRate), loss='binary_crossentropy',

                metrics=[jaccard_coef, jaccard_coef_int, 'accuracy'])

model_checkpoint = ModelCheckpoint(modelPath, monitor='val_loss', verbose=2, save_best_only=True)

#call model.fit over each chunk

for i in range(noofImgChunks):

  tngData=np.load(str(int(i))+".npy")

  tngMaskData=np.load(str(int(i))+".npy")      

  history = model.fit(tngData, tngMaskData, batch_size=5, nb_epoch=10,     validation_split=0.2, verbose=1, callbacks=[model_checkpoint])


Some help understanding this would be much appreciated.

Thank you,
Sagar

--
  

With Regards,

Sagar Soni | Machine Learning Engineer 

+22 109 7206


Reply all
Reply to author
Forward
0 new messages