Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.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 OpenCV-Tensorflow模型导入错误_Python_Opencv_Tensorflow - Fatal编程技术网

Python OpenCV-Tensorflow模型导入错误

Python OpenCV-Tensorflow模型导入错误,python,opencv,tensorflow,Python,Opencv,Tensorflow,我使用ssd_mobilenet_v1_coco模型和OpenCV进行对象检测 cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'graph.pbtxt') 使用原始graph.pbtxt时,它是正常的。 但是当我使用tf_text_graph_ssd创建pbtxt文件时 然后: cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb',

我使用ssd_mobilenet_v1_coco模型和OpenCV进行对象检测

cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'graph.pbtxt')
使用原始graph.pbtxt时,它是正常的。 但是当我使用tf_text_graph_ssd创建pbtxt文件时

然后:

cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'pbtxt/frozen_inference_graph.pbtxt')
它给出了错误:

OpenCV Error: Unspecified error (Input layer not found: 
FeatureExtractor/MobilenetV1/zeros) in 
cv::dnn::experimental_dnn_v3::`anonymous-
namespace'::TFImporter::populateNet, file C:
\projects\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, 
line 1061
Traceback (most recent call last):
File "opencv_tensorflow.py", line 3, in <module>
cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 
'pbtxt/frozen_inference_graph.pbtxt')
cv2.error: C:\projects\opencv-
python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:1061: error: (-2) 
Input layer not found: FeatureExtractor/MobilenetV1/zeros in function cv::d
nn::experimental_dnn_v3::`anonymous-namespace'::TFImporter::populateNet
将pb转换为pbtxt时有什么问题

在这里,我的目标是使用图像再培训创建自定义模型,并在OpenCV上使用它。

所以我有一个自定义模型,但没有pbtxt文件


首先,我尝试为示例ssd\u mobilenet\u v1\u coco模型创建pbtxt文件。

我可以使用tf\u text\u graph\u ssd.py和以下命令创建pbtxt文件

    python tf_text_graph_ssd.py --input=C:\Users\Hp\Desktop\anas\Robomy\tfLearn\cell_inference_graph\frozen_inference_graph.pb --output=C:\Users\Hp\Desktop\anas\Robomy\tfLearn\cell_inference_graph\ssd_mobilenet_v1_balls_2018_05_20.pbtxt --config C:\Users\Hp\Desktop\anas\Robomy\tfLearn\data\ssd_mobilenet_v2_coco.config

这个pbtxt在opencv上运行得非常好,您还必须指定配置文件。我想,如果您已经使用TysFraceAPI进行了传输学习,那么您将找到一个名为Pultuix.CONFIG的文件,以及FROZENEONEXPRESSIONGROUP.PB文件。将该文件作为-config pipeline.config与语法一起使用。它应该能解决问题。

你的问题解决了吗?我有同样的理由:
    python tf_text_graph_ssd.py --input=C:\Users\Hp\Desktop\anas\Robomy\tfLearn\cell_inference_graph\frozen_inference_graph.pb --output=C:\Users\Hp\Desktop\anas\Robomy\tfLearn\cell_inference_graph\ssd_mobilenet_v1_balls_2018_05_20.pbtxt --config C:\Users\Hp\Desktop\anas\Robomy\tfLearn\data\ssd_mobilenet_v2_coco.config