Open bahulkark opened 4 years ago
@bahulkark hello,I met the same mistake with you. Have you fixed it ?
Nope.
On Mon, 7 Sep 2020, 17:37 risemeup, notifications@github.com wrote:
@bahulkark https://github.com/bahulkark hello,I met the same mistake with you. Have you fixed it ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bingykang/Fewshot_Detection/issues/42#issuecomment-688282799, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYEWBGGKQS2DIG2AWPV2D3SETEINANCNFSM4OPT4E5A .
I met the same mistake with you
Anyone have a fix for this?
Is the pytorch version wrong?
I am using torch 1.4 and can perform the forward pass through the model error is in the regionloss.py pred_boxes[0] = x.data + grid_x here x.data is a 4D tensor while grid_x is a 2D tensor
I am using pytorch 1.7. With the view() method I can reshape and fit in the addition pred_boxes[0] = x.data.view(nBnAnHnW) + grid_x pred_boxes[1] = y.data.view(nBnAnHnW)+ grid_y pred_boxes[2] = torch.exp(w.data).view(nBnAnHnW) anchor_w pred_boxes[3] = torch.exp(h.data).view(nBnAnHnW) anchor_h
pred_boxes[0] = x.data.view(nB*nA*nH*nW) + grid_x
pred_boxes[1] = y.data.view(nB*nA*nH*nW) + grid_y
pred_boxes[2] = torch.exp(w.data).view(nB*nA*nH*nW) * anchor_w
pred_boxes[3] = torch.exp(h.data).view(nB*nA*nH*nW) * anchor_h
change region_loss.py 294-297: pred_boxes[0] = x.data.view(nBnAnHnW) + grid_x pred_boxes[1] = y.data.view(nBnAnHnW) + grid_y pred_boxes[2] = torch.exp(w.data).view(nBnAnHnW) anchor_w pred_boxes[3] = torch.exp(h.data).view(nBnAnHnW) anchor_h
and this problem can be resolved
I am trying to implement the code in Google Colab. I am getting this error, I had a similar issue in
cgf.py
but I solved it. Below is the output and error that I am getting after runningtrain_meta.py
!python train_meta.py cfg/metayolo.data cfg/darknet_dynamic.cfg cfg/reweighting_net.cfg darknet19_448.conv.23
/content/Fewshot_Detection/data/coco.names ('save_interval', 10) ['bird', 'bus', 'cow', 'motorbike', 'sofa'] ('base_ids', [0, 1, 3, 4, 6, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19]) logging to backup/metayolofix_novel0_neg1 ('class_scale', 1) layer filters size input output 0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32 1 max 2 x 2 / 2 416 x 416 x 32 -> 208 x 208 x 32 2 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64 3 max 2 x 2 / 2 208 x 208 x 64 -> 104 x 104 x 64 4 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 5 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 6 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 7 max 2 x 2 / 2 104 x 104 x 128 -> 52 x 52 x 128 8 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 9 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 10 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 11 max 2 x 2 / 2 52 x 52 x 256 -> 26 x 26 x 256 12 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 13 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 14 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 15 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 16 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 17 max 2 x 2 / 2 26 x 26 x 512 -> 13 x 13 x 512 18 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 19 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 20 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 21 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 22 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 23 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024 24 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024 25 route 16 26 conv 64 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 64 27 reorg / 2 26 x 26 x 64 -> 13 x 13 x 256 28 route 27 24 29 conv 1024 3 x 3 / 1 13 x 13 x1280 -> 13 x 13 x1024 30 dconv 1024 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x1024 31 conv 30 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 30 32 detection
layer filters size input output 0 conv 32 3 x 3 / 1 416 x 416 x 4 -> 416 x 416 x 32 1 max 2 x 2 / 2 416 x 416 x 32 -> 208 x 208 x 32 2 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64 3 max 2 x 2 / 2 208 x 208 x 64 -> 104 x 104 x 64 4 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 5 max 2 x 2 / 2 104 x 104 x 128 -> 52 x 52 x 128 6 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 7 max 2 x 2 / 2 52 x 52 x 256 -> 26 x 26 x 256 8 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 9 max 2 x 2 / 2 26 x 26 x 512 -> 13 x 13 x 512 10 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 11 max 2 x 2 / 2 13 x 13 x1024 -> 6 x 6 x1024 12 conv 1024 3 x 3 / 1 6 x 6 x1024 -> 6 x 6 x1024 13 glomax 6 x 6 / 1 6 x 6 x1024 -> 1 x 1 x1024 1 14554 80200 32 10 ===> Number of samples (before filtring): 4952 ===> Number of samples (after filtring): 4952 ('num classes: ', 15) factor: 3.0 ===> Number of samples (before filtring): 14554 ===> Number of samples (after filtring): 14554 ('num classes: ', 15) 2020-07-03 08:55:33 epoch 0/177, processed 0 samples, lr 0.000033 /usr/local/lib/python2.7/dist-packages/torch/nn/functional.py:1351: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead. warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.") Traceback (most recent call last): File "train_meta.py", line 328, in
train(epoch)
File "train_meta.py", line 223, in train
loss = region_loss(output, target)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/content/Fewshot_Detection/region_loss.py", line 294, in forward
pred_boxes[0] = x.data + grid_x
RuntimeError: The size of tensor a (13) must match the size of tensor b (70135) at non-singleton dimension 3