小编mav*_*cks的帖子

运行flowers_tf_lite.ipynb时如何修复'KeyError:'accuracy''?

当我运行flowers_tf_lite.ipynb脚本时。

链接到flowers_tf_lite.ipynb 脚本

获取KeyError: 'accuracy'错误停止了程序。

我该如何解决此类错误?

acc = history.history['accuracy']

val_acc = history.history['val_accuracy']

loss = history.history['loss']

val_loss = history.history['val_loss']

plt.figure(figsize=(8, 8))

plt.subplot(2, 1, 1)

plt.plot(acc, label='Training Accuracy')

plt.plot(val_acc, label='Validation Accuracy')

plt.legend(loc='lower right')

plt.ylabel('Accuracy')

plt.ylim([min(plt.ylim()),1])

plt.title('Training and Validation Accuracy')


plt.subplot(2, 1, 2)

plt.plot(loss, label='Training Loss')

plt.plot(val_loss, label='Validation Loss')

plt.legend(loc='upper right')

plt.ylabel('Cross Entropy')

plt.ylim([0,1.0])

plt.title('Training and Validation Loss')

plt.xlabel('epoch')

plt.show()
Run Code Online (Sandbox Code Playgroud)

KeyError 的 Img:“准确度”错误

python keyerror tensorflow

5
推荐指数
1
解决办法
8411
查看次数

标签 统计

keyerror ×1

python ×1

tensorflow ×1