Save and further calculate the test accuracy result

Dear all,
After running the model, how could i save the result and then calculate the best accuracy on certain epoch and average accuracy in python? is there some way to load the result into excel as well?

Depending how the results should be stored you could:

  • store the print output in a text file using plain open() calls and append the strings,
  • store the tensors via
  • transform the tensors to numpy arrays via tensor.numpy() and either store it using a numpy method or create a pd.DataFrame using pandas, which would also allow you to create Excel sheets and other formats.

Hello. I also need to save some parameters like accuracy. I used this method:, '')

but it seems to require tools such as Panther with license to open .pt files. Is there another way to open this kind of file? Thanks for your help.

I’m not familiar with the Python package “Panther”, but you can use PyTorch to open the file and you can also use any file extension you like.
The .pt extension is just a commonly used one, but not a requirement:

x = torch.randn(10), "x.ptrblck")
y = torch.load("x.ptrblck")
print((x == y).all())
# tensor(True)

I added this lines:, "accuracy.txt")
                    y = torch.load("accuracy.txt")
                    print((accuracy == y))

but when I open the txt file, the content is not a number but something incomprehensible.