darknet2caffe icon indicating copy to clipboard operation
darknet2caffe copied to clipboard

KeyError: 'type'

Open lccui opened this issue 4 years ago • 5 comments

yolov4: mish to relu

('upsample:', 119) ('upsample:', 129) unknow layer type yolo unknow layer type yolo unknow layer type yolo Traceback (most recent call last): File "darknet2caffe.py", line 519, in darknet2caffe(cfgfile, weightfile, protofile, caffemodel) File "darknet2caffe.py", line 15, in darknet2caffe save_prototxt(net_info , protofile, region=False) File "/home/lab/soft/darknet2caffe/prototxt.py", line 173, in save_prototxt if layer['type'] != 'Region' or region == True: KeyError: 'type'

lccui avatar Aug 25 '20 08:08 lccui

yolov4: mish to leaky is ok. I0825 16:46:47.052114 9499 net.cpp:257] Network initialization done. unknow layer type yolo unknow layer type yolo save prototxt to prototxt/yolov4-leaky-test.prototxt save caffemodel to caffemodel/yolov4-leaky-test.caffemodel

lccui avatar Aug 25 '20 08:08 lccui

Do you know the reasons why when I run nnie mapper ./yolov4.cfg,the result is begin net parsing.... end net parsing begin prev optimizing.... Segmentation fault (core dumped)

lccui avatar Aug 25 '20 08:08 lccui

@@ File "darknet2caffe.py", line 519, in darknet2caffe(cfgfile, weightfile, protofile, caffemodel) File "darknet2caffe.py", line 15, in darknet2caffe save_prototxt(net_info , protofile, region=False) File "/home/darknet2caffe/prototxt.py", line 173, in save_prototxt if layer['type'] != 'Region' or region == True: KeyError: 'type'

I too am getting the above error while running the code, does anyone know how to fix this and get the caffe model correctly. @ChenYingpeng @becauseofAI

sakethkhandavalli avatar Aug 25 '20 10:08 sakethkhandavalli

用python3 的话生成的protoxt文件为空,要修改里面的print为fp.write()

northeastsquare avatar Sep 09 '20 09:09 northeastsquare

Edit darknet2caffe.py line 233, add activation relu:

if block['activation'] == 'relu':
    activate_layer['type'] = 'ReLU'
    relu_param = OrderedDict()
    relu_param['negative_slope'] = '0'
    activate_layer['relu_param'] = relu_param
elif block['activation'] == 'leaky':
    activate_layer['type'] = 'ReLU'
    relu_param = OrderedDict()
    relu_param['negative_slope'] = '0.1'
    activate_layer['relu_param'] = relu_param
elif block['activation'] == 'mish':
    activate_layer['type'] = 'Mish'
    activate_layer['name'] = 'layer%d-act-mish' % layer_id

yolov4: mish to relu

('upsample:', 119) ('upsample:', 129) unknow layer type yolo unknow layer type yolo unknow layer type yolo Traceback (most recent call last): File "darknet2caffe.py", line 519, in darknet2caffe(cfgfile, weightfile, protofile, caffemodel) File "darknet2caffe.py", line 15, in darknet2caffe save_prototxt(net_info , protofile, region=False) File "/home/lab/soft/darknet2caffe/prototxt.py", line 173, in save_prototxt if layer['type'] != 'Region' or region == True: KeyError: 'type'

ikuokuo avatar Jul 19 '21 05:07 ikuokuo