erikguo / yolov3

Integrate SlimYoloV3 in YOLOv3 in PyTorch in Branch slimyolov3
GNU General Public License v3.0
26 stars 8 forks source link

run purne.py error #7

Open broliao opened 5 years ago

broliao commented 5 years ago

when I run prune.py with follow parameter, Namespace(cfg='cfg/yolov3-spp.cfg', img_size=608, overall_ratio=0.5, perlayer_ratio=0.1, save='prune_0.5_0.1', weights='weights/best.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1060 6GB', total_memory=6078MB)

i get the error:

Traceback (most recent call last): File "/home/broliao/桌面/yolov3-slimyolov3/prune.py", line 396, in opt.perlayer_ratio, File "/home/broliao/桌面/yolov3-slimyolov3/prune.py", line 344, in test inf_out, train_out = pruned_model(imgs) # inference and training outputs File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, **kwargs) File "/home/broliao/桌面/yolov3-slimyolov3/models.py", line 226, in forward x = torch.cat([layer_outputs[i] for i in layers], 1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 13 and 28 in dimension 2 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71

who can help me?thanks a lot.

ASONG0506 commented 5 years ago

in "models.py" comment this line layer_outputs[layers[1]] = F.interpolate(layer_outputs[layers[1]], scale_factor=[0.5, 0.5])

broliao commented 5 years ago

@ASONG0506 thanks for your reply, I will try it.

May-forever commented 5 years ago

when I run prune.py with follow parameter, Namespace(cfg='cfg/yolov3-spp.cfg', img_size=608, overall_ratio=0.5, perlayer_ratio=0.1, save='prune_0.5_0.1', weights='weights/best.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1060 6GB', total_memory=6078MB)

i get the error:

Traceback (most recent call last): File "/home/broliao/桌面/yolov3-slimyolov3/prune.py", line 396, in opt.perlayer_ratio, File "/home/broliao/桌面/yolov3-slimyolov3/prune.py", line 344, in test inf_out, train_out = pruned_model(imgs) # inference and training outputs File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, **kwargs) File "/home/broliao/桌面/yolov3-slimyolov3/models.py", line 226, in forward x = torch.cat([layer_outputs[i] for i in layers], 1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 13 and 28 in dimension 2 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71

who can help me?thanks a lot.

师兄,你好,我在win10上配置了这个工程,用来修剪我自己的网络(不是YOLOv3),但是报了下面这个错,你能帮我看看问题出在哪吗?先谢谢师兄了 1

zbyuan commented 5 years ago

@broliao @ASONG0506 hai I have encountered the same mistake, have you solved it?