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.

TDA2PHV-ACD: TF Model Import Error

Part Number: TDA2PHV-ACD

Hello Friends,

    I tried to import a TF model using the tidl_model_import.out.exe.Please find the content of my config file given below:

# Default - 0
randParams = 0

# 0: Caffe, 1: TensorFlow, Default - 0
modelType = 1

# 0: Fixed quantization By tarininng Framework, 1: Dyanamic quantization by TIDL, Default - 1
quantizationStyle = 1

# quantRoundAdd/100 will be added while rounding to integer, Default - 50
quantRoundAdd = 50

numParamBits = 8

inputNetFile = "..\..\test\testvecs\config\tensorflow_models\deepbox\demo_model.data-00000-
of-00001.pb"
inputParamsFile = "NA"
outputNetFile = "..\..\test\testvecs\config\tidl_models\tidl_net_deepbox.bin"
outputParamsFile = "..\..\test\testvecs\config\tidl_models\tidl_param_deepbox.bin"

preProcType = 2
sampleInData = "..\..\test\testvecs\input\airshow.jpg"
tidlStatsTool = "..\quantStatsTool\eve_test_dl_algo.out.exe"

inWidth = 600
inHeight = 600
inNumChannels = 3
conv2dKernelType = 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0

I get the following error when I tried to import a pretrained TF model.

 I request you to assist me in rectifying the above error.

Best Regards,

Vijay

  • Hi Vijya,
    Did you follow the steps mentioned the below thread to import t atensorflow mdoels?

    e2e.ti.com/.../689876
  • Hello Kumar,
    I followed the steps given in the thread.I used the following command :

    python optimize_for_inference.py --input=D:\ADAS_Team\
    models\mobilenet_v2_1.4_224\mobilenet_v2_1.4_224\mobilenet_v2_1.4_224_frozen.pb
    --output=mobilenet_frozen_optimized_v2_1.4_224.pb --input_names=conv2d_1_input -
    -output_name=conv2d_5/BiasAdd

    But I got the following error:
    Traceback (most recent call last):
    File "optimize_for_inference.py", line 165, in <module>
    app.run(main=main, argv=[sys.argv[0]] + unparsed)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\lib\site-packages\
    tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
    File "optimize_for_inference.py", line 92, in main
    FLAGS.toco_compatible)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\lib\site-packages\
    tensorflow\python\tools\optimize_for_inference_lib.py", line 111, in optimize_fo
    r_inference
    placeholder_type_enum)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\lib\site-packages\
    tensorflow\python\tools\strip_unused_lib.py", line 83, in strip_unused
    raise KeyError("The following input nodes were not found: %s\n" % not_found)

    KeyError: "The following input nodes were not found: {'conv2d_1_input'}\n"

    Please assist me in solving this error.

    Best Regards,
    Vijay
  • Looks like your model is does not have a node named "conv2d_1_input". You can visualize your model using tensorboard or netron to find the input names.
  • Hello Kumar,
    I was able to visualize the input node name and output node name.I was able to generate the optimized frozen .pb file.But when I tried to use the TIDL translation tool(tidl_model_import.out.exe) I got the following error:

    Could not find the requested input Data : MobilenetV2/Conv/Relu6 !!

    I request you to assist me in solving this error.

    Best Regards,
    Vijay
  • Hello Kumar,

      I tried to convert a Tensorflow slim model(Mobilenet V2) to TIDL format.The TF model I am trying to covert can be downloaded from the following path:

    https://storage.googleapis.com/mobilenet_v2/checkpoints/mobilenet_v2_1.4_224.tgz

    The above directory contains mobilenet_v2_1.4_224_frozen.pb which I further optimize by the following command:

    python optimize_for_inference.py --input=D:\ADAS_Team\

    models\mobilenet_v2_1.4_224\mobilenet_v2_1.4_224\mobilenet_v2_1.4_224_frozen.pb

    --output=mobilenet_frozen_optimized_v2_1.4_224.pb --input_names=input -

    -output_name=MobilenetV2/Predictions/Reshape_1

    After executing the above command I get the optiimized frozen file mobilenet_frozen_optimized_v2_1.4_224.pb.

    I have used this file as an input for the TIDL model import tool(tidl_model_import.out.exe) to generate the parameter and network files.I have used the attached config file for TIDL translation.

    # Default - 0
    randParams         = 0 
    
    # 0: Caffe, 1: TensorFlow, Default - 0
    modelType          = 1
    
    # 0: Fixed quantization By tarininng Framework, 1: Dyanamic quantization by TIDL, Default - 1
    quantizationStyle  = 1 
    
    # quantRoundAdd/100 will be added while rounding to integer, Default - 50
    quantRoundAdd      = 50
    
    numParamBits       = 8
     
    inputNetFile       = "..\..\test\testvecs\config\tensorflow_models\mobilenet\mobilenet_frozen_optimized_v2_1.4_224.pb"
    inputParamsFile    = "NA"
    outputNetFile      = "..\..\test\testvecs\config\tidl_models\tidl_net_mobilenet_v2_1.0_224_optimized.bin"
    outputParamsFile   = "..\..\test\testvecs\config\tidl_models\tidl_param_mobilenet_v2_1.0_224_optimized.bin"
    
    preProcType  = 2
    sampleInData = "..\..\test\testvecs\input\airshow.jpg"
    tidlStatsTool = "..\quantStatsTool\eve_test_dl_algo.out.exe"
    
    inWidth  = 600
    inHeight = 600 
    inNumChannels = 3
    conv2dKernelType = 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0

    After running the TIDL model import tool with the attached config file,I get the following error:

    Could not find the requested input Data : MobilenetV2/Conv/Relu6 !!

    I request you to assist me in solving the error.

    Best Regards,

    Vijay

  • There is similar thread which resolved can check this?
    e2e.ti.com/.../794522
  • Hello Kumar,
    I was not able to revert back to TF version 1.1.When I tried to install TF 1.1 I got the following error:
    C:\Users\invkrish02>pip install tensorflow==1.1
    Collecting tensorflow==1.1
    Could not find a version that satisfies the requirement tensorflow==1.1 (from
    versions: 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0,
    1.4.0rc1, 1.4.0, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1
    .7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1,
    1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2,
    1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.2, 1.13.0rc0, 1.13.0rc1, 1
    .13.0rc2, 1.13.1, 2.0.0a0)
    No matching distribution found for tensorflow==1.1

    I guess version 1.1 is no longer available.Does the TIDL module work with higher versions of TF?

    I tried freezing the model using TF 1.11 and I got the following errors:

    Loaded meta graph file 'D:\ADAS_Team\models\mobilenet_v2_1.4_224\mobilenet_v2_1.
    4_224\mobilenet_v2_1.4_224.ckpt.meta
    2019-04-23 14:04:50.330434: I tensorflow/core/platform/cpu_feature_guard.cc:141]
    Your CPU supports instructions that this TensorFlow binary was not compiled to
    use: AVX AVX2
    2019-04-23 14:04:50.425443: I tensorflow/core/common_runtime/process_util.cc:69]
    Creating new thread pool with default inter op setting: 8. Tune using inter_op_
    parallelism_threads for best performance.
    Traceback (most recent call last):
    File "freeze_graph.py", line 492, in <module>
    run_main()
    File "freeze_graph.py", line 489, in run_main
    app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\envs\tf1.1_env\lib
    \site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
    File "freeze_graph.py", line 488, in <lambda>
    my_main = lambda unused_args: main(unused_args, flags)
    File "freeze_graph.py", line 382, in main
    flags.saved_model_tags, checkpoint_version)
    File "freeze_graph.py", line 364, in freeze_graph
    checkpoint_version=checkpoint_version)
    File "freeze_graph.py", line 155, in freeze_graph_with_def_protos
    input_meta_graph_def, clear_devices=True)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\envs\tf1.1_env\lib
    \site-packages\tensorflow\python\training\saver.py", line 1939, in import_meta_g
    raph
    **kwargs)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\envs\tf1.1_env\lib
    \site-packages\tensorflow\python\framework\meta_graph.py", line 744, in import_s
    coped_meta_graph
    producer_op_list=producer_op_list)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\envs\tf1.1_env\lib
    \site-packages\tensorflow\python\util\deprecation.py", line 454, in new_func
    return func(*args, **kwargs)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\envs\tf1.1_env\lib
    \site-packages\tensorflow\python\framework\importer.py", line 391, in import_gra
    ph_def
    _RemoveDefaultAttrs(op_dict, producer_op_list, graph_def)
    File "C:\Users\invkrish02\AppData\Local\Continuum\anaconda3\envs\tf1.1_env\lib
    \site-packages\tensorflow\python\framework\importer.py", line 158, in _RemoveDef
    aultAttrs
    op_def = op_dict[node.op]
    KeyError: 'InfeedEnqueueTuple'

    Best Regards,

    Vijay

  • (Followup Question): I noticed there is the need to use a specific version of tensorflow (1.1.0). Does it matter if tensorflow (CPU version) or tensorflow-gpu is used for freezing graph and optimization? Thank you in advance.
  • You can either use CPU or GPUversion