CNN 的加载精度和损失时期
loading accuracy and loss epochs of CNN
我已经使用以下代码保存了构建 CNN 的历史时期
history=classifier.fit_generator(training_set,
steps_per_epoch = 3194 // batchsize,
epochs = 100,
validation_data =test_set,
validation_steps = 1020 // batchsize)
with open('32_With_Dropout_rl_001_1_layer', 'wb') as file_pi:
pickle.dump(history.history, file_pi)
plt.plot(history.history['val_accuracy'])
plt.title('model accuracy using 32 filters, dropout and .001 Adam learning rate')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['test'], loc='upper left')
plt.show()
# summarize history for loss
plt.plot(history.history['val_loss'])
plt.title('model loss using 32 filters, dropout and .001 Adam learning rate')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['test'], loc='upper left')
plt.show()
我正在尝试加载我使用以下代码保存的同一图,但它给我 AttributeError: 'dict' object has no attribute 'history'
f = open('32_With_Dropout_rl_001_1_layer', 'rb')
history = pickle.load(f)
f.close()
# summarize history for accuracy
plt.plot(history.history['val_accuracy'])
plt.title('model accuracy using 32 filters, dropout and .001 Adam learning rate')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['test'], loc='upper left')
plt.show()
# summarize history for loss
plt.plot(history.history['val_loss'])
plt.title('model loss using 32 filters, dropout and .001 Adam learning rate')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['test'], loc='upper left')
plt.show()
您正在保存 history.histroy
字典而不是 history
。尝试通过 history['val_loss']
从加载的泡菜数据中访问您的数据。
我已经使用以下代码保存了构建 CNN 的历史时期
history=classifier.fit_generator(training_set,
steps_per_epoch = 3194 // batchsize,
epochs = 100,
validation_data =test_set,
validation_steps = 1020 // batchsize)
with open('32_With_Dropout_rl_001_1_layer', 'wb') as file_pi:
pickle.dump(history.history, file_pi)
plt.plot(history.history['val_accuracy'])
plt.title('model accuracy using 32 filters, dropout and .001 Adam learning rate')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['test'], loc='upper left')
plt.show()
# summarize history for loss
plt.plot(history.history['val_loss'])
plt.title('model loss using 32 filters, dropout and .001 Adam learning rate')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['test'], loc='upper left')
plt.show()
我正在尝试加载我使用以下代码保存的同一图,但它给我 AttributeError: 'dict' object has no attribute 'history'
f = open('32_With_Dropout_rl_001_1_layer', 'rb')
history = pickle.load(f)
f.close()
# summarize history for accuracy
plt.plot(history.history['val_accuracy'])
plt.title('model accuracy using 32 filters, dropout and .001 Adam learning rate')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['test'], loc='upper left')
plt.show()
# summarize history for loss
plt.plot(history.history['val_loss'])
plt.title('model loss using 32 filters, dropout and .001 Adam learning rate')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['test'], loc='upper left')
plt.show()
您正在保存 history.histroy
字典而不是 history
。尝试通过 history['val_loss']
从加载的泡菜数据中访问您的数据。