PengyiZhang / SlimYOLOv3

This page is for the SlimYOLOv3: Narrower, Faster and Better for UAV Real-Time Applications
1.14k stars 320 forks source link

Error in Prune.py #31

Closed varghesealex90 closed 5 years ago

varghesealex90 commented 5 years ago

I downloaded ultrlytics (master branch) and modified line 35 modules.add_module('BatchNorm2d', nn.BatchNorm2d(filters, momentum=0.1)) to modules.add_module('batchnorm%d' % i, nn.BatchNorm2d(filters))

I used the unpruned weights provided and the cfg and ran python3.7 prune.py

I get following error:

ayer: 121 convolutional layer: 122 convolutional layer: 123 convolutional layer: 124 convolutional layer: 125 yolo Traceback (most recent call last): File "prune.py", line 389, in opt.perlayer_ratio, File "prune.py", line 270, in test pruned_model = Darknet(output_cfg_path, img_size).to(device) File "/src/slimyolov3/ktian/yolov3/models.py", line 199, in init self.module_defs = parse_model_cfg(cfg) File "/src/slimyolov3/ktian/yolov3/utils/parse_config.py", line 22, in parse_model_cfg mdefs[-1][key] = np.array([float(x) for x in val.split(',')]).reshape((-1, 2)) # np anchors File "/src/slimyolov3/ktian/yolov3/utils/parse_config.py", line 22, in mdefs[-1][key] = np.array([float(x) for x in val.split(',')]).reshape((-1, 2)) # np anchors ValueError: could not convert string to float: ' [[ 10 13]' I have no name!@6558fd4db45e:/src/slimyolov3/ktian/yolov3$ ValueError: could not convert string to float: bash: ValueError:: command not found

lcaikk1314 commented 5 years ago

参考原来的网络cfg,手动把anchor那行拷贝到生成的文件中就行;或者修改下保存网络的代码

varghesealex90 commented 5 years ago

Closing the issue as issue is resolved !!