Issue with converting tensorflow model to Intel Movidius graph









up vote
0
down vote

favorite












Hello I faced with the problem when trying to use Intel Movidius Neural Stick with tensorflow. I have keras model and I convert it to tensorflow model. When I convert it to Movidius graph I got error:



Traceback (most recent call last):
File "/usr/local/bin/mvNCCompile", line 118, in
create_graph(args.network, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights)
File "/usr/local/bin/mvNCCompile", line 104, in create_graph
net = parse_tensor(args, myriad_config)
File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 290, in parse_tensor
if have_first_input(strip_tensor_id(node.outputs[0].name)):
IndexError: list index out of range


Here is my code:



from keras.models import model_from_json
from keras.models import load_model
from keras import backend as K
import tensorflow as tf
import nn
import os

weights_file = "weights.h5"

sess = K.get_session()
K.set_learning_phase(0)
model = nn.alexnet_model() # get keras model
model.load_weights(weights_file)

saver = tf.train.Saver()
saver.save(sess, "./TF_Model/tf_model") # convert keras to tensorflow model

tf_model_path = "./TF_Model/tf_model"

fw = tf.summary.FileWriter('logs', sess.graph)
fw.close()

os.system('mvNCCompile TF_Model/tf_model.meta -in=conv2d_1_input -on=activation_7/Softmax') # get Movidius graph


Python version: 2.7
OS: Ubuntu 16.04
Tensorflow version: 1.12










share|improve this question









New contributor




Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    0
    down vote

    favorite












    Hello I faced with the problem when trying to use Intel Movidius Neural Stick with tensorflow. I have keras model and I convert it to tensorflow model. When I convert it to Movidius graph I got error:



    Traceback (most recent call last):
    File "/usr/local/bin/mvNCCompile", line 118, in
    create_graph(args.network, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights)
    File "/usr/local/bin/mvNCCompile", line 104, in create_graph
    net = parse_tensor(args, myriad_config)
    File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 290, in parse_tensor
    if have_first_input(strip_tensor_id(node.outputs[0].name)):
    IndexError: list index out of range


    Here is my code:



    from keras.models import model_from_json
    from keras.models import load_model
    from keras import backend as K
    import tensorflow as tf
    import nn
    import os

    weights_file = "weights.h5"

    sess = K.get_session()
    K.set_learning_phase(0)
    model = nn.alexnet_model() # get keras model
    model.load_weights(weights_file)

    saver = tf.train.Saver()
    saver.save(sess, "./TF_Model/tf_model") # convert keras to tensorflow model

    tf_model_path = "./TF_Model/tf_model"

    fw = tf.summary.FileWriter('logs', sess.graph)
    fw.close()

    os.system('mvNCCompile TF_Model/tf_model.meta -in=conv2d_1_input -on=activation_7/Softmax') # get Movidius graph


    Python version: 2.7
    OS: Ubuntu 16.04
    Tensorflow version: 1.12










    share|improve this question









    New contributor




    Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Hello I faced with the problem when trying to use Intel Movidius Neural Stick with tensorflow. I have keras model and I convert it to tensorflow model. When I convert it to Movidius graph I got error:



      Traceback (most recent call last):
      File "/usr/local/bin/mvNCCompile", line 118, in
      create_graph(args.network, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights)
      File "/usr/local/bin/mvNCCompile", line 104, in create_graph
      net = parse_tensor(args, myriad_config)
      File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 290, in parse_tensor
      if have_first_input(strip_tensor_id(node.outputs[0].name)):
      IndexError: list index out of range


      Here is my code:



      from keras.models import model_from_json
      from keras.models import load_model
      from keras import backend as K
      import tensorflow as tf
      import nn
      import os

      weights_file = "weights.h5"

      sess = K.get_session()
      K.set_learning_phase(0)
      model = nn.alexnet_model() # get keras model
      model.load_weights(weights_file)

      saver = tf.train.Saver()
      saver.save(sess, "./TF_Model/tf_model") # convert keras to tensorflow model

      tf_model_path = "./TF_Model/tf_model"

      fw = tf.summary.FileWriter('logs', sess.graph)
      fw.close()

      os.system('mvNCCompile TF_Model/tf_model.meta -in=conv2d_1_input -on=activation_7/Softmax') # get Movidius graph


      Python version: 2.7
      OS: Ubuntu 16.04
      Tensorflow version: 1.12










      share|improve this question









      New contributor




      Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Hello I faced with the problem when trying to use Intel Movidius Neural Stick with tensorflow. I have keras model and I convert it to tensorflow model. When I convert it to Movidius graph I got error:



      Traceback (most recent call last):
      File "/usr/local/bin/mvNCCompile", line 118, in
      create_graph(args.network, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights)
      File "/usr/local/bin/mvNCCompile", line 104, in create_graph
      net = parse_tensor(args, myriad_config)
      File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 290, in parse_tensor
      if have_first_input(strip_tensor_id(node.outputs[0].name)):
      IndexError: list index out of range


      Here is my code:



      from keras.models import model_from_json
      from keras.models import load_model
      from keras import backend as K
      import tensorflow as tf
      import nn
      import os

      weights_file = "weights.h5"

      sess = K.get_session()
      K.set_learning_phase(0)
      model = nn.alexnet_model() # get keras model
      model.load_weights(weights_file)

      saver = tf.train.Saver()
      saver.save(sess, "./TF_Model/tf_model") # convert keras to tensorflow model

      tf_model_path = "./TF_Model/tf_model"

      fw = tf.summary.FileWriter('logs', sess.graph)
      fw.close()

      os.system('mvNCCompile TF_Model/tf_model.meta -in=conv2d_1_input -on=activation_7/Softmax') # get Movidius graph


      Python version: 2.7
      OS: Ubuntu 16.04
      Tensorflow version: 1.12







      python tensorflow machine-learning






      share|improve this question









      New contributor




      Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Nov 9 at 14:02









      desertnaut

      15.1k53161




      15.1k53161






      New contributor




      Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 9 at 13:34









      Evgenij Maksimychev

      1




      1




      New contributor




      Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Evgenij Maksimychev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          As I know, the ncsdk compiler does not resolve every part of a normal tensorflow network, so you have to modify the network and re-save it in an NCS-friendly way in order to successfully make a Movidius graph.



          For more information about how to modify tensorflow network, have a look at the official guidance.



          Hope it will help you.






          share|improve this answer




















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            Evgenij Maksimychev is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226702%2fissue-with-converting-tensorflow-model-to-intel-movidius-graph%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            As I know, the ncsdk compiler does not resolve every part of a normal tensorflow network, so you have to modify the network and re-save it in an NCS-friendly way in order to successfully make a Movidius graph.



            For more information about how to modify tensorflow network, have a look at the official guidance.



            Hope it will help you.






            share|improve this answer
























              up vote
              0
              down vote













              As I know, the ncsdk compiler does not resolve every part of a normal tensorflow network, so you have to modify the network and re-save it in an NCS-friendly way in order to successfully make a Movidius graph.



              For more information about how to modify tensorflow network, have a look at the official guidance.



              Hope it will help you.






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                As I know, the ncsdk compiler does not resolve every part of a normal tensorflow network, so you have to modify the network and re-save it in an NCS-friendly way in order to successfully make a Movidius graph.



                For more information about how to modify tensorflow network, have a look at the official guidance.



                Hope it will help you.






                share|improve this answer












                As I know, the ncsdk compiler does not resolve every part of a normal tensorflow network, so you have to modify the network and re-save it in an NCS-friendly way in order to successfully make a Movidius graph.



                For more information about how to modify tensorflow network, have a look at the official guidance.



                Hope it will help you.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 23 hours ago









                Ha Bom

                235




                235




















                    Evgenij Maksimychev is a new contributor. Be nice, and check out our Code of Conduct.









                     

                    draft saved


                    draft discarded


















                    Evgenij Maksimychev is a new contributor. Be nice, and check out our Code of Conduct.












                    Evgenij Maksimychev is a new contributor. Be nice, and check out our Code of Conduct.











                    Evgenij Maksimychev is a new contributor. Be nice, and check out our Code of Conduct.













                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226702%2fissue-with-converting-tensorflow-model-to-intel-movidius-graph%23new-answer', 'question_page');

                    );

                    Post as a guest














































































                    Popular posts from this blog

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Darth Vader #20

                    Ondo