【发布时间】:2019-07-23 12:34:50
【问题描述】:
我想将 Mask-RCNN 移植到 tensorflow lite 以便能够在我的 android 设备上使用它。 Tensorflow lite 有一些教程展示了如何执行此操作,但是当您的模型具有扩展 keras 层类的层时,它们的说明会失败。特别是,这是我得到的错误:
/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/layers/serialization.py in deserialize(config, custom_objects)
87 module_objects=globs,
88 custom_objects=custom_objects,
---> 89 printable_module_name='layer')
/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
179 config = identifier
180 (cls, cls_config) = class_and_config_for_serialized_keras_object(
--> 181 config, module_objects, custom_objects, printable_module_name)
182
183 if hasattr(cls, 'from_config'):
/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/utils/generic_utils.py in class_and_config_for_serialized_keras_object(config, module_objects, custom_objects, printable_module_name)
164 cls = module_objects.get(class_name)
165 if cls is None:
--> 166 raise ValueError('Unknown ' + printable_module_name + ': ' + class_name)
167 return (cls, config['config'])
168
ValueError: Unknown layer: ProposalLayer
我用来导入keras模型的代码是:
converter = tf.lite.TFLiteConverter.from_keras_model_file('mrcnn.h5')
你知道如何解决这个问题吗?
【问题讨论】:
标签: python tensorflow keras tensorflow-lite