Save model to file and generate images
This commit is contained in:
parent
20c8739f99
commit
a4f072d08a
BIN
accuracy.png
Normal file
BIN
accuracy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
8
mnist.py
8
mnist.py
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue