I want to show accuracy under each picture output shown in Image Classification with Transfer Learning in PyTorch
I'm follow this link : https://stackabuse.com/image-classification-with-transfer-learning-and-pytorch/#settingupapretrainedmodel

but I'm new with coding skill. please tell me how to show accuracy value under image.

The model used in that example returns a tensor of logits of shape (batch size, classes). Assuming what you mean by "accuracy value" is the predicted probability of the class with the largest probability, what you need to do is first compute your probabilities by taking the SoftMax of the output from the model, which gives the predicted probabilities for each image in your batch. Their visualize_model function would look something like the following, though I haven't tested it.

def visualize_model(model, num_images=6):
    was_training = model.training
    model.eval()
    images_handeled = 0
    fig = plt.figure()

    with torch.no_grad():
        for i, (inputs, labels) in enumerate(dataloaders['val']):
            inputs = inputs.to(device)
            labels = labels.to(device)

            outputs = model(inputs)
            probabilities = nn.functional.softmax(outputs, dim=-1) # compute probabilities
            _, preds = torch.max(outputs, 1)

            for j in range(inputs.size()[0]):
                images_handeled += 1
                ax = plt.subplot(num_images//2, 2, images_handeled)
                ax.axis('off')
                ax.set_title('predicted: {}, probability: {}'.format(class_names[preds[j]], probabilities[preds[j]])) # add predicted class probability
                imshow(inputs.cpu().data[j])

                if images_handeled == num_images:
                    model.train(mode=was_training)
                    return
        model.train(mode=was_training)


Or do you mean overall classification accuracy?
