Forums - SNPE DLC output different from Caffe output

3 posts / 0 new
Last post
SNPE DLC output different from Caffe output
gino0
Join Date: 26 May 19
Posts: 12
Posted: Tue, 2019-07-09 23:47

I converted my Caffe model to .dlc using the conversion tool, then I run the .dlc on PC and on a Linux board (development kit with Snapdragon 626).  I used the x86_64-linux-clang/libSNPE on the PC and the arm-linux-gcc4.9sf/libSNPE on the Linux board.

I noticed that the output of the SNPE .dlc (both from PC and from the Linux board) are all different from the direct output from Caffe. The total data size is the same but the floating-point values are all off. 

  • From Caffe, the max/min is 1.013/-0.016 and results in correct classifications.
  • From SNPE (PC and board), the max/min is nan/nan, with most of the values approaching either positive inf or negative inf. Obviously this results in very incorrect classification results.
  •  

All other aspects are the same. The only difference between the output is that one is from Caffe and one is from SNPE. I am using SNPE 1.27.1.382. I am thinking that this is a SNPE issue because the direct Caffe output classification is correct.

I realize that it is quite difficult for anyone to debug this without sharing the model, but I would appreciate any ideas on which part to check.

 

  •  
  • Up0
  • Down0
jihoonk
Profile picture
Join Date: 28 Jan 13
Location: Seoul
Posts: 55
Posted: Wed, 2019-07-10 02:16

Hi gino0,

I guess it's caused from the input axis order difference between Caffe and SNPE. Caffe uses BCHW scheme while SNPE uses BHWC. Once you correct this, your output result would be okay.

Refer to following document.

https://developer.qualcomm.com/docs/snpe/image_input.html

Thanks,

jihoonk

  • Up0
  • Down0
gino0
Join Date: 26 May 19
Posts: 12
Posted: Thu, 2019-07-11 04:11

Thanks for the tip.

Yes, I think I got my axes wrong. I fixed the input raw image to SNPE to reshape to BxHxWxC, then I also made sure I am parsing the 1D output of SNPE also as BxHxWxC. 

The SNPE output is now back to non-infinity/NaN values.

  • 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.