【发布时间】:2021-02-02 08:18:29
【问题描述】:
我使用 Tensorflow 2 创建了一个自定义对象检测 ssd mobilenet 模型。我按照以下步骤操作https://github.com/abhimanyu1990/SSD-Mobilenet-Custom-Object-Detector-Model-using-Tensorflow-2。该模型在 Tensorflow 2 上运行良好。
由于我们需要创建冻结模型的文本图形表示以与 opencv 一起使用,我点击此链接 https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API 并使用 tf_text_graph_ssd.py 生成配置文件,以便我可以将它与 OpenCV 一起使用。运行此脚本时出现以下错误
`
Traceback (most recent call last):
File "/home/phoenix/Documents/repos/python/tensorflow_model/tf_text_graph_common.py", line 313, in writeTextGraph
cv.dnn.writeTextGraph(modelPath, outputPath)
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-6amqbhlx/opencv/modules/dnn/src/tensorflow/tf_io.cpp:42: error: (-2:Unspecified error) FAILED: ReadProtoFromBinaryFile(param_file, param). Failed to parse GraphDef file: exported-model/mobile-model/saved_model/saved_model.pb in function 'ReadTFNetParamsFromBinaryFileOrDie'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tf_text_graph_ssd.py", line 405, in <module>
createSSDGraph(args.input, args.config, args.output)
File "tf_text_graph_ssd.py", line 128, in createSSDGraph
writeTextGraph(modelPath, outputPath, outNames)
File "/home/phoenix/Documents/repos/python/tensorflow_model/tf_text_graph_common.py", line 316, in writeTextGraph
from tensorflow.tools.graph_transforms import TransformGraph
ModuleNotFoundError: No module named 'tensorflow.tools.graph_transforms'
谢谢!
【问题讨论】:
标签: tensorflow opencv