TOCO failed Batch normalization resolution requires that mean, multiplier and offset arrays be constant.

I'm using tensorflow and have created a custom model. The training process is ok, but when I want to freeze the graph and convert it into tflite, I'm getting this error:

TOCO failed Batch normalization resolution requires that mean, multiplier and offset arrays be constant.

I can freeze the graph separately, but I can't convert it to tflite. Here is the code of freezing the graph.

g = tf.get_default_graph() 
graph_def = g.as_graph_def() 
tf.train.write_graph(graph_def, "./model", 'graph.pb', as_text=False) 
saver = tf.train.Saver() 
saver.save(sess, os.path.join(FLAGS.checkpoint_dir, 'model.ckpt'))
tensorflowtflite
4 votesLP185.00
1 Answers
JW229.00
3

I think you are trying to convert a training graph.

If you've got BatchNormalization or Dropout, you've got to have a training placeholder for them (cause you need to separate traing and test stages for not learnable parameters).

Just try to save your graph putting that placeholder with false value. It will be something like this

is_training = tf.placeholder(tf.bool, name = 'is_training')
# ...
# building a model
# then for test version put a false value for it
is_training = False
# ...
# saving the model
Reply
Couldn't find what you were looking for?and we will find an expert to answer.
How helpful was this page?