Forums - Faiiled Conversion of MobileNet SSD with SNPE 1.12.0

16 posts / 0 new
Last post
Faiiled Conversion of MobileNet SSD with SNPE 1.12.0
Rex
Join Date: 8 Aug 15
Posts: 45
Posted: Wed, 2018-02-14 12:52

Hi,

Got the new SNPE version 1.12.0 to try out the MobileNet SSD support.

snpe-tensorflow-to-dlc --graph ssd_mobilenet_v1_android_export.pb -i image_tensor 300,300,3 --model_version 1_12_0 --in_type image --dlc
ssd_mobilenet_v1_android_export.dlc --verbose --out_node detection_boxes --out_node detection_scores --out_node detection_classes --out_n
ode num_detections

Seems like non of the layers are recognized :

2018-02-14 10:56:55,314 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(Postprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_2/range/start) [Const])
2018-02-14 10:56:55,314 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(Postprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_2/range/delta) [Const])
2018-02-14 10:56:55,314 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(Postprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_4/range)
2018-02-14 10:56:55,314 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(Postprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_4/range/start) [Const])
2018-02-14 10:56:55,314 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(Postprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_4/range/delta) [Const])
2018-02-14 10:56:55,314 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(num_detections)
2018-02-14 10:56:55,314 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(num_detections) [Identity])
2018-02-14 10:56:55,314 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(add_6)
2018-02-14 10:56:55,314 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(add_6/y) [Const])
2018-02-14 10:56:55,314 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(add_6) [Add])
2018-02-14 10:56:55,314 - 104 - DEBUG - DEBUG_TF_SCOPE_PRINT: Scope(detection_classes)
2018-02-14 10:56:55,314 - 106 - DEBUG - DEBUG_TF_OP_NAME_TYPE_PRINT:     Operation(detection_classes) [Identity])
2018-02-14 10:56:57.777012: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6682] has already been set.
2018-02-14 10:56:57.777016: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6664] has already been set.
2018-02-14 10:56:57.777107: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6685] has already been set.
2018-02-14 10:56:57.777107: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6668] has already been set.
2018-02-14 10:56:57.777139: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6667] has already been set.
2018-02-14 10:56:57.777142: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6665] has already been set.
2018-02-14 10:56:57.777031: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6666] has already been set.
2018-02-14 10:56:57.777591: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6683] has already been set.
2018-02-14 10:56:57.778083: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6670] has already been set.
2018-02-14 10:56:57.778110: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6669] has already been set.
2018-02-14 10:56:57.977223: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[658] has already been set.
2018-02-14 10:56:57.977367: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[613] has already been set.
2018-02-14 10:56:57.977407: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6509] has already been set.
2018-02-14 10:56:57.977428: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6513] has already been set.
2018-02-14 10:56:57.977545: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6515] has already been set.
2018-02-14 10:56:57.977547: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6511] has already been set.
2018-02-14 10:56:57.977603: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6500] has already been set.
2018-02-14 10:56:57.977629: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6503] has already been set.
2018-02-14 10:56:57.977650: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6506] has already been set.
2018-02-14 10:56:57.977671: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6501] has already been set.
2018-02-14 10:56:57.977693: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6507] has already been set.
2018-02-14 10:56:57.977727: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[617] has already been set.
2018-02-14 10:56:57.977752: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[616] has already been set.
2018-02-14 10:56:57.977773: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[614] has already been set.
2018-02-14 10:56:57.977793: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[615] has already been set.
2018-02-14 10:56:57.977868: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[6504] has already been set.
2018-02-14 10:56:57.993109: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[618] has already been set.
2018-02-14 10:56:57.993159: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[619] has already been set.
2018-02-14 10:56:57.993224: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[624] has already been set.
2018-02-14 10:56:57.993240: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[625] has already been set.
2018-02-14 10:56:57.993324: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[620] has already been set.
2018-02-14 10:56:57.993340: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[621] has already been set.
2018-02-14 10:56:57.993444: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[622] has already been set.
2018-02-14 10:56:57.993460: W tensorflow/core/framework/op_kernel.cc:1198] Internal: Retval[623] has already been set.
2018-02-14 10:56:58,001 - 391 - WARNING - ERROR_TF_FALLBACK_TO_ONDEMAND_EVALUATION: Unable to resolve operation output shapes in single pass. Using on-demand evaluation!
2018-02-14 10:56:58,008 - 301 - INFO - INFO_ALL_BUILDING_NETWORK:
==============================================================
Building Network
==============================================================
2018-02-14 10:56:58,009 - 326 - INFO - INFO_TF_BUILDING_INPUT_LAYER: Building layer (INPUT) with node: image_tensor, shape [300, 300, 3]
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_47/Maximum_2) not consumed by converter: Maximum.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan_20/Gather/Gather_1) not consumed by converter: Gather.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_5/Area/sub_1) not consumed by converter: Sub.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_68/Area/mul) not consumed by converter: Mul.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/Gather_9/Gather_1) not consumed by converter: Gather.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_68/Area/Squeeze) not consumed by converter: Squeeze.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_67/Maximum_2) not consumed by converter: Maximum.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/Reshape_52) not consumed by converter: Reshape.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_68/Greater) not consumed by converter: Greater.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/TensorArrayReadV3_3) not consumed by converter: TensorArrayReadV3.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_59/Maximum_2) not consumed by converter: Maximum.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_68/Where) not consumed by converter: Where.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_44/Where) not consumed by converter: Where.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/stack_86) not consumed by converter: Pack.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_5/Reshape) not consumed by converter: Reshape.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_80/Gather/Gather) not consumed by converter: Gather.
2018-02-14 10:57:17,838 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_5/Cast) not consumed by converter: Cast.
2018-02-14 10:57:17,839 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/ClipToWindow_5/Gather/Gather) not consumed by converter: Gather.
2018-02-14 10:57:17,839 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/Shape_7) not consumed by converter: Shape.
... CUT THOUSANDS MORE LINES ...

Thanks in advance for any replies.

Rex

  • Up0
  • Down0
349074299
Join Date: 13 Sep 17
Posts: 8
Posted: Thu, 2018-02-22 23:47

i meet this issue too , if you solved this problem ,please hlep me!

  • Up0
  • Down0
jesliger
Join Date: 6 Aug 13
Posts: 75
Posted: Fri, 2018-03-02 04:39

Sorry for the delay.  There are instructions for MobilenetSSD in the users guide, in the "MobilenetSSD" chapter under "Model Conversion".  Are you following those instructions exactly?  They tell you which exact version of the model SNPE supports, and how to convert it.  Please verify.

Which version of Tensorflow are you using?

If you get this to convert, then you need to also enable CPU Fallback if you try to run it on the GPU.  Some of the layers are not supported on the GPU.

 

 

  • Up0
  • Down0
Rex
Join Date: 8 Aug 15
Posts: 45
Posted: Fri, 2018-03-02 08:32

Hi jesliger,

Thanks for the reply. I tried the instructions you noted which are under the Examples Tutorials -> Model Conversion -> MobilenetSSD and they work as you stated. I will see how we can adapt our network to be compatible with this one.

Thanks again.

Rex

  • Up0
  • Down0
Rex
Join Date: 8 Aug 15
Posts: 45
Posted: Mon, 2018-03-05 10:03

Hi,

Using the documented conversion and coco_ssd model - we only get the detection_classes and no boxes or scores using the documented conversion parameters.

conversion command -

snpe-tensorflow-to-dlc --graph ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb -i Preprocessor/sub 300,300,3 --out_node detection_classes --out_node detection_boxes --out_node detection_scores --dlc mobilenet_ssd.dlc --allow_unconsumed_nodes

 

application output -

SNPE NeuralNetwork.Runtime CPU=true GPU=true DSP=false
SNPE NeuralNetwork.model = /storage/emulated/0/amazon/data/scenedetector/ssd_mobilenet_v1-model.dlc
SNPE Model=ssd_mobilenet_v1 AvailableRuntimes=[GPU, CPU] Runtime=GPU InputNames=[Preprocessor/sub:0] InputShape=Preprocessor/sub:0[300, 300, 3] OutputLayers=[add_6]

 

dlc-info output -

| 157 | Postprocessor/Tile:0 | constant | Postprocessor/Tile:0 | Postprocessor/Tile:0 | 1x1917x4

| 158 | Postprocessor/Reshape_2:0 | box decoder | Postprocessor/Reshape_1:0 | Postprocessor/Reshape_2:0 | 1x1917x4
| 159 | Postprocessor/BatchMultiClassNonMaxSuppression | multi class nms | Postprocessor/Reshape_2:0      | Postprocessor/BatchMultiClassNonMaxSuppression_boxes | 1x100x4
|     |                                                |                 | Postprocessor/convert_scores:0 | Postprocessor/BatchMultiClassNonMaxSuppression_scores | 1x1x100
|     |                                                |                 |                                | Postprocessor/BatchMultiClassNonMaxSuppression_classes | 1x1x100
| 160 | add_6/y:0                                      | constant        | add_6/y:0                      | add_6/y:0 | 1x1x100
| 161 | add_6     | elementwise_sum | Postprocessor/BatchMultiClassNonMaxSuppression_classes              | detection_classes:0 | 1x1x100
 
Is it possible that the output names need to be BatchMultiClassNonMaxSuppression_classes? I tried this and the converter died trying to use this  output name.
 
What is the correct out_nodes values to get all the outputs?
 
Thanks.
 
Rex
  • Up0
  • Down0
jesliger
Join Date: 6 Aug 13
Posts: 75
Posted: Mon, 2018-03-05 10:56

You have to specify the output layers at runtime as well.  Append them to the list that you provide the builder in the call to setOutputLayers.  

You need to specify both Postprocessor/BatchMultiClassNonMaxSuppression and add_6 as output layers in the SNPE Builder setup otherwise only the last layer in the DLC will be in the output by default.
 
If using snpe-net-run, add the following to the first line of the input_lists.txt
 
#Postprocessor/BatchMultiClassNonMaxSuppression add
 

SNPE 1.13.0 has a bit of improved documentation on the output layers and output buffer names.

 

 

  • Up0
  • Down0
Rex
Join Date: 8 Aug 15
Posts: 45
Posted: Mon, 2018-03-05 14:13

Hi,

Thanks for the reply. As you suggested, adding all the required outputs in setOutputLayers(..) makes the other outputs available.

One side-effect here is that we have two "detection_classes" in the output buffers -

  1. detection_classes
  2. Postprocessor/BatchMultiClassNonMaxSuppression_scores
  3. Postprocessor/BatchMultiClassNonMaxSuppression_classes
  4. Postprocessor/BatchMultiClassNonMaxSuppression_boxes

detection_classes seems more accurate than the other PostProcessor/...._classes - can you explain the differences between these outputs?

Thanks.

Rex

 

     

    • Up0
    • Down0
    dmarques
    Join Date: 15 Sep 17
    Posts: 27
    Posted: Tue, 2018-03-06 06:03

    The tensorflow model shifts the classification by 1 as the index 0 is background.

    For the classes you should use detection_classes only since it is the correct value shifted in order to match the labels file.

    • Up0
    • Down0
    Rex
    Join Date: 8 Aug 15
    Posts: 45
    Posted: Tue, 2018-03-06 14:50

    Hi dmarques,

    Thanks for the insight. We had taken these shift factors into account. 

    So we ran a testing set and below I have linked an example of the problem.

    Reference Image -

    https://drive.google.com/file/d/1PM38uim6uIClnvqf7c5T7Z89lFDCEjQF/view?u...

    Tensorflow CPU on Android using SNPE COCO v1 model -

    https://drive.google.com/file/d/1vPnc0_9BJzjtT-4ij28Gp9yTgCQ1LibT/view?u...

    SNPE GPU with CPU fallback on Android using SNPE COCO v1 model -

    https://drive.google.com/file/d/1a3Zb8KrSdhDjZwYex0vwK6bkFfO-E-8S/view?u...

    It is clear that SNPE is not giving the same results as Tensorflow so there must be a discrepancy in the way the model is handled or the way we handle the output. Any ideas are welcome.

    Thanks in advance for any replies.

    Rex

    • Up0
    • Down0
    xavier12358
    Join Date: 11 Dec 16
    Posts: 20
    Posted: Sun, 2018-03-11 15:00

    Hello Rex,

    I use the Conversion example of SSD model in the documentation. When I run the command to convert the pb model into dlc model I get that:

     

    ../../bin/x86_64-linux-clang/snpe-tensorflow-to-dlc  --graph ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb -i Preprocessor/sub 300,300,3 --out_node detection_classes --out_node detection_boxes --out_node detection_scores --dlc mobilenet_ssd.dlc --allow_unconsumed_nodes
     
    2018-03-11 22:49:34.265702: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
    2018-03-11 22:49:37.507298: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[604] has already been set.
    2018-03-11 22:49:37.507369: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[561] has already been set.
    2018-03-11 22:49:37.507390: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6532] has already been set.
    2018-03-11 22:49:37.507406: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6535] has already been set.
    2018-03-11 22:49:37.507471: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6538] has already been set.
    2018-03-11 22:49:37.507524: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6539] has already been set.
    2018-03-11 22:49:37.507574: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6543] has already been set.
    2018-03-11 22:49:37.507624: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6545] has already been set.
    2018-03-11 22:49:37.507674: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6533] has already been set.
    2018-03-11 22:49:37.507723: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6541] has already been set.
    2018-03-11 22:49:37.507772: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[6536] has already been set.
    2018-03-11 22:49:37.507827: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[565] has already been set.
    2018-03-11 22:49:37.507879: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[564] has already been set.
    2018-03-11 22:49:37.507934: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[562] has already been set.
    2018-03-11 22:49:37.507987: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[563] has already been set.
    2018-03-11 22:49:37.519243: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[569] has already been set.
    2018-03-11 22:49:37.519282: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[568] has already been set.
    2018-03-11 22:49:37.519425: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[571] has already been set.
    2018-03-11 22:49:37.519440: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[570] has already been set.
    2018-03-11 22:49:37.519639: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[567] has already been set.
    2018-03-11 22:49:37.519669: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[566] has already been set.
    2018-03-11 22:49:37,527 - 391 - WARNING - ERROR_TF_FALLBACK_TO_ONDEMAND_EVALUATION: Unable to resolve operation output shapes in single pass. Using on-demand evaluation!

    Do you succeed generate the model into dlc file?

    For me it seems the models has been generated but when I use it, it generated detection_classes:0.raw files for each image but all the files are the sames.

     

    • Up0
    • Down0
    liuxz6271
    Join Date: 24 May 16
    Posts: 5
    Posted: Tue, 2018-03-27 03:36

    Hi Rex,

       when run mobilenetssd, how to get  “FloatBuffer meanImage”

    Thanks

     

    • Up0
    • Down0
    johnzou
    Join Date: 29 Jun 16
    Posts: 1
    Posted: Thu, 2018-03-29 01:22

    "Postprocessor/BatchMultiClassNonMaxSuppression_boxes"    Is the output  Ymin, Xmin, Ymax, Ymin?  I use this order, but the results are not right.   I followed the tutorial and used tensorflow 1.5 to transform the model.

    • Up0
    • Down0
    Coolwin
    Join Date: 16 Mar 18
    Posts: 3
    Posted: Mon, 2018-04-02 05:37

    hello jesliger! 

    I followed the instructions for MobilenetSSD in the users guide, in the "MobilenetSSD" chapter under "Model Conversion", to train and convert my model, but I always got the errors as bellow. and I try to open --allow unconsumed nodes, it converted success,  but seems none nodes consumed at all, my tensorflow version:1.5.0, SNPE version:1.13.0.

    ...

    2018-04-02 16:42:00,288 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_1_pointwise/BatchNorm/batchnorm/mul) not consumed by converter: Mul.
    2018-04-02 16:42:00,288 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_5_depthwise/BatchNorm/batchnorm/add_1) not consumed by converter: Add.
    2018-04-02 16:42:00,288 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_13_depthwise/BatchNorm/batchnorm/mul_1) not consumed by converter: Mul.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (BoxPredictor_1/BoxEncodingPredictor/BiasAdd) not consumed by converter: BiasAdd.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (MultipleGridAnchorGenerator/Meshgrid/ExpandedShape_1/ones) not consumed by converter: Fill.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (MultipleGridAnchorGenerator/Meshgrid_10/Reshape) not consumed by converter: Reshape.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (MultipleGridAnchorGenerator/Meshgrid_7/ExpandedShape_1/concat) not consumed by converter: ConcatV2.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (MultipleGridAnchorGenerator/Meshgrid_5/ExpandedShape/Reshape) not consumed by converter: Reshape.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (MultipleGridAnchorGenerator/Meshgrid_6/ExpandedShape_1/Slice_1) not consumed by converter: Slice.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (MultipleGridAnchorGenerator/div_4) not consumed by converter: RealDiv.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/Relu6) not consumed by converter: Relu6.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (MultipleGridAnchorGenerator/mul_28) not consumed by converter: Mul.
    2018-04-02 16:42:00,289 - 364 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Operation (MultipleGridAnchorGenerator/Reshape_2) not consumed by converter: Reshape.

    ...

    2018-04-02 16:42:00,289 - 123 - ERROR - Conversion failed: ERROR_TF_OPERATION_NOT_MAPPED_TO_LAYER: Some operations in the Tensorflow graph were not resolved to a layer. You can use --allow_unconsumed_nodes for partial graph resolution!

     

     

     

     

     

    • Up0
    • Down0
    sanjay.1987saini
    Join Date: 6 Aug 19
    Posts: 6
    Posted: Sun, 2019-09-15 09:42

    Hi Rex,

    May i know how you visualize the detected boxes on images using .dlc file. Any script you wrote??

    • Up0
    • Down0
    csiitism
    Join Date: 31 Oct 19
    Posts: 6
    Posted: Mon, 2019-11-04 21:50

    #Keras_Retinanet

    Brief of the problem: While trying to convert the model to DLC I am getting issues with respect to output nodes, I am able to convert keras model (.H5 file) to tensorflow model (.pb) but failing to get out the DLC file

     

    For I am getting following listed error in the final step of conversion:

    2019-11-04 14:36:18,000 - 175 - WARNING - Option: '--dlc' is DEPRECATED and will be removed in upcoming release. Please use '--output_path', '-o'

    2019-11-04 14:36:18,000 - 175 - WARNING - Option: '--graph' is DEPRECATED and will be removed in upcoming release. Please use '--input_path', '-i'

    2019-11-04 14:36:18.001569: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

    2019-11-04 14:36:25.114553: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1522] has already been set.

    2019-11-04 14:36:25.114674: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1528] has already been set.

    2019-11-04 14:36:25.114742: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1527] has already been set.

    2019-11-04 14:36:25.114823: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1523] has already been set.

    2019-11-04 14:36:25.114886: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1524] has already been set.

    2019-11-04 14:36:25.114990: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1553] has already been set.

    2019-11-04 14:36:25.115067: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1550] has already been set.

    2019-11-04 14:36:25.115145: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1556] has already been set.

    2019-11-04 14:36:25.179434: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1551] has already been set.

    2019-11-04 14:36:25.675460: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1554] has already been set.

    2019-11-04 14:36:25.676226: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1530] has already been set.

    2019-11-04 14:36:25.676299: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at function_ops.cc:80 : Internal: Retval[1529] has already been set.

    2019-11-04 14:36:25,681 - 411 - WARNING - ERROR_TF_FALLBACK_TO_ONDEMAND_EVALUATION: Unable to resolve operation output shapes in single pass. Using on-demand evaluation!

    2019-11-04 14:36:25,799 - 170 - INFO - INFO_ALL_BUILDING_NETWORK:

    ==============================================================

    Building Network

    ==============================================================

    2019-11-04 14:36:25,799 - 170 - INFO - INFO_TF_BUILDING_INPUT_LAYER: Building layer (INPUT) with node: input_1_2, shape [1, 224, 224, 3]

    2019-11-04 14:37:23,803 - 165 - ERROR - Conversion failed: Cannot find bboxes or scores

       Configuration for training model:

    ------------------------------------------------------

    Keras: 2.2.4

    Tensorflow 1.19.0

    Python 3.6

    :::output format : .H5

     

    Configuration for .h5 to .pb (keras to tensorflow) :

    ----------------------------------------------------------------------

    Keras: 2.2.4

    Tensorflow: 1.16.0

    Python: 2.7

    <H5 to PB was Successfully converted>

     

    Configuration for .pb to .dlc :

    -------------------------------------------

    Command for conversion:

    snpe-tensorflow-to-dlc --graph /home/chandan/Documents/snpe/models/out_model1.pb --input_dim input_1 1,224,224,3 --out_node filtered_detections/map/TensorArrayStack/TensorArrayGatherV3 --out_node filtered_detections/map/TensorArrayStack_1/TensorArrayGatherV3 --out_node filtered_detections/map/TensorArrayStack_2/TensorArrayGatherV3 --dlc /home/chandan/Documents/snpe/models/out_model1.dlc --allow_unconsumed_nodes

    Using SNPE: Snapdragon Neural Processing Engine SDK

    SNPE. snpe-1.31.0.522

    Python: 2.7

    Tensorflow: 1.16.0

    Keras: 2.2.4

    <We get the error as listed above > - > ERROR - Conversion failed: Cannot find bboxes or scores

     

    Problem 2: Can you please help me to get input shape, i am using default (1,224,224,3), 

     

    I can share you the architecture and weight file also,

    please help!

     

     

    • Up0
    • Down0
    gesqdn-forum
    Join Date: 4 Nov 18
    Posts: 184
    Posted: Mon, 2020-06-29 00:49
    Hello sanjay.1987saini,
     
    Once you convert your model to dlc, you can run use snpe-net-run to run the model. A raw file will be generated, and you can read the data using numpy as following:
     
    $ python3.5
    >>import numpy as np
    >>res = np.fromfile('detection_out.raw', dtype="float32")
    >>print(res)
    [[0.,         6.,         0.99923944, 0.05772871 0.1193189,  0.9643268, 0.8045521 ]]
     
    In this case, res[0, 1] is the ID for the label,
          res[0, 2] is the probability for predicted object
              res[0, 3:7] are scaled X1, Y1, X2, Y2 values respectively
    For re-scaling, it Multiply X1 & X2 with Width of image & Y1 & Y2 with the Height of the image and cast it to the Integer.
    This gives the bounding box for the object predicted.
     
    • Up0
    • Down0
    or Register

    Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.