Forums - SNPE does not support half_pixel_centers param for Resize Layer

6 posts / 0 new
Last post
SNPE does not support half_pixel_centers param for Resize Layer
diwu
Join Date: 15 Nov 21
Posts: 7
Posted: Mon, 2021-11-22 02:20

when .onnx is converted into .dlc, the error was as follows:

ValueError: Conversion Error: SNPE does not support half_pixel_centers param for Resize Layer.

It occurs when saving .dlc in snpe-onnx-to-dlc , the node is "resize_1",the error log was as follows:

2021-11-22 17:45:31,811 - 188 - INFO - INFO_DLC_SAVE_LOCATION: Saving model at /home/wudi/project/RobustVideoMatting-onnx/my_model.dlc
Encountered Error: Conversion Error: SNPE does not support half_pixel_centers param for Resize Layer.
 
  • Up0
  • Down0
ruzhongl
Join Date: 7 Jun 21
Posts: 2
Posted: Mon, 2021-11-22 02:45
could you help do experiments?
 
1# change to  opset = 11  when export onnx. for example
 
torch.onnx.export(
 
 model,
(dummy_input_a,dummy_input_b),
'full.onnx',
verbose=True,
opset_version=11,
input_names=input_names,
output_names=output_names
)
 
#2 set align cornet = Ture when use Upsample, for example
 
self.upsample = nn.Upsample(scale_factor =2,mode = 'bilinear',align_corners=True)
 
 
 
#3 change snpe converter  to align CPU results with onnx results
 
snpe-1.51.0.2663\lib\python\qti\aisw\converters\onnx\data_translations.py
 
OnnxResizeTranslation:
 
if not scales and len(src_op.input) > 2:
size_name = str(src_op.input[-1])
if graph.weights.has(size_name):
scales = graph.weights.fetch(size_name).astype(numpy.float32).tolist()
else:
scales = graph.get_buffer(size_name).shape.tolist()
# Opset 11 has 4th parameter as output sizes,
# here we are calculating scales from output sizes
scales[-1] = scales[-1] / input_width
scales[-2] = scales[-2] / input_height
+ else:
+ sizes = [1,input_shape[1],int(input_height*scales[-2]),int(input_width*scales[-1])]
+ scales = [1.0,float(input_shape[1]),input_height*scales[-2],input_width*scales[-1]]
+ scales[-1] = (scales[-1]-1) / (input_width-1) if align_corners else (scales[-1] / input_width)
+ scales[-2] = (scales[-2]-1) / (input_height-1) if align_corners else (scales[-2] / input_width)
  • Up2
  • Down0
diwu
Join Date: 15 Nov 21
Posts: 7
Posted: Mon, 2021-11-22 18:26

My .onnx model has been converted into .dlc successfully following your suggestion.

Thanks

  • Up0
  • Down0
diwu
Join Date: 15 Nov 21
Posts: 7
Posted: Mon, 2021-11-22 18:26

My .onnx model has been converted into .dlc successfully following your suggestion.

Thanks

  • Up0
  • Down0
diwu
Join Date: 15 Nov 21
Posts: 7
Posted: Mon, 2021-11-22 18:27

My .onnx model has been converted into .dlc successfully following your suggestion.

Thanks

  • Up0
  • Down0
diwu
Join Date: 15 Nov 21
Posts: 7
Posted: Mon, 2021-11-22 18:28

My .onnx model has been transformed into .dlc successfully following your suggestion.

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.