无法将对象检测模型转换为tflite

时间:2020-03-20 21:09:36

标签: python tensorflow2.0 tensorflow-lite

我正在使用tf2.0和对象检测API。我有一个预先训练的ssd_mobilenet_v2_coco模型,我想将其转换为tensorflow lite(并进行float16量化)。

在模型的文件夹中,我有检查点,frozen_inference_graph.pb,model.ckpt.data-00000-of-00001,model.ckpt.index,model.ckpt.meta,pipeline.config和save_model文件夹。

我使用以下命令来获取tflite.pb python3 export_tflite_ssd_graph.py --output_directory = / home / tflite --pipeline_config_path = / home / exportedLP1 / pipeline.config --trained_checkpoint_prefix = / home / exportedLP1 / model.ckpt

然后,我使用以下python代码转换tflite.pb:

frozen_model_path = '/home/tflite/tflite_graph.pb'  
input_arrays=["image_tensor"]  
output_arrays=["detection_boxes","detection_scores","num_detections","detection_classes"]  
input_tensor={"image_tensor":[1,300,300,3]}
converter = tf.compat.v1.lite.TFLiteConverter.from_frozen_graph(frozen_model_path, input_arrays, output_arrays, input_tensor)  
tflite_model = converter.convert()  

最后一步tflite = converter.convert()导致“中止(核心转储)”。根据我在网上阅读的帖子,我应该能够转换为tflite,没有任何问题。

当前线程0x00007efbff6f1740(最近调用优先):

File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/lite/toco/python/toco_from_protos.py", line 56 in execute
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250 in _run_main
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299 in run
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/platform/app.py", line 40 in run
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/lite/toco/python/toco_from_protos.py", line 93 in main
File "/usr/local/bin/toco_from_protos", line 8 in
Aborted (core dumped)

0 个答案:

没有答案