Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python detect.tflite无法将TF模型转换为tflite_Python_Macos_Tensorflow_Tensorflow Lite_Object Detection Api - Fatal编程技术网

Python detect.tflite无法将TF模型转换为tflite

Python detect.tflite无法将TF模型转换为tflite,python,macos,tensorflow,tensorflow-lite,object-detection-api,Python,Macos,Tensorflow,Tensorflow Lite,Object Detection Api,我正在使用mac,运行Catalina 10.15.5,使用Python 2.7.17,从源代码运行Tensorflow 1.15.3,使用pip安装,而不是Anaconda,我的bazel版本是0.26.1 根据本教程,我正在尝试将ssd_mobilenet_v3_small_coco上的自定义模型转换为TFlite:但无法使用以下行将我的TFlite_graph.pb转换为detect.TFlite: bazel run --config=opt tensorflow/lite/toco:t

我正在使用mac,运行Catalina 10.15.5,使用Python 2.7.17,从源代码运行Tensorflow 1.15.3,使用pip安装,而不是Anaconda,我的bazel版本是0.26.1

根据本教程,我正在尝试将ssd_mobilenet_v3_small_coco上的自定义模型转换为TFlite:但无法使用以下行将我的TFlite_graph.pb转换为detect.TFlite:

bazel run --config=opt tensorflow/lite/toco:toco -- --input_file=/Users/jp3spinelli/Desktop/models/research/object_detection/TFLite_model/tflite_graph.pb --output_file=/Users/jp3spinelli/Desktop/models/research/object_detection/TFLite_model/detect.tflite --input_shapes=1,300,300,3 --input_arrays=normalized_input_image_tensor --output_arrays=TFLite_Detection_PostProcess,TFLite_Detection_PostProcess:1,TFLite_Detection_PostProcess:2,TFLite_Detection_PostProcess:3 --inference_type=FLOAT --allow_custom_ops
我一直遇到这个错误(我只包括最后一点,因为它很长):

它正在创建一个文件,但它没有字节,所以我知道有些地方出错了。 我正在使用我的tensorflow目录,它位于我的主目录中。我注意到的一件奇怪的事情是,我桌面上“models”文件夹的路径显示它是从“iclouddrive”开始的,而不是从“Users”开始的


请让我知道如何解决这个问题,我是新的编码,所以我需要一些逐步的说明。谢谢

我认为应该将“”之间的output_数组设置为字符串,尝试运行如下操作:

bazel run --config=opt tensorflow/lite/toco:toco -- \
--input_file=$OUTPUT_DIR/tflite_graph.pb \
--output_file=$OUTPUT_DIR/detect.tflite \
--input_shapes=1,300,300,3 \
--input_arrays=normalized_input_image_tensor \
--output_arrays='TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3'  \
--inference_type=FLOAT \
--allow_custom_ops

我认为您应该将“”之间的输出_数组设置为字符串,尝试运行如下操作:

bazel run --config=opt tensorflow/lite/toco:toco -- \
--input_file=$OUTPUT_DIR/tflite_graph.pb \
--output_file=$OUTPUT_DIR/detect.tflite \
--input_shapes=1,300,300,3 \
--input_arrays=normalized_input_image_tensor \
--output_arrays='TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3'  \
--inference_type=FLOAT \
--allow_custom_ops

图中输入张量的形状与给定的
输入形状不匹配。因此,请尝试将
输入形状
更改为
1320320,3
@ShubhamPanchal,这很有效!非常感谢你!!图中输入张量的形状与给定的
输入形状不匹配。因此,请尝试将
输入形状
更改为
1320320,3
@ShubhamPanchal,这很有效!非常感谢你!!