# "Loss" and "accuracy" are weird

running_loss and Accuracy is weird.
Is there any expected problem?

What do you mean by “expected problem”?

Could you explain the x-axis in both plots? Are you printing some iterations or epochs?
Also, what is your current use case, i.e. if it’s a classification use case what is the number of classes, are the classes balanced etc?

Based on the accuracy plot it also seems you are plotting two (or multiple) values for the same step?
Is this on purpose?

plot1 loss_tracker
x : Accumulation batchs number
y: running loss

plot2 Accuracy
x : Accumulation epoch number
y: accuracy

four-class classification,
Output : tensor([[-1867.3853, -5551.1318, -4450.6240, 11866.9102],
[-2225.3528, -5707.1665, -2959.6877, 10890.8711],
[-2529.1191, -5777.2607, -4512.0718, 12815.6875],
[-2559.4792, -6071.3545, -3919.7209, 12546.3398]], device=‘cuda:0’)

Target : tensor([3, 3, 3, 3], device=‘cuda:0’)
Loss: 0.0

I often get a loss of zero in the course of learning.

Thanks for the update.
Could you check, if your model is only predicting `class3` and check, if this would explain this shaky loss curve?

Also, the second plot still seems to plot some outputs for the same x-value, so you should double check the code logic for the plotting.

## Output : tensor([[ -28.4967, 14.9120, 146.2759, -132.4498], [ 3.0310, 41.4412, 18.8934, -62.9328], [ 75.7614, -30.5392, -390.3096, 344.8382], [ 70.0653, -71.1584, -411.3787, 412.4350]], device=‘cuda:0’)

Target : tensor([2, 2, 3, 3], device=‘cuda:0’)

I think classify other classes as well.

[second plot]
def acc_check(net, test_set, epoch, save=1):
net.eval()
correct = 0
total = 0
for data in test_set:
inputs, labels = data
inputs = inputs.to(device)
labels = torch.argmax(labels, dim=1)
labels = labels.to(device)
outputs = net(inputs.permute(0,4,1,2,3))

``````        _, predicted = torch.max(outputs.data, 1)
#print("labels : ",labels)
#print("prediced :" ,predicted)
total += labels.size(0)
correct += (predicted == labels).sum().item()

acc = (100 * correct / total)
print('Accuracy of the network on the 10000 test images: %d %%' % acc)
if epoch%50==0:
torch.save(net, "D:/data/3dcnn_weights/basic128_epoch_{}_acc_{}.pth".format(epoch, int(acc)))
pass
return acc
``````

acc = acc_check(model_ft, test_loader, epoch, save=1)
value_tracker(acc_plt, torch.Tensor([acc]), torch.Tensor([epoch]))

thanks