警告 tensorflow:Early 以不可用的指标“val_loss”为条件停止

Warning tensorflow:Early stopping conditioned on metric `val_loss` which is not available

我收到了 tensorflow 警告,警告是在 val_accuracy 和 val_loss 计算出

的最后一次迭代之后发出的

我的 cnn 代码是-

metric = 'val_accuracy'
callback_list = [
    EarlyStopping(monitor='val_loss',patience=10),

    ModelCheckpoint(filepath="model.h5",monitor=metric,save_best_only=True,verbose=1)]

model.fit(training_set,
            steps_per_epoch = 37,
            epochs = 25,
            validation_data = val_set,
            validation_steps = 7,
            callbacks=callback_list
         )

输出屏幕是:-

Found 9081 images belonging to 6 classes.
Found 0 images belonging to 6 classes.
Epoch 1/25
37/37 [==============================] - 134s 3s/step - loss: 1.7911 - accuracy: 0.1926
WARNING:tensorflow:Early stopping conditioned on metric `val_loss` which is not available. Available metrics are: loss,accuracy
WARNING:tensorflow:Can save best model only with val_accuracy available, skipping.

训练时提供的验证数据集为空或不包含任何数据。所以,警告弹出。确保您没有使用任何硬编码值进行数据拆分。