encoderonly: add graph plotting

This commit is contained in:
Starbeamrainbowlabs 2023-01-13 19:08:38 +00:00
parent 82e01da70b
commit 1a4ac3ed66
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -101,7 +101,7 @@ summarywriter(model, os.path.join(DIRPATH_OUTPUT, "summary.txt"))
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ # ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
# ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██████ # ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██████
model.fit(dataset_train, history = model.fit(dataset_train,
validation_data=dataset_validate, validation_data=dataset_validate,
epochs=25, epochs=25,
@ -124,6 +124,36 @@ model.fit(dataset_train,
) )
logger.info(">>> Training complete") logger.info(">>> Training complete")
logger.info(">>> Plotting graphs")
plt.plot(history.history["loss"])
plt.title("Training Loss")
plt.ylabel("loss")
plt.xlabel("epoch")
plt.savefig(os.path.join(DIRPATH_OUTPUT, "loss.png"))
plt.close()
plt.plot(history.history["accuracy"])
plt.title("Training Accuracy")
plt.ylabel("accuracy")
plt.xlabel("epoch")
plt.savefig(os.path.join(DIRPATH_OUTPUT, "acc.png"))
plt.close()
plt.plot(history.history["val_loss"])
plt.title("Validation Loss")
plt.ylabel("val_loss")
plt.xlabel("epoch")
plt.savefig(os.path.join(DIRPATH_OUTPUT, "val_loss.png"))
plt.close()
plt.plot(history.history["val_accuracy"])
plt.title("Validation Accuracy")
plt.ylabel("val_accuracy")
plt.xlabel("epoch")
plt.savefig(os.path.join(DIRPATH_OUTPUT, "val_acc.png"))
plt.close()
# ██████ ██████ ███████ ██████ ██ ██████ ████████ ██ ██████ ███ ██ # ██████ ██████ ███████ ██████ ██ ██████ ████████ ██ ██████ ███ ██
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ # ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
@ -132,8 +162,8 @@ logger.info(">>> Training complete")
# ██ ██ ██ ███████ ██████ ██ ██████ ██ ██ ██████ ██ ████ # ██ ██ ██ ███████ ██████ ██ ██████ ██ ██ ██████ ██ ████
logger.info("Predictions coming soon.")
# TODO FILL THIS IN # TODO FILL THIS IN
# █████ █████ █████ █████ █████ █████ █████ █████ █████ # █████ █████ █████ █████ █████ █████ █████ █████ █████