ZQPei / deep_sort_pytorch

MOT using deepsort and yolov3 with pytorch
MIT License
2.79k stars 722 forks source link

RuntimeError: output with shape [1, 128, 64] doesn't match the broadcast shape [3, 128, 64] #153

Open zhiaoLee opened 4 years ago

zhiaoLee commented 4 years ago

I tried to run deep_sort/deep/feature_extractor.py, but there was a problem.

Traceback (most recent call last): File "D:/目标检测各模型/deep_sort_pytorch-master/deep_sort/deep/feature_extractor.py", line 56, in feature = extr(img) File "D:/目标检测各模型/deep_sort_pytorch-master/deep_sort/deep/feature_extractor.py", line 44, in call im_batch = self._preprocess(im_crops) File "D:/目标检测各模型/deep_sort_pytorch-master/deep_sort/deep/feature_extractor.py", line 39, in _preprocess im_batch = torch.cat([self.norm(_resize(im, self.size)).unsqueeze(0) for im in im_crops], dim=0).float() File "D:/目标检测各模型/deep_sort_pytorch-master/deep_sort/deep/feature_extractor.py", line 39, in im_batch = torch.cat([self.norm(_resize(im, self.size)).unsqueeze(0) for im in imcrops], dim=0).float() File "F:\softmanage\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py", line 61, in call img = t(img) File "F:\softmanage\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py", line 166, in call return F.normalize(tensor, self.mean, self.std, self.inplace) File "F:\softmanage\Anaconda3\lib\site-packages\torchvision\transforms\functional.py", line 208, in normalize tensor.sub(mean).div_(std) RuntimeError: output with shape [1, 128, 64] doesn't match the broadcast shape [3, 128, 64] can you help me ? thanks!!!

Zsugabubus27 commented 4 years ago

Hi!

It is because the Extractor expects list of images, however it is called with a single image Change this: feature = extr(img) to this: feature = extr([img])

Note that this does not affects the behaviour of the whole algorithm since running feature_extractor.py only is just for testing.