Pyramidbox.pytorch icon indicating copy to clipboard operation
Pyramidbox.pytorch copied to clipboard

i use one common image without face to test, but one bug occurs? expect to explain it?

Open upsx opened this issue 5 years ago • 4 comments

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>

upsx avatar Jun 02 '19 04:06 upsx

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.

zz827 avatar Jun 14 '19 07:06 zz827

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

zyselvis avatar Aug 05 '19 15:08 zyselvis

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?

Llq201809 avatar Aug 20 '19 07:08 Llq201809

i have got the same problem as you,and how to deal with this problem

ZZH2950228 avatar Sep 12 '19 01:09 ZZH2950228