logo
Loading...

demo.ipynb執行Forward pass 會出現 ValueError: not enough values to unpack (expected 2, got 0) - Cupoy

demo.ipynb 內有一段'''要先用Variable包裝才能送給Pytorch模型'''xx ...

cvdl-1,cvdl-1-d29

demo.ipynb執行Forward pass 會出現 ValueError: not enough values to unpack (expected 2, got 0)

2020/01/08 下午 06:24
電腦視覺深度學習討論版
林弘敏
觀看數:10
回答數:1
收藏數:1
cvdl-1
cvdl-1-d29

demo.ipynb 內有一段

'''要先用Variable包裝才能送給Pytorch模型'''

xx = Variable(x.unsqueeze(0))     # wrap tensor in Variable

if torch.cuda.is_available():

   xx = xx.cuda()

'''Forward Pass'''

y = net(xx)


執行後會出現錯誤, 內容如下:

ValueError                                Traceback (most recent call last)

in 

     4     xx = xx.cuda()

     5 '''Forward Pass'''

----> 6 y = net(xx)


D:\Anaconda3\lib\site-packages\torch\nn\modules\module.py in __call__(self, *input, **kwargs)

   475             result = self._slow_forward(*input, **kwargs)

   476         else:

--> 477             result = self.forward(*input, **kwargs)

   478         for hook in self._forward_hooks.values():

   479             hook_result = hook(self, input, result)


~\ssd.py in forward(self, x)

   101                 self.softmax(conf.view(conf.size(0), -1,

   102                              self.num_classes)),                # conf preds

--> 103                 self.priors.type(type(x.data))                  # default boxes

   104             )

   105         else:


~\layers\functions\detection.py in forward(self, loc_data, conf_data, prior_data)

    52                 boxes = decoded_boxes[l_mask].view(-1, 4)

    53                 # idx of highest scoring and non-overlapping boxes per class

---> 54                 ids, count = nms(boxes, scores, self.nms_thresh, self.top_k)

    55                 output[i, cl, :count] = \

    56                     torch.cat((scores[ids[:count]].unsqueeze(1),


ValueError: not enough values to unpack (expected 2, got 0)

回答列表

  • 2020/01/09 下午 10:23
    楊哲寧
    贊同數:0
    不贊同數:0
    留言數:0

    您好,看起來是nms那裡出了問題,請問您的torch version是多少呢?