This is a tool for transforming a model trained with Keras into a Tensorflow Protocol Buffers (.pb). And optimize it for using it with the module Dnn of OpenCV.
I use your code to generate my own ".pb" file successfully.But when I use opencv.dnn to load it,it got an error!
my code:
model = 'result/optimized_tensorflow_model.pb'
net = cv2.dnn.readNetFromTensorflow(model)
and the error info:
cv2.error: OpenCV(3.4.2) /io/opencv/modules/dnn/src/tensorflow/tf_importer.cpp:532: error: (-2:Unspecified error) Const kernel input not found in function 'getConstBlob'