YOLOv3v4-ModelCompression-MultidatasetTraining-Multibackbone
YOLOv3v4-ModelCompression-MultidatasetTraining-Multibackbone copied to clipboard
RuntimeError: Sizes of tensors must match except in dimension 2.
Hello, I have successfully finished the following steps:
-
Normal training using 1000 images from coco-2014 dataset with command: python3 train.py --data data/coco2014.data --batch-size 16 -pt --weights yolov4.weights --cfg cfg/yolov4/yolov4.cfg
-
After this I obtained initial weights last.pt and using then I have successfully finished sparsity training with command: python train.py --data data/coco2014.data -pt --weights weights/last.pt --batch-size 4 --cfg cfg/yolov4/yolov4.cfg --epochs 200 -sr --s 0.001 --prune 0
-
However, in the final pruning stage I am stuck while testing the final model step. The compactmodel2 is unable to go through eval_model function as when the tensors go through test.py they throw following error:
RuntimeError: Sizes of tensors must match except in dimension 2. Got 44and 88 (The offending index is 0).
I will really appreciate for any solutions. Thanks in advance.
The command I use to run pruning is: python layer_channel_regular_prune.py --data data/coco2014.data --weights weights/last.pt --cfg cfg/yolov4/yolov4.cfg --percent 0.5 --img-size 608
I am sorry tell you layer_channell_prune method is unsupported right now, you can use layer prune at first, I will fix this bug resently.
@SpursLipu thank you replying. I had the same issue.. so I tried python layer_prune.py --data data/coco2014.data --weights weights/Yolov4_sparsity_prune0.pt --cfg cfg/yolov4/yolov4.cfg and pruning completed.. +------------+----------+----------+ | Metric | Before | After | +------------+----------+----------+ | mAP | 0.005023 | 0.000000 | | Parameters | 64363101 | 56653917 | | Inference | 0.0227 | 0.0196 | +------------+----------+----------+ Config file has been saved: cfg/prune_8_shortcut_yolov4/prune_8_shortcut_yolov4.cfg Compact model has been saved: weights/prune_8_shortcut_Yolov4_sparsity_prune0.weights
The mAP is 0 and there are no detections happening did I miss something?
I am sorry tell you layer_channell_prune method is unsupported right now, you can use layer prune at first, I will fix this bug resently.
RuntimeError: Sizes of tensors must match except in dimension 2. Got 58 and 106 (The offending index is 0). Still the error comes when I run the layer_channel_prune.py. Is this bug fixed?
I will really appreciate for any solutions.
很抱歉告诉您layer_channell_prune方法现在不受支持,您可以先使用图层修剪,我会怨恨地修复此错误。
运行时错误:张量的大小必须匹配,维度 2 除外。得到 58 和 106(违规指数为 0)。当我运行layer_channel_prune.py时,仍然会出现错误。这个错误修复了吗?
我将非常感谢任何解决方案。
I am sorry tell you layer_channell_prune method is unsupported right now, you can use layer prune at first, I will fix this bug resently.
RuntimeError: Sizes of tensors must match except in dimension 2. Got 58 and 106 (The offending index is 0). Still the error comes when I run the layer_channel_prune.py. Is this bug fixed?
I will really appreciate for any solutions. Hi,Did you fixed this bug?