Cannot load Tensorflow model with batch-normalization

asked 2018-09-07 06:32:39 -0500

Hello, i am trying to load my custom tensorflow model with help a dnn module of opencv. Step by step:

  1. I create a neural network
  2. I trained it
  3. I use freeze_graph.py
  4. After that I use optimize_for_inference.py
  5. And i use transform_graph.exe
  6. Load last model in opencv dnn

But when i did't use a

layer = tf.layers.batch_normalization(layer, training=True)

i didn't get a error from opencv:

cv2.error: OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:1388: error: (-213:The function/feature is not implemented) Cannot determine number of parameters for batch normalization layer. in function 'cv::dnn::experimental_dnn_v5::`anonymous-namespace'::TFImporter::populateNet'

If I set

"training = False"

then I don't get error but my model don't teach like early

edit retag flag offensive close merge delete