Closed johnyquest7 closed 4 years ago
This happened when I used u2netp
It seems the issue of the different version of pytorch. Please make sure you are using pytorch 0.4.0 or you can change “loss0.data[0]” to fit your exact version of Pytorch.
On Jul 16, 2020, at 10:26 PM, Johnson Thomas notifications@github.com wrote:
I tried to train on my image set. But got the following error. My folder setup train_images - has 2 folders - 'images ' and another folder 'mask' When I ran the script it showed the correct number of images, but then got the following error
Traceback (most recent call last): File "u2net_train.py", line 143, in loss2, loss = muti_bce_loss_fusion(d0, d1, d2, d3, d4, d5, d6, labels_v) File "u2net_train.py", line 42, in muti_bce_loss_fusion print("l0: %3f, l1: %3f, l2: %3f, l3: %3f, l4: %3f, l5: %3f, l6: %3f\n"%(loss0.data[0],loss1.data[0],loss2.data[0],loss3.data[0],loss4.data[0],loss5.data[0],loss6.data[0])) IndexError: invalid index of a 0-dim tensor. Use tensor.item() in Python or tensor.item
() in C++ to convert a 0-dim tensor to a number — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NathanUA/U-2-Net/issues/48, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSGORJQKFXMRUEOGMLFPA3R37HF5ANCNFSM4O5PSVCA.
thanks, I am using pytorch 1.5
I tried to train on my image set. But got the following error. My folder setup train_images - has 2 folders - 'images ' and another folder 'mask' When I ran the script it showed the correct number of images, but then got the following error