我有一个.caffemodel文件,我想通过Caffe2Kit在我的iOS应用程序中使用它,但是实例初始化函数参数是2个.pb文件,分别称为“ initNet”和“ predictNet”。我尝试使用caffe_translator:
python -m caffe2.python.caffe_translator deploy_nodist.prototxt global_model.caffemodel
但是我收到一条错误消息:
KeyError: 'No translator registered for layer: name: "Slice"\ntype: "Slice"\nbottom: "data_l_ab_mask"\ntop: "data_l"\ntop: "data_ab_mask"\nslice_param {\n slice_point: 1\n axis: 1\n}\n yet.'
我还尝试使用coremltools将此.caffemodel文件转换为.mlmodel文件:
coreml_model = coremltools.converters.caffe.convert('global_model.caffemodel')
但是我明白了:
Layer 0: Type: 'TransformingFastHDF5Input', Name: 'img'. Output(s): 'img'.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/anaconda2/lib/python2.7/site-packages/coremltools/converters/caffe/_caffe_converter.py", line 191, in convert
predicted_feature_name)
File "/anaconda2/lib/python2.7/site-packages/coremltools/converters/caffe/_caffe_converter.py", line 255, in _export
predicted_feature_name)
RuntimeError: Cannot convert caffe layer of type 'TransformingFastHDF5Input'.
如何将这个.caffemodel集成到我的iOS应用程序中? 还是我需要为mlmodel使用自定义图层?但是idk python。