在Opencv 3.4.1中加载Tensorflow模型失败

时间:2018-03-20 11:50:35

标签: opencv tensorflow keras javacv opencv3.3

我在java中使用opencv 3.4.1 DNN,以便在python中加载使用LeNetkeras训练的“tensorflow”模型。模型保存为tensorflow冻结模型“.pb”,其中我使用以下代码行加载它:

Dnn cvDnn = new org.opencv.dnn.Dnn();
Net net = cvDnn.readNetFromTensorflow("C:\\Users\\kr\\Desktop\\Plate_Recognition_frozen.pb");

错误说明:

OpenCV(3.4.1) Error: Unspecified error (Input layer not found: convolution2d_1_b_1) in cv::dnn::experimental_dnn_v4::`anonymous-namespace'::TFImporter::connect, file C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 553
Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.1) C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:553: error: (-2) Input layer not found: convolution2d_1_b_1 in function cv::dnn::experimental_dnn_v4::`anonymous-namespace'::TFImporter::connect
]
    at org.opencv.dnn.Dnn.readNetFromTensorflow_1(Native Method)
    at org.opencv.dnn.Dnn.readNetFromTensorflow(Dnn.java:163)
    at opencv.Main.main(Main.java:44)

任何帮助将不胜感激,提前谢谢。

0 个答案:

没有答案