Pyramidbox.pytorch
Pyramidbox.pytorch copied to clipboard
i use one common image without face to test, but one bug occurs? expect to explain it?
File ".\demo.py", line 74, in detect y = net(x) File "C:\Users\xxxxx\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 493, in call result = self.forward(*input, **kwargs) File "C:\Users\xxxxx\Desktop\local\Pyramidbox.pytorch\pyramidbox.py", line 252, in forward priors) File "C:\Users\xxxxx\Desktop\local\Pyramidbox.pytorch\layers\functions\detection.py", line 65, in forward boxes_, scores, self.nms_thresh, self.top_k) ValueError: not enough values to unpack (expected 2, got 0) PS C:\Users\shuxin\Desktop\local\Pyramidbox.pytorch>
File ".\demo.py", line 74, in detect y = net(x) File "C:\Users\xxxxx\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 493, in call result = self.forward(*input, **kwargs) File "C:\Users\xxxxx\Desktop\local\Pyramidbox.pytorch\pyramidbox.py", line 252, in forward priors) File "C:\Users\xxxxx\Desktop\local\Pyramidbox.pytorch\layers\functions\detection.py", line 65, in forward boxes_, scores, self.nms_thresh, self.top_k) ValueError: not enough values to unpack (expected 2, got 0) PS C:\Users\shuxin\Desktop\local\Pyramidbox.pytorch>
try to return keep and 0 in the nms function, that works for me.
In the function of nms, there is an exception return needs one more value
keep = scores.new(scores.size(0)).zero_().long()
if boxes.numel() == 0:
return keep
solved by replacing by
keep = scores.new(scores.size(0)).zero_().long()
if boxes.numel() == 0:
return keep, 0
In the function of nms, there is an exception return needs one more value
keep = scores.new(scores.size(0)).zero_().long() if boxes.numel() == 0: return keep
solved by replacing by
keep = scores.new(scores.size(0)).zero_().long() if boxes.numel() == 0: return keep, 0
but it occurs a new error after replacing:
File "/home/XXXX/Pyramidbox.pytorch-master/layers/functions/detection.py", line 66, in forward output[i, cl, :count] = torch.cat((scores[ids[:count]].unsqueeze(1), RuntimeError: cannot unsqueeze empty tensor
Have you encountered this problem? How to solve it?
i have got the same problem as you,and how to deal with this problem