I've seen a couple of posts on the exact error that I'm getting when using mvNCCompile:
[Error 5] Toolkit Error: Stage Details Not Supported: IsVariableInitialized
(On a side note, I have attempted the same compilation using an earlier version of the ncsdk and got the error message: [Error 34] Setup Error: Values for input contain placeholder. Pass an absolute value.)
I would like to know why the compilation fails in the former case, and how to fix it, if possible. In the latter case, I understand that the network must be modified to use absolute values, but as I am using a pregenerated network, I don't think this is possible.
To generate the error, install ncsdk with version v2.08.01.02. Create a new directory and cd into it. Copy the following into a script with any name:
#!/usr/bin/env python from keras import applications from keras import backend as K import tensorflow as tf def main(): input_shape = (512, 512, 3) model = application.mobilenet_v2.MobileNetV2( input_shape=input_shape, alpha=1.0, depth_multiplier=1, include_top=True, weights=None) model.summary() model.compile(optimizer='adam', metrics=['accuracy'], loss='categorical_crossentropy') K.set_learning_phase(0) saver = tf.train.Saver() sess = K.get_session() saver.save(sess, "./TF_Model/tf_model") fw = tf.summary.FileWriter("logs", sess.graph) fw.close() if __name__ == '__main__': main()
Then run it and check the files exist in TF_Model:
There should be tf_model.meta in the TF_Model folder. I've looked up the names I want, so run the following command:
mvNCCompile TF_Model/tf_model.meta -in input_1 -on Logits/Softmax
This will generate the error given above. I have read that the SDK supports BatchNormalization, so it's strange that the compilation fails. Moreover, I've determined the exact output node that fails:
# Compilation is successful mvNCCompile TF_Model/tf_model.meta -in input_1 -on bn_Conv1/moving_variance/read # Next operation set as output node fails to compile mvNCCompile TF_Model/tf_model.meta -in input_1 -on bn_Conv1/IsVariableInitialized
I am happy to provide any further details.