In the notebook below I’ve created a Deep Learning Model in Pytorch and trained and tested it.
I want to save the instances of the test image data and the test image labels which and predicted test labels which came incorrect running it on the test set.
I have been trying to implement it using the for loops near the end of the Jupyter Notebook using :
correct = 0 total = 0 incorr_X =  incorr_y =  incorr_argmax =  with torch.no_grad(): for data in testset: X, y = data output = net(X.view(-1,784)) #print(output) for idx, i in enumerate(output): #print(torch.argmax(i), y[idx]) if torch.argmax(i) == y[idx]: correct += 1 else: incorr_X.append(X) incorr_y.append(y) incorr_argmax.append(torch.argmax(i)) total += 1
print("Accuracy: ", round(correct/total, 3))
Is this the correct approach to get the incorrectly predicted image, label and predicted label?
How do I access the corresponding images, labels and predicted labels?
I have written some implementations in the Notebook, but they seem to not be working.
Any help will be greatly appreciated.
Link to Notebook: