This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-DRA8X-TDA4X: TDA4 with TensorFlow

Part Number: PROCESSOR-SDK-DRA8X-TDA4X

Hi Champs:

#1. I'm experiencing the TDA4 with TIDL.

#2. In this file, there is a tensorFlow needs to be installed on the ubuntu 18 just in order to have this file: optimize_for_inference.py

#3. Please see the section below.

      My question is:

Which TensorFlow version we need to install?

And which Python version (2 or 3) needs to be choosed?

Please comment.

THanks,.

BR Rio

 

file:///opt/psdk_rtos_auto_j7_06_02_00_21_original/tidl_j7_01_01_00_10/ti_dl/docs/user_guide_html/md_tidl_user_model_deployment.html#setting-up-the-environment

Download the tarball containing the trained model from here..

You need to extract mobilenet_v2_1.0_224_frozen.pb from the tarball and put it inside ti_dl/test/testvecs/models/public/tensorflow/mobilenet_v2 directory.

The downloaded tensorflow models cannot be imported until they are optimized for inference. Run optimize_for_inference.py (distributed with tensorflow installation) to create an optimized model file.
user@ubuntu-pc$ python optimize_for_inference.py \
--input=${TIDL_INSTALL_PATH}/ti_dl/test/testvecs/models/public/tensorflow/mobilenet_v2/mobilenet_v2_1.0_224_frozen.pb \
--output=${TIDL_INSTALL_PATH}/ti_dl/test/testvecs/models/public/tensorflow/mobilenet_v2/mobilenet_v2_1.0_224_final.pb \
--input_names="input" \
--output_names="MobilenetV2/Predictions/Softmax"

  • * Tools Version used for freezing TF  inference graph
    - python 3.6.7

    - tensorflow 1.12.0

    - tensorflow/models repo commit id : 62ce5d2a4c39f8e3add4fae70cb0d19d195265c6

  • Hi Kumar:

    Where is the tensorflow path I need to set for placing it?

    BR Rio

  • I could not understand your question. Can you be more specific?

  • Hi Kumar:

    I mean, where is the path I need to install my tensorflow?

    Is this path ? ==>ti_dl/test/testvecs/models/public/tensorflow/

    If I want to re-train this model, should I install the TF in this path: -->ti_dl/test/testvecs/models/public/tensorflow/

    THanks.

    BR Rio

  • TIDL does not depend on your TensorFlow installation.

    You can install TensorFlow anywhere in your machine.

    After training the model. you need to specify the model file path in the TIDL import config file.

  • Hi Kumar:

    THanks.

    BTW, I don't have the GPU on my TI notebook.

    Can you give me a clear instruction command to install the TensrorFlow with Python3.7 for CPU-Only on Ubuntu 18.04?

    I ever install the TF before, but the TF needs to match the Bazel version.

    If using the PIP to install TF, then, I won't have this file: optimize_for_inference.py

    THanks.

    BR Rio

  • How to solve this issue?

    ps. I have used the Bazel build the TF 1.12rc successfuly.

    root@ubuntu-vm:/opt/tensorflow# python /opt/tensorflow/tensorflow/python/tools/optimize_for_inference.py --input=${TIDL_INSTALL_PATH}/ti_dl/test/testvecs/models/public/tensorflow/mobilenet_v2/mobilenet_v2_1.0_224_frozen.pb --output=${TIDL_INSTALL_PATH}/ti_dl/test/testvecs/models/public/tensorflow/mobilenet_v2/mobilenet_v2_1.0_224_final.pb --input_names="input" --output_names="MobilenetV2/Predictions/Softmax"
    Traceback (most recent call last):
    File "/opt/tensorflow/tensorflow/python/tools/optimize_for_inference.py", line 64, in <module>
    from tensorflow.core.framework import graph_pb2
    ModuleNotFoundError: No module named 'tensorflow'

  • This means Tensorflow is properly not installed in your machine.

    Please take help from Tensoflow community on this

  • Hi Kumar:

    May you help me to check if this optimize result log is correct or not?

    root@ubuntu-vm:/opt/psdk_rtos_auto_j7_06_02_00_21/tidl_j7_01_01_00_10/ti_dl/test/testvecs/models/public/tensorflow/mobilenet_v2# python /opt/tensorflow/tensorflow/python/tools/optimize_for_inference.py --input=${TIDL_INSTALL_PATH}/ti_dl/test/testvecs/models/public/tensorflow/mobilenet_v2/mobilenet_v2_1.0_224_frozen.pb --output=${TIDL_INSTALL_PATH}/ti_dl/test/testvecs/models/public/tensorflow/mobilenet_v2/mobilenet_v2_1.0_224_final.pb --input_names="input" --output_names="MobilenetV2/Predictions/Softmax"
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_1/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_2/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_3/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_4/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_5/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_6/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_7/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_8/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_9/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_10/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_11/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_12/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_13/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_14/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_15/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:Didn't find expected Conv2D input to 'MobilenetV2/expanded_conv_16/depthwise/BatchNorm/FusedBatchNorm'
    WARNING:tensorflow:From /opt/tensorflow/tensorflow/python/tools/optimize_for_inference.py:95: FastGFile.__init__ (from tensorflow.python.platform.gfile) is deprecated and will be removed in a future version.
    Instructions for updating:
    Use tf.gfile.GFile.

  • Yes, this looks fine