loading Tensorflow model in Opencv 3.4.1 failed

asked 2018-03-20 06:42:56 -0500

Hi, i'm using opencv 3.4.1 in java in order to load a "LeNet" model trained using keras and tensorflow in python. The model is saved as a tensorflow frozen model ".pb" where i'm using the following line of code to load the it:

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

where the Error says:

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)

Any help would be appreciated, thanks in advance.

edit retag flag offensive close merge delete