Forums - failed to run snpe-sample on x86_64/ubuntu17.10

6 posts / 0 new
Last post
failed to run snpe-sample on x86_64/ubuntu17.10
yangfan34
Join Date: 6 Dec 17
Posts: 9
Posted: Fri, 2018-05-04 01:55

Hi guys,

I tried to run snpe-sample but failed with core dumped. I am a newbie and hope some suggestions from here.

cd $SNPE_ROOT/models/alexnet/data
$SNPE_ROOT/examples/NativeCpp/SampleCode/obj/local/x86_64-linux-clang/snpe-sample -b ITENSOR -d ../dlc/bvlc_alexnet.dlc -i target_raw_list.txt -o output
-------------------------------------------------------------------
SNPE Version: 1.14.1.0
Segmentation fault (core dumped)
 
This is my directory architecture and steps to prepare inputs,
 
  ├──snpe
   │   ├── caffe                    (git clone https://github.com/BVLC/caffe.git)
   │   ├── onnx_modles    (git clone https://github.com/onnx/models.git)
   │   ├── snpe-1.14.1          (unzipped from snpe-1.1.4.1.zip)
 
1.compile snpe-sample on x86_64/linux
export CXX=g++
make -f Makefile.x86_64-linux-clang 
 
2.generate *.dlc file
./snpe-1.14.1/bin/x86_64-linux-clang/snpe-onnx-to-dlc --model_path onnx_models/bvlc_alexnet/bvlc_alexnet/model.onnx --dlc_path ./snpe-1.14.1/models/alexnet/dlc/bvlc_alexnet.dlc
 
3.convert *.jpg to *.raw
python ./snpe-1.14.1/models/alexnet/scripts/create_alexnet_raws.py -i ./snpe-1.14.1/models/alexnet/data -o ./snpe-1.14.1/models/alexnet/data/cropped -m ./caffe/distribute/python/caffe/imagenet/ilsvrc_2012_mean.npy
 
4.generate target_raw_list.txt
(I didn't find this file in snpe-1.14.1 package and also didn't get any way how to create it from doc/html , so tried to do it by myself)
python ./snpe-1.14.1/models/alexnet/scripts/create_file_list.py -i ./snpe-1.14.1/models/alexnet/data/cropped -o ./snpe-1.14.1/models/alexnet/data/cropped/target_raw_list.txt -e *.raw
 
I am not sure these steps are correct or not. Can anybody do my a favor? Thanks so much. 
 
I also ran the following command,
snpe-net-run --container dlc/bvlc_alexnet.dlc --input_list data/cropped/target_raw_list.txt
-------------------------------------------------------------------------------
Model String: N/A
SNPE v1.14.1.0
-------------------------------------------------------------------------------
Processing DNN Input: /home/yangfan34/workspace/study/snpe/snpe-1.14.1/models/alexnet/data/cropped/handicap_sign.raw
Size of input does not match network.
Expecting: 150528
Got: 154587
 
227*227*3 = 154587, that is the size of raw image. What does it mean by 150528?
 
Cheers,
fan 
 
  • Up0
  • Down0
jihoonk
Profile picture
Join Date: 28 Jan 13
Location: Seoul
Posts: 55
Posted: Fri, 2018-05-04 02:58

Hi Fan,

It seems your model doesn't have 227x227x3 input dimension. The input format is BGR interleaved floating point values. As the expecting is  150528 bytes, the model accepts 112x112x3 (112x112x3x4(float)=150,528). Please check your model with the command "snpe-dlc-info".

Also refer to the SNPE input format document: https://developer.qualcomm.com/docs/snpe/image_input.html

Thanks,

Jihoon

  • Up0
  • Down0
yangfan34
Join Date: 6 Dec 17
Posts: 9
Posted: Fri, 2018-05-04 03:19
Thanks for your quick feedback, Jihoon. That is great.
 
I generated the *.dlc like this. Is it right?
 
./snpe-1.14.1/bin/x86_64-linux-clang/snpe-onnx-to-dlc --model_path onnx_models/bvlc_alexnet/bvlc_alexnet/model.onnx --dlc_path ./snpe-1.14.1/models/alexnet/dlc/bvlc_alexnet.dlc 
 
Cheers,
Fan
  • Up0
  • Down0
yangfan34
Join Date: 6 Dec 17
Posts: 9
Posted: Sun, 2018-05-06 21:11
Hi Jihoon,
 
https://developer.qualcomm.com/docs/snpe/image_input.html mainly tell that caffe image representation is channel x width x height, SNPE is width x height x channel and mean subtraction. I also checked the *.jpg and *.raw in ./snpe-1.14.1/models/alexnet/data/cropped, their size are 227*227. I am not clear how to generate files like 112x112x3 (112x112x3x4(float)=150,528). Can you show me more details?
 
 
 
The command "snpe-dlc-info" outputs the info as showed, 
 
DLC info for /home/yangfan34/workspace/study/snpe/snpe-1.14.1/models/alexnet/dlc/bvlc_alexnet.dlc
 
Model Version: N/A
---------------------------------------------------------------------------------------------------------
| Id | Name                  | Inputs  | Outputs | Out Dims  | Parameters                                            |
---------------------------------------------------------------------------------------------------------
| 0  | data_0                 | data_0  | data_0  | 224x224x3 | input_preprocessing: passthrough |
|     |                                |                |                 |                       | input_type: default                               |
| 1  | convolution_0     | data_0  | conv1_1  | 54x54x96  | padding x: 0                                           |
 
It means the model expect 224x224x3 input format? Hope your response. Thanks.
 
yangfan
  • Up0
  • Down0
jihoonk
Profile picture
Join Date: 28 Jan 13
Location: Seoul
Posts: 55
Posted: Mon, 2018-05-07 02:14

Hi Fan,

Did you try to convert from caffe model to dlc instead of ONNX? It seems there's something weird in ONNX model converter and inference runtime.

Thanks,

Jihoon

  • Up0
  • Down0
yangfan34
Join Date: 6 Dec 17
Posts: 9
Posted: Mon, 2018-05-07 02:42

Hi Jihoon,

You are right.

I should call snpe-caffe-to-dlc, instead of snpe-onnx-to-dlc. I started my SNPE travel directly from https://developer.qualcomm.com/doc/snpe/index.html and missed "python ./model/alexnet/scripts/setup_alexnet.py", which was NOT mentioned in doc/snpe/xxx.html.

For other newbies, this link should be accessed  first,   https://developer.qualcomm.com/software/snapdragon-neural-processing-eng...

Please close this issue. Thanks so much.

Fan

 

 

 

 

 

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