Save model to file and generate images

This commit is contained in:
Anthony Wang 2021-09-03 11:32:55 -05:00
parent 20c8739f99
commit a4f072d08a
4 changed files with 6 additions and 2 deletions

BIN
accuracy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
loss.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View file

@ -113,14 +113,18 @@ for epoch in range(num_epochs):
print("Iteration: {}, Loss: {}, Accuracy: {}%".format(count, loss.data, accuracy))
torch.save(model.state_dict(), "model.pth")
print("Saved PyTorch Model State to model.pth")
plt.plot(iteration_list, loss_list)
plt.xlabel("No. of Iteration")
plt.ylabel("Loss")
plt.title("Iterations vs Loss")
plt.show()
plt.savefig("loss.png")
plt.plot(iteration_list, accuracy_list)
plt.xlabel("No. of Iteration")
plt.ylabel("Accuracy")
plt.title("Iterations vs Accuracy")
plt.show()
plt.savefig("accuracy.png")

BIN
model.pth

Binary file not shown.