Hi,
So I was doing multi-class classification in the CelebA dataset (40 classes/attributes) using the crossentropy loss using a batch size of 64. So my target is [64, 40] and my output is also [64, 40] (using the ConvNeXt model). So for calculating accuracy, I am doing something like -
for i, d in enumerate(output, 0):
acc_ = pred_acc(torch.Tensor.cpu(targets[i]), torch.Tensor.cpu(d))
acc.append(acc_)
class_acc = np.asarray(acc).mean()
and my pred_acc function is -
def pred_acc(original, predicted):
return torch.round(predicted).eq(original).sum().numpy()/len(original)
Here the accuracy I am getting is pretty less, can anyone help to figure out what I am doing wrong (ig some issue in the pred function or the way I am passing the pds in them)