keras.callbacks.Callback的on_epoch_end参数中的log scores属于哪个class

Which class do the log scores belong to in the parameter of on_epoch_end of keras.callbacks.Callback

我试图在每个纪元后从我的 Keras 模型中获取分数,所以我使用以下自定义回调:

class EpochScoreHistory(keras.callbacks.Callback):
    def __init__(self, keys):
        self.custom_keys = keys

    def on_train_begin(self, logs={}):
        self.custom_avg_scores = dict()
        for key in self.custom_keys:
            self.custom_avg_scores[key]=[]

    def on_epoch_end(self, epoch, logs={}):
        for key in self.custom_keys:
            self.custom_avg_scores[key].append(logs.get(key))

在每个纪元之后,在 on_epoch_end 函数的日志参数中,我有像 acc 这样的分数,例如 0.567 等,但我想知道这些分数属于哪个 class 因为我的问题有两个 class 要 class 化为。

简而言之,当我们获取日志作为自定义 Keras 回调的 on_epoch_end 函数的参数时,这些日志中的分数属于哪个 classification class?例如,我希望获得一份准确度列表,但我对我所追求的每个分数都有一个单一的值。我想知道这是否是 Keras 中的错误。非常感谢。

Keras 为您提供模型的准确性,即它在 class 化 class 方面有多好。它不会为每个 class 提供一个值。您可能需要为此创建一个混淆矩阵。