def __init__(self, n_classes, *args):
super(Callback, self).__init__()
# Save input parameters
self.n_classes = n_classes
self.I = np.zeros(self.n_classes)
self.U = np.zeros(self.n_classes)
self.jacc_percl = np.zeros(self.n_classes)
self.val_I = np.zeros(self.n_classes)
self.val_U = np.zeros(self.n_classes)
self.val_jacc_percl = np.zeros(self.n_classes)
self.remove_metrics = []
for i in range(n_classes):
self.remove_metrics.append('I' + str(i))
self.remove_metrics.append('U' + str(i))
self.remove_metrics.append('val_I' + str(i))
self.remove_metrics.append('val_U' + str(i))
self.add_metrics = []
self.add_metrics.append('jaccard')
self.add_metrics.append('val_jaccard')
for i in range(n_classes):
self.add_metrics.append(str(i) + '_jacc')
self.add_metrics.append(str(i) + '_val_jacc')
setattr(ProgbarLogger, 'add_metrics', self.add_metrics)
setattr(ProgbarLogger, 'remove_metrics', self.remove_metrics)
setattr(ProgbarLogger, '_set_params', progbar__set_params)
setattr(ProgbarLogger, 'on_batch_end', progbar_on_batch_end)
setattr(ProgbarLogger, 'on_epoch_end', progbar_on_epoch_end)