Forums - How to convert yolov4.onnx to DLC file on SNPE

3 posts / 0 new
Last post
How to convert yolov4.onnx to DLC file on SNPE
hironobu.kobayashi
Join Date: 24 Feb 21
Posts: 2
Posted: Wed, 2021-04-21 01:16

Hi, I'm trying to convert yolov4.onnx to dlc file. 

first, I got yolov4.onnx from Github.

https://github.com/onnx/models/tree/master/vision/object_detection_segme...

second, I am trying to covert this ONNX file to DLC file using this command :

snpe-onnx-to-dlc --input_network yolov4.onnx --output_path yolov4.dlc

I am getting following error:

Encountered Error: Negative/placeholder dimensions is not supported.Expected shape: [0, 416, 416, 3] > 0
Note: Dynamic input batch_size not supported. Use --input_dim command to provide a static batch value
 
Stack Trace:
Traceback (most recent call last):
  File "/mnt/snpe-sdk/bin/x 86_64-linux-clang/snpe-onnx-to-dlc", line 41, in <module>
    graph = converter.convert()
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/onnx/onnx_to_ir.py", line 115, in convert
    onnx_translations.OnnxTranslationBase.ADD_INPUT, value_info, self.graph)
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 51, in apply_method_to_op
    return translation.apply_method(method_name, *args, **kwargs)
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 17, in apply_method
    return self.indexed_methods[method_name](*args, **kwargs)
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/onnx/onnx_translations.py", line 245, in add_input
    'Use --input_dim command to provide a static batch value'.format(shape))
RuntimeError: Negative/placeholder dimensions is not supported.Expected shape: [0, 416, 416, 3] > 0
Note: Dynamic input batch_size not supported. Use --input_dim command to provide a static batch value
 
How can I convert YOLO to DLC files?
 
Any help will be appreciated.
 
Thanks.
 
  • Up0
  • Down0
shasha3493
Join Date: 31 Mar 21
Posts: 1
Posted: Mon, 2021-04-26 08:07

snpe-onnx-to-dlc --input_network yolov4.onnx --output_path yolov4.dlc --input_dim "input" 1,416,416,3

where input is the input_buffer_name in the exported ONNX graph

  • Up0
  • Down0
hironobu.kobayashi
Join Date: 24 Feb 21
Posts: 2
Posted: Wed, 2021-05-12 01:48

Thank you for your reply.

snpe-onnx-to-dlc --input_network yolov4.onnx --output_path yolov4.dlc --input_dim input_1:0 1,416,416,3

I tried this command, but an error occurred.

2021-05-12 08:35:06,786 - 177 - INFO - INFO_STATIC_RESHAPE: Applying static reshape to Reshape__1345:0: new name Transpose__1378:0 new shape [1, 1, 1, 1]

2021-05-12 08:35:06,786 - 182 - WARNING - WARNING_BROADCAST_ADD: Dynamic broadcast Add operations is not supported, will attempt to interpret as a static bias-add operation
2021-05-12 08:35:06,795 - 182 - WARNING - WARNING_BROADCAST_ADD: Dynamic broadcast Add operations is not supported, will attempt to interpret as a static bias-add operation
Traceback (most recent call last):
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/common/utils/translation_utils.py", line 125, in get_broadcasted_shape
    output_shape = list(np.broadcast(*inputs).shape)
ValueError: shape mismatch: objects cannot be broadcast to a single shape
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/onnx/onnx_to_ir.py", line 157, in convert
    self.graph)
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 51, in apply_method_to_op
    return translation.apply_method(method_name, *args, **kwargs)
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/common/converter_ir/translation.py", line 17, in apply_method
    return self.indexed_methods[method_name](*args, **kwargs)
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/onnx/onnx_translations.py", line 200, in add_op
    broadcast_shape = translation_utils.get_broadcasted_shape(input_shapes)
  File "/mnt/snpe-sdk/lib/python/qti/aisw/converters/common/utils/translation_utils.py", line 127, in get_broadcasted_shape
    raise ValueError("Shape mismatch, {} cannot be broadcast to a single shape".format(input_shapes))
ValueError: Shape mismatch, [[1, 416, 416, 32], [1, 208, 208, 64]] cannot be broadcast to a single shape
2021-05-12 08:35:06,796 - 172 - ERROR - Node StatefulPartitionedCall/model/lambda_1/add: Shape mismatch, [[1, 416, 416, 32], [1, 208, 208, 64]] cannot be broadcast to a single shape
Can you suggest any solutions ?
Should I change the structure of yolov4?
 
Thank you.
 
  • 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.