Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'type' #23

Open
lccui opened this issue Aug 25, 2020 · 5 comments
Open

KeyError: 'type' #23

lccui opened this issue Aug 25, 2020 · 5 comments

Comments

@lccui
Copy link

lccui commented Aug 25, 2020

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
Copy link
Author

lccui commented Aug 25, 2020

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
Copy link
Author

lccui commented Aug 25, 2020

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)

@sakethkhandavalli
Copy link

sakethkhandavalli commented Aug 25, 2020

@@ 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

@northeastsquare
Copy link

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

@ikuokuo
Copy link

ikuokuo commented Jul 19, 2021

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants