Open 2h4dl opened 5 years ago
Hi @2h4dl, would you mind uploading the model so I can check it to solve the problem?
@rainLiuplus https://drive.google.com/file/d/1zizj49H0pdkWmEXshPaXI3qtUd7r3cbG/view?usp=sharing, plz check it.
Hi @2h4dl, I think the first attempt failed because of tf.cond
in the batch norm
. It might be using the tf.contrib.layers.batch_norm
.
Similar problems also happen when others try to import the frozen graph in here.
So, what is the difference when you resave the model? How big is it? I think it is probably because of the batchnorm
.
Hi @JiahaoYao. You mean tf.layers.batch_normalization as same as tf.contrib.layers.batch_norm? After resave model, some variables lost, model is smaller than before. How to use batch norm in tensorflow to avoid it?
Hi @2h4dl, if you resave the model and tf.cond
's are eliminated, it is possible for your model to be smaller due to the paremeters in tf.cond
. We have met with this kind of this before, as mentioned here. I think simply using tf.layer.batch_norm
is safe.
Hi @JiahaoYao. As you mentioned, after resave the model, tf.cond
is gone. But still have a question, sorry about that.
In this wiki, it says tf.cond
exists in slim
not tf.layer
.
But I trained this model with tf.layers.batch_normalization
, is there something wrong with my model code.
This is my code here:
weights = get_weights(w_shape, regualizer)
conv = conv2d(x_input, weights, padding)
norm = tf.layers.batch_normalization(conv, training=istrain)
conv_relu = activation(norm)
Hi @2h4dl , I have also met this problem, how did you fixed finally?
Platform (like ubuntu 16.04/win10):
ubuntu 16.04
Python version:python 2.7
Source framework with version (like Tensorflow 1.4.1 with GPU):Tensorflow 1.12
Destination framework with version (like CNTK 2.3 with GPU):caffe
Pre-trained model path (webpath or webdisk path):Running scripts:
Error Info:
It can be succeed if I restore this model and save again. But I got something difference in processing conversion. It seems model dropped some parameters.
Source model conversion:
Re-saved model conversion:
22 parameters dropped after re-save.