How to get the number of steps until a certain accuracy in keras?
I want to see how many steps does it take for my model to reach a certain accuracy.Say 90 percent on cifar10.How can I get this info from the keras model ?
EDIT: accuracy in each epoch is accessible in history object fit() returns,but im looking for accuracy in each step
Solution:
I made a callback object that keeps loss in each step
import pickle
from tensorflow.keras.callbacks import Callback
class LossHistory(Callback):
def __init__(self,path='',name=''):
super(Callback, self).__init__()
self.path = path
self.name=name
self.accuracy = []
self.losses=[]
def on_batch_end(self, batch, logs={}):
self.accuracy.append(logs.get('accuracy'))
self.losses.append(logs.get('loss'))
history_={}
history_['accuracy']=self.accuracy
history_['loss']=self.losses
with open(self.path+self.name+'_history.pkl', 'wb') as f:
pickle.dump(history_,f)
Topic epochs keras tensorflow accuracy
Category Data Science