Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : Training 4 Classes #82

Open
NaeemKhan333 opened this issue Feb 7, 2020 · 1 comment
Open

Error : Training 4 Classes #82

NaeemKhan333 opened this issue Feb 7, 2020 · 1 comment

Comments

@NaeemKhan333
Copy link

I am training 4 classes on my own dataset.After doing all the required process for the training. When I have started the training, I am Facing this following issue. Can Anybody help me to sort this problem.Thanks

video number:20
group: first_conv_weight has 1 params, lr_mult: 1, decay_mult: 1
group: first_conv_bias has 1 params, lr_mult: 2, decay_mult: 0
group: normal_weight has 71 params, lr_mult: 1, decay_mult: 1
group: normal_bias has 71 params, lr_mult: 2, decay_mult: 0
group: BN scale/shift has 2 params, lr_mult: 1, decay_mult: 0
Freezing BatchNorm2D except the first one.
Traceback (most recent call last):
File "main.py", line 333, in
main()
File "main.py", line 135, in main
train(train_loader, model, criterion, optimizer, epoch, log_training)
File "main.py", line 183, in train
top1.update(prec1[0], input.size(0))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

@shank885
Copy link

I had the same issue and the below step fixed it.

Change this line:
top1.update(prec1[0], input.size(0))

To this:
top1.update(prec1.item(), input.size(0))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants