Toybrick

标题: Caffe模型CNN+bLSTM转换问题 [打印本页]

作者: nevin007    时间: 2019-3-5 10:31
标题: Caffe模型CNN+bLSTM转换问题
本帖最后由 nevin007 于 2019-3-6 11:48 编辑

将CNN+LSTM的caffe模型转换为rknn模型的时候出现了问题

1、转换脚本的配置如下:
ret = rknn.load_caffe(model='./plate_recog_debug1.prototxt',
                  proto='lstm_caffe',
                  blobs='./plate_recog_new.caffemodel')
错误信息:
(venv) $ python rknn_trans.py
--> Loading model
E Catch exception when loading caffe model: ./plate_recog_debug1.prototxt!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 257, in rknn.api.rknn_base.RKNNBase.load_caffe
T   File "rknn/base/rknnlib/converter/caffeloader.py", line 959, in rknn.base.rknnlib.converter.caffeloader.CaffeLoader.load
T   File "/data_1/niuyin/download/__RK3399Pro/RKNN/rknn-toolkit/package/venv/lib/python3.5/site-packages/google/protobuf/text_format.py", line 536, in Merge
T     descriptor_pool=descriptor_pool)
T   File "/data_1/niuyin/download/__RK3399Pro/RKNN/rknn-toolkit/package/venv/lib/python3.5/site-packages/google/protobuf/text_format.py", line 590, in MergeLines
T     return parser.MergeLines(lines, message)
T   File "/data_1/niuyin/download/__RK3399Pro/RKNN/rknn-toolkit/package/venv/lib/python3.5/site-packages/google/protobuf/text_format.py", line 623, in MergeLines
T     self._ParseOrMerge(lines, message)
T   File "/data_1/niuyin/download/__RK3399Pro/RKNN/rknn-toolkit/package/venv/lib/python3.5/site-packages/google/protobuf/text_format.py", line 638, in _ParseOrMerge
T     self._MergeField(tokenizer, message)
T   File "/data_1/niuyin/download/__RK3399Pro/RKNN/rknn-toolkit/package/venv/lib/python3.5/site-packages/google/protobuf/text_format.py", line 763, in _MergeField
T     merger(tokenizer, message, field)
T   File "/data_1/niuyin/download/__RK3399Pro/RKNN/rknn-toolkit/package/venv/lib/python3.5/site-packages/google/protobuf/text_format.py", line 837, in _MergeMessageField
T     self._MergeField(tokenizer, sub_message)
T   File "/data_1/niuyin/download/__RK3399Pro/RKNN/rknn-toolkit/package/venv/lib/python3.5/site-packages/google/protobuf/text_format.py", line 730, in _MergeField
T     (message_descriptor.full_name, name))
T google.protobuf.text_format.ParseError: 1638:3 : Message type "caffe.LayerParameter" has no field named "reverse_param".
Load plate model failed! Ret = -1

2、如果强行将Reserve这一层删除,再次执行转换脚本,错误信息如下:
(venv) $ python rknn_trans.py
--> Loading model
done
--> Building model
E Catch exception when building RKNN model!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 487, in rknn.api.rknn_base.RKNNBase.build
T   File "rknn/api/rknn_base.py", line 416, in rknn.api.rknn_base.RKNNBase._build
T   File "rknn/base/ovxconfiggenerator.py", line 156, in rknn.base.ovxconfiggenerator.generate_vx_config_from_files
T   File "rknn/base/rknnlib/app/code_generator/vxconfiggenerator.py", line 189, in rknn.base.rknnlib.app.code_generator.vxconfiggenerator.VXConfigGenerator.generate
T   File "rknn/base/rknnlib/app/code_generator/vxconfiggenerator.py", line 372, in rknn.base.rknnlib.app.code_generator.vxconfiggenerator.VXConfigGenerator._generate_tensors
T KeyError: 'indicator_1'
done
看起来是在building RKNN模型的时候出了问题,有人碰到过类似的问题吗


作者: nevin007    时间: 2019-3-5 10:32
本帖最后由 nevin007 于 2019-3-5 19:46 编辑

prototxt的前两层信息如下:

name: "resnet-blstm-ctc-ocr"
layer {
  name: "input"
  type: "Input"
  top: "data"
  input_param {
    shape {
      dim: 1
      dim: 3
      dim: 112
      dim: 240
    }
  }
}
layer {
  name: "indicator"
  type: "ContinuationIndicator"
  bottom: "data"
  top: "indicator"
  continuation_indicator_param {
    time_step: 60
  }
}
作者: nevin007    时间: 2019-3-7 09:21
有人关注吗
作者: raul    时间: 2019-3-7 09:38
本帖最后由 raul 于 2019-3-7 09:40 编辑

这个模型直接用caffe2能否跑吗?从日志来看,似乎caffe本身就不支持这个属性。




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3