Open WestbrookZero opened 5 years ago
Do you solve this problem?
我也是同样的问题?
请问一下,执行run_ssd_example.py脚本报这个错该如何解决? Traceback (most recent call last): File "run_ssd_example.py", line 57, in boxes, labels, probs = predictor.predict(image, 10, 0.4) File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\ssd\predictor.py", line 37, in predict scores, boxes = self.net.forward(images) File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\ssd\ssd.py", line 100, in forward locations, self.priors, self.config.center_variance, self.config.size_variance File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\utils\box_utils.py", line 104, in convert_locations_to_boxes locations[..., :2] center_variance priors[..., 2:] + priors[..., :2], RuntimeError: expected backend CPU and dtype Float but got backend CUDA and dtype Float
模型加载到cuda就行了
If you are trying to use GPU, change device
in create_mobilenetv3_ssd_lite_predictor to torch.device('cuda:0')
, it works for me.
@siemonchan thanks
请问一下,执行run_ssd_example.py脚本报这个错该如何解决? Traceback (most recent call last): File "run_ssd_example.py", line 57, in boxes, labels, probs = predictor.predict(image, 10, 0.4) File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\ssd\predictor.py", line 37, in predict scores, boxes = self.net.forward(images) File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\ssd\ssd.py", line 100, in forward locations, self.priors, self.config.center_variance, self.config.size_variance File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\utils\box_utils.py", line 104, in convert_locations_to_boxes locations[..., :2] center_variance priors[..., 2:] + priors[..., :2], RuntimeError: expected backend CPU and dtype Float but got backend CUDA and dtype Float
模型加载到cuda就行了
修改vision/ssd/mobilenet_v3_ssd_lite.py文件第90行成def create_mobilenetv3_ssd_lite_predictor(net, candidate_size=200, nms_method=None, sigma=0.5, device=torch.device('cuda:0'))就可以了。
It is recommended that git clone this version https://github.com/shaoshengsong/MobileNetV3-SSD-Compact-Version
请问一下,执行run_ssd_example.py脚本报这个错该如何解决? Traceback (most recent call last): File "run_ssd_example.py", line 57, in
boxes, labels, probs = predictor.predict(image, 10, 0.4)
File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\ssd\predictor.py", line 37, in predict
scores, boxes = self.net.forward(images)
File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\ssd\ssd.py", line 100, in forward
locations, self.priors, self.config.center_variance, self.config.size_variance
File "D:\Projects\DeepLearning\MobileNetV3-SSD-master\vision\utils\box_utils.py", line 104, in convert_locations_to_boxes
locations[..., :2] center_variance priors[..., 2:] + priors[..., :2],
RuntimeError: expected backend CPU and dtype Float but got backend CUDA and dtype Float