I am doing an assignment related to  image classification.My dataset has 5 different classes(labels).I have to calculate accuracy of each class(labels) separately.But my problem is that whenever I tested my CNN model I obtained 100% accuracy for one label and accuracy of other labels are 0%. I could not make sense where is my implementation problem.
Here is the code that i used for calculating accuracy of class labels
 classes = ['1', '2', '3', '4', '5']

    class_correct = list(0. for i in range(5))
    class_total = list(0. for i in range(5))

    net.eval()  # prep model for evaluation

    for batch in test_loader:
        data, target = batch['image'], batch['grade']

        if len(target.data) != BS:
            break
        # # forward pass: compute predicted outputs by passing inputs to the model
        output = net(data)
        # convert output probabilities to predicted class

        _, pred = torch.max(output, 1)
        # # compare predictions to true label
        correct = np.squeeze(pred.eq(target.data.view_as(pred)))
        # # calculate test accuracy for each object class
        for i in range(BS):
            label = target.data[i]
            class_correct[label] += correct[i].item()
            class_total[label] += 1

    for i in range(5):
        print('Test Accuracy of %5s: %2d%% (%2d/%2d)' % (
            classes[i], 100 * class_correct[i] / class_total[i],
            np.sum(class_correct[i]), np.sum(class_total[i])))


This is my results that I obtained
Accuracy of the network (overall): 46 %
    Test Accuracy of     1: 100% (652/652)
    Test Accuracy of     2:  0% ( 0/279)
    Test Accuracy of     3:  0% ( 0/459)
    Test Accuracy of     4:  0% ( 0/263)
    Test Accuracy of     5:  0% ( 0/47)