A possible bug in training.py
Opened this issue · 2 comments
lee2430 commented
Dear @BobLiu20 , thanks for sharing your code. It's wonderful, however I think there might be a bug in the loss related block of training.py:
losses = [[]] * len(losses_name)
for i in range(3):
_loss_item = yolo_losses[i](outputs[i], labels)
for j, l in enumerate(_loss_item):
losses[j].append(l)
losses = [sum(l) for l in losses]
loss = losses[0]
I suppose the losses
should be a 7 * 3 list, but actually it appear to be of the size 7 * 21. Every time losses[j].append(l)
is executed, l
is appended to each sublist of losses
. And after losses = [sum(l) for l in losses]
is done, all the elements of 'losses' are identical. I doubt that this behavior is not like what the code is supposed to act. If I'm right, I think this issue can be addressed by changing losses = [[]] * len(losses_name)
into:
losses = []
for i in range(len(losses_name)):
losses.append([])
or something like that.
sordonia120446 commented
Looks like the issue has been resolved. @BobLiu20 I leave you the honors to close this issue.