【问题标题】:flower identification using cnn keras on windows 10在 Windows 10 上使用 cnn keras 进行花卉识别
【发布时间】:2020-04-17 13:34:54
【问题描述】:

在我与机器学习相关的项目中,使用 CNN keras 进行花卉识别..显示以下错误 错误:

 Anaconda3\lib\site-packages\keras\callbacks\callbacks.py:846: RuntimeWarning: Early stopping conditioned on metric `val_acc` which is not available. Available metrics are: val_loss,val_accuracy,loss,accuracy
  (self.monitor, ','.join(list(logs.keys()))), RuntimeWarning

关于代码:

#using Grid Search and Early stopping
es = EarlyStopping(monitor='val_acc', verbose=2, patience=25)
mc = ModelCheckpoint('./best_model_1.h5', monitor='val_acc', verbose=2, save_best_only=True)

Hyp_Model_1 = KerasClassifier(build_fn=Revised_1_fn)
#You need to pick the right hyper-parameters for your training (try with different ones)

learn_rate = [0.01]
batch_size = [32,75,100]
epochs = [5]

param_grid = dict(batch_size=batch_size, epochs=epochs, learn_rate = learn_rate)
randSearch_1 = GridSearchCV(estimator = Hyp_Model_1, param_grid=param_grid, cv=5)

new_grid_1 = randSearch_1.fit(X_train,y_train, validation_data = (X_val, y_val), verbose=2,callbacks=[es,mc])

【问题讨论】:

  • 错误消息清楚地指导您了解确切的问题是什么以及在您的代码中进行哪些更改。

标签: keras


【解决方案1】:

正如错误消息中所暗示的,Keras 不将val_acc 识别为度量;您需要输入可用选项中列出的val_accuracy

【讨论】:

    猜你喜欢
    • 2017-08-30
    • 2019-04-29
    • 2018-06-24
    • 2017-12-14
    • 1970-01-01
    • 2018-03-10
    • 2019-07-04
    • 2017-09-01
    • 2020-09-17
    相关资源
    最近更新 更多