ShuangXieIrene / ssds.pytorch

Repository for Single Shot MultiBox Detector and its variants, implemented with pytorch, python3.
MIT License
566 stars 165 forks source link

how to use demo.py to detect new image? #54

Closed LYJvincent closed 4 years ago

rw1995 commented 5 years ago

python demo.py --cfg=./experiments/cfgs/fssd_vgg16_train_voc.yml --demo=./experiments/1.mp4 --type=video

这么打,顺便问一句能加好友吗?一起学习

wilxy commented 5 years ago

python demo.py --cfg=./experiments/cfgs/fssd_vgg16_train_voc.yml --demo=./experiments/1.mp4 --type=video

这么打,顺便问一句能加好友吗?一起学习

你好,我在demo图片的时候遇到了 RuntimeErroe: The size if tensor a(4) must match the size of tensor b(2) at non-singleton dimension 但是我没有改过原始的网络结构啊,请问该怎么解决呢?感谢!

rw1995 commented 5 years ago

python demo.py --cfg=./experiments/cfgs/fssd_vgg16_train_voc.yml --demo=./experiments/1.mp4 --type=video 这么打,顺便问一句能加好友吗?一起学习

你好,我在demo图片的时候遇到了 RuntimeErroe: The size if tensor a(4) must match the size of tensor b(2) at non-singleton dimension 但是我没有改过原始的网络结构啊,请问该怎么解决呢?感谢!

抱歉这么晚才看到,请问你解决了吗?

woodenchild commented 5 years ago

@rw1995 hi, 我也遇到这个bug了 Traceback (most recent call last): File ".\demo.py", line 155, in demo_live(args, args.demo_file) File ".\demo.py", line 96, in demo_live _labels, _scores, _coords = object_detector.predict(image) File "D:\Visual_Detect\my_net_detec\ssds.pytorch\lib\ssds.py", line 82, in predict detections = self.detector.forward(out) File "D:\Visual_Detect\my_net_detec\ssds.pytorch\lib\layers\functions\detection.py", line 151, in forward ids, count = nms(boxes, scores, self.nms_thresh, self.top_k) ValueError: not enough values to unpack (expected 2, got 0)

看起来像是没输出的意思,不知道你遇到过没

robinenrico commented 5 years ago

python demo.py --cfg=./experiments/cfgs/fssd_vgg16_train_voc.yml --demo=./experiments/1.mp4 --type=video 这么打,顺便问一句能加好友吗?一起学习

你好,我在demo图片的时候遇到了 RuntimeErroe: The size if tensor a(4) must match the size of tensor b(2) at non-singleton dimension 但是我没有改过原始的网络结构啊,请问该怎么解决呢?感谢!

I encountered the same issue and resolved it by changing the following in the predict function of ssds.py:

Change: scale = torch.Tensor([img.shape[1::-1], img.shape[1::-1]]) To: scale = torch.Tensor([img.shape[1], img.shape[0], img.shape[1], img.shape[0]])

baoyinhe commented 4 years ago

@rw1995 hi, 我也遇到这个bug了 Traceback (most recent call last): File ".\demo.py", line 155, in demo_live(args, args.demo_file) File ".\demo.py", line 96, in demo_live _labels, _scores, _coords = object_detector.predict(image) File "D:\Visual_Detect\my_net_detec\ssds.pytorch\lib\ssds.py", line 82, in predict detections = self.detector.forward(out) File "D:\Visual_Detect\my_net_detec\ssds.pytorch\lib\layers\functions\detection.py", line 151, in forward ids, count = nms(boxes, scores, self.nms_thresh, self.top_k) ValueError: not enough values to unpack (expected 2, got 0)

看起来像是没输出的意思,不知道你遇到过没

+1!请问解决了吗?

foreverYoungGitHub commented 4 years ago

The problem seems be fixed by @robinenrico, will close the issue for now.