frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

What are the steps to migrate my TF trained model to the NCSv1?

Comments

  • 14 Comments sorted by Votes Date Added
  • What is going on my post is just blank and it quite big why i dont see my post?

  • My post are showing blank, no idea why so ill do multicomments:

    I know people have asked this already but i dont seem to find the real steps as everybody goes in a different way or i dont understart A.I good enough :sweat_smile:

    So i used tensorflow 1.9 to train my model, i am using the train.py (legacy) and also tried with model_main.py (new script) both located in the .../research/object_detection folder from Tensorflow.
    When training finishes a frozen graph is generated but i dont understand why that one doesnt work.
    I am using SSD_inceptionV2_coco latest release on tf github. The trained model works great using just tensorflow code but if i tried to get the GRAPH file for the NCS it fails everytime, i am just not able to find the input and output nodes that work properly, there is alot on the internet to get those but i dont think i am doing it write.

    I followed this guide: https://movidius.github.io/ncsdk/tf_modelzoo.html
    But it seems it works only for the models in ncappzoo, i tried the commands in the site and worked fine. so i could get the GRAPH file. my ssd_inceptionv2_coco failed :(
    So i check this link:

    https://movidius.github.io/ncsdk/tf_slim.html

    But the code dont seem to work with the model.ckpt-200000

  • This is my code:
    ----------------------------------------------------------------------CODE----------------------------------------------------------------------------------------------------------------------------
    import numpy as np
    import tensorflow as tf

    from tensorflow.contrib.slim.nets import inception

    slim = tf.contrib.slim

    def run(name, image_size, num_classes):
    with tf.Graph().as_default():
    image = tf.placeholder("float", [1, image_size, image_size, 3], name="input")
    with slim.arg_scope(inception.inception_v1_arg_scope()):
    logits, _ = inception.inception_v1(image, num_classes, is_training=False, spatial_squeeze=False)
    probabilities = tf.nn.softmax(logits)
    init_fn = slim.assign_from_checkpoint_fn('model.ckpt-200000', slim.get_model_variables('InceptionV2'))

    with tf.Session() as sess:
        init_fn(sess)
        saver = tf.train.Saver(tf.global_variables())
        saver.save(sess, "output/"+name)
    

    run('inception-v2', 299, 2)

    I just dont know what to use for model variables, InceptionV2 gets me
    --------------------------------------------------------------------OUTPUT1----------------------------------------------------------------------------------------------------------------

  • -------------------------------------------------------------------OUTPUT1----------------------------------------------------------------------------------------------------------------
    Traceback (most recent call last):
    File "tf_slim_export.py", line 21, in
    run('inception-v2', 299, 2)
    File "tf_slim_export.py", line 14, in run
    init_fn = slim.assign_from_checkpoint_fn('model.ckpt-200000', slim.get_model_variables('InceptionV2'))
    File "/home/chop/.local/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.py", line 678, in assign_from_checkpoint_fn
    raise ValueError('var_list cannot be empty')
    ValueError: var_list cannot be empty

  • ---------------------------------------------------------------------OUTPUT2---------------------------------------------------------------------------------------------------------------
    i tried InceptionV1 and worked a bit better but i know that is not the option for sure:

    2019-01-05 04:41:01.150820: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
    2019-01-05 04:41:01.220727: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:897] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    2019-01-05 04:41:01.221057: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 0 with properties:
    name: GeForce GTX 970 major: 5 minor: 2 memoryClockRate(GHz): 1.342
    pciBusID: 0000:01:00.0
    totalMemory: 3.94GiB freeMemory: 3.40GiB
    2019-01-05 04:41:01.221070: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1471] Adding visible gpu devices: 0
    2019-01-05 04:41:01.398357: I tensorflow/core/common_runtime/gpu/gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
    2019-01-05 04:41:01.398383: I tensorflow/core/common_runtime/gpu/gpu_device.cc:958] 0
    2019-01-05 04:41:01.398388: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0: N
    2019-01-05 04:41:01.398500: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3121 MB memory) -> physical GPU (device: 0, name: GeForce GTX 970, pci bus id: 0000:01:00.0, compute capability: 5.2)

  • i just cant post the output what is going on? moderators please check this!

  • So what am i missing? do i need to move to OpenVino? in order for this to work?
    Do i need to train my model with tf_slim as mandatory step for NCSv1?
    What am i missing? i have been using pretrained models with the NCSv1 and it work great for my security cameras, now i want to automate my house but i need a custom model but i just cant make it work with NCS. using a desktop is just to much resources for a smarthouse and alot of power and money as i might need the Nvidia card. So please allow me to keep playing with this device. love it.

  • If you came for answers, stop using the NCSDK and switch to OpenVINO.
    After that i was able to use the mo_tf.py and test it on one of the samples with my NCSv1 using the web documentation, is way better than NCS docs and very well done same as the OpenVINO SDK.

Sign In or Register to comment.