talebolano / yolov3-network-slimming

yolov3 network slimming剪枝的一种实现
345 stars 93 forks source link

tensor dimension mismatch #5

Open springkim opened 5 years ago

springkim commented 5 years ago

Dear @talebolano . I got below error. Is this my problem? and how can i fix this problem if not.

E:\TSpring(YOLO)4classes-new2>python sparsity_train.py -sr --s 0.0001 --image_folder 4classes-new2.data --cfg darknet53.cfg --weights darknet53_608_random_60000.weights --reso 608
load network
done!
load weightsfile
done!
C:\Python36\lib\site-packages\skimage\transform\_warps.py:110: UserWarning: Anti-aliasing will be enabled by default in skimage 0.15 to avoid aliasing artifacts when down-sampling images.
  warn("Anti-aliasing will be enabled by default in skimage 0.15 to "
C:\Python36\lib\site-packages\skimage\transform\_warps.py:110: UserWarning: Anti-aliasing will be enabled by default in skimage 0.15 to avoid aliasing artifacts when down-sampling images.
  warn("Anti-aliasing will be enabled by default in skimage 0.15 to "
Traceback (most recent call last):
  File "sparsity_train.py", line 154, in <module>
    train()
  File "sparsity_train.py", line 100, in train
    loss = model(imgs, targets)
  File "C:\Python36\lib\site-packages\torch\nn\modules\module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "E:\TSpring(YOLO)4classes-new2\yolomodel.py", line 347, in forward
    x, *losses = self.module_list[i][0](x, targets)
  File "C:\Python36\lib\site-packages\torch\nn\modules\module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "E:\TSpring(YOLO)4classes-new2\yolomodel.py", line 55, in forward
    prediction = x.view(nB, nA, self.bbox_attrs, nG, nG).permute(0, 1, 3, 4, 2).contiguous()
RuntimeError: invalid argument 2: size '[1 x 9 x 9 x 19 x 19]' is invalid for input with 9747 elements at ..\aten\src\TH\THStorage.cpp:84
talebolano commented 5 years ago

hi, may be some problem happen in 'darknet53.cfg'? does your cfg have the 'yolo' layer ? i suggest that you can try yolov3.cfg first . And if your cfg have 'yolo' layer, may be try setting 'num=3'

springkim commented 5 years ago

Thanks, darknet53.cfg is sames as yolov3.cfg(diffrent # of classes). I changed num to 3. and It works. But it shows Division by Zero at yolomodel.py line 108. So i fix this simple problem. Now i have to watch result........

talebolano commented 5 years ago

maybe reduce the '0.5' of lines 105 ‘nProposals = int((pred_conf > 0.5).sum().item())’ in yolomodel.py.

lingprince commented 5 years ago

hello,have you solve this problem? I have the same problem with you. It always shows "Division by Zero"