Python keras.callbacks 模块,ProgbarLogger() 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用keras.callbacks.ProgbarLogger()

项目:sbrt2017    作者:igormq    | 项目源码 | 文件源码
def __init__(self, show_metrics=None):
        super(ProgbarLogger, self).__init__()

        self.show_metrics = show_metrics
项目:sbrt2017    作者:igormq    | 项目源码 | 文件源码
def on_train_begin(self, logs=None):
        super(ProgbarLogger, self).on_train_begin(logs)

        if self.show_metrics:
            self.params['metrics'] = self.show_metrics
项目:mcv-m5    作者:david-vazquez    | 项目源码 | 文件源码
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)