Traceback (most recent call last):
File "train.py", line 82, in
loss = model(imgs, targets)
File "/home/alupotto/anaconda3/envs/pt4_cu9_p35/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, kwargs)
File "/home/alupotto/PycharmProjects/tracktorch/models.py", line 213, in forward
x, losses = module[0](x, targets)
File "/home/alupotto/anaconda3/envs/pt4_cu9_p35/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(input, kwargs)
File "/home/alupotto/PycharmProjects/tracktorch/models.py", line 177, in forward
return loss, loss_x.item(), loss_y.item(), loss_w.item(), loss_h.item(), loss_conf.item(), loss_cls.item(), float(nCorrect/nGT)
ZeroDivisionError: division by zero
I am training with my own data/labels and I had some images that didn't have ground truth at all So the file .txt exists but inside is empty.
I just added a check control before return float(nCorrect/nGT) in models.py like this:
AP = float(nCorrect/nGT) if nGT is not 0 else 0 and then I return AP.
I mention it in case somebody has the same problem or for future updates.
Hello,
I found an error in the last commit:
Traceback (most recent call last): File "train.py", line 82, in
loss = model(imgs, targets)
File "/home/alupotto/anaconda3/envs/pt4_cu9_p35/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, kwargs)
File "/home/alupotto/PycharmProjects/tracktorch/models.py", line 213, in forward
x, losses = module[0](x, targets)
File "/home/alupotto/anaconda3/envs/pt4_cu9_p35/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(input, kwargs)
File "/home/alupotto/PycharmProjects/tracktorch/models.py", line 177, in forward
return loss, loss_x.item(), loss_y.item(), loss_w.item(), loss_h.item(), loss_conf.item(), loss_cls.item(), float(nCorrect/nGT)
ZeroDivisionError: division by zero
I am training with my own data/labels and I had some images that didn't have ground truth at all So the file .txt exists but inside is empty.
I just added a check control before return
float(nCorrect/nGT)
in models.py like this:AP = float(nCorrect/nGT) if nGT is not 0 else 0
and then I return AP.I mention it in case somebody has the same problem or for future updates.