pytorch_classifiers icon indicating copy to clipboard operation
pytorch_classifiers copied to clipboard

Accu is "0"

Open Akhiladdh opened this issue 6 years ago • 3 comments

Even after training for many epoch accuracy is remaining 0.

Epoch 50/199

100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3378/3378 [20:02<00:00, 2.81it/s] train Loss: 0.0236 Acc: 0.0000 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 230/230 [00:40<00:00, 5.74it/s] val Loss: 0.0234 Acc: 0.0000

Akhiladdh avatar Sep 24 '19 01:09 Akhiladdh

Initialize the running_corrects to 0.0 instead of 0 in the function train_model in file tars/tars_training.py

jeshjesh avatar Oct 13 '19 10:10 jeshjesh

Initialize the running_corrects to 0.0 instead of 0 in the function train_model in file tars/tars_training.py

I have tried your method, but it didn't work, either

Kyfafyd avatar Feb 06 '20 08:02 Kyfafyd

Initialize the running_corrects to 0.0 instead of 0 in the function train_model in file tars/tars_training.py

I have tried your method, but it didn't work, either

I have found the solution

running_corrects += torch.sum(preds == labels.data)

change to

running_corrects += float(torch.sum(preds == labels.data))

as well

Kyfafyd avatar Feb 06 '20 09:02 Kyfafyd