Question: Evaluate the average accuracy for the whole test dataset and find out which classes performed well, and the classes that did not perform well. Finish
Evaluate the average accuracy for the whole test dataset and find out which classes performed well, and the classes that did not perform well.
Finish the code and calculate the accuracy for each class.
class_correct = list(0. for i in range(10))
class_total = list(0. for i in range(10))
with torch.no_grad():
for data in testloader:
images, labels = data
outputs = net(images)
_, predicted = torch.max(outputs, 1)
c = (predicted == labels).squeeze()
for i in range(4):
label = labels[i]
class_correct[label] += c[i].item()
# To do
Step by Step Solution
There are 3 Steps involved in it
To finish the code to calculate the accuracy for each class you can add the following code for i in ... View full answer
Get step-by-step solutions from verified subject matter experts
