how i get the classification result as percentage accuracy% and also as an image with CNN?

help me plzz

how i get the classification result as percentage accuracy% and also as an image with CNN?

help me plzz

To get the accuracy you can first initialize a total and correct amount above your dataloader loop but below your epoch loop like this:

```
for e in epochs:
total = 0.
correct = 0.
for data in dataloader:
```

then in the dataloader loop you can do this

```
output = model(input)
pred = output.data.max(1, keepdim=True)[1]
compare predictions to true label
correct += np.sum(np.squeeze(pred.eq(target.data.view_as(pred))).cpu().numpy())
total += images.size(0)
```

and just print it out when you print out your loss by something like this

```
print('\nTest Accuracy: %2d%% (%2d/%2d)' % (
100. * correct / total, correct, total))
```

and I am not sure what you mean by the image with CNN. This is also assuming you are using softmax.

@Dwight_Foster hi, I want the classification result with CNN as an image (the result), is not fair I display the value of the accuracy