Forums - network initialize failed when set multiple output layers

11 posts / 0 new
Last post
network initialize failed when set multiple output layers
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Thu, 2018-01-04 05:31

Hi guys,

It says that multiple output layers are supported in documents, when I set multiple output layers with code below:

zdl::DlSystem::StringList outputLayers = {};

    outputLayers.append("BoxPredictor_0/box_encodings_0");
    outputLayers.append("BoxPredictor_0/class_0");
    outputLayers.append("BoxPredictor_1/box_encodings_1");
    outputLayers.append("BoxPredictor_1/class_1");
    outputLayers.append("BoxPredictor_2/box_encodings_2");
    outputLayers.append("BoxPredictor_2/class_2");
    outputLayers.append("BoxPredictor_3/box_encodings_3");
    outputLayers.append("BoxPredictor_3/class_3");

const zdl::DlSystem::StringList outputNames = outputLayers;

snpe = snpeBuilder.setOutputLayers(outputNames)
        .setDebugMode(true)
        .setRuntimeProcessor(runtime)
        .setUseUserSuppliedBuffers(useUserSuppliedBuffers)
        .build();

My network has 8 output layers, if outputNames is not empty I'll get NULL pointer for snpe,

if outputNames is empty, then snpe is set to the correct pointer, but it would only consider the final layer as output.

But I would like to set the 8 layers as output layers.

Does it a bug for SNPE SDK?

 

  • Up0
  • Down0
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Thu, 2018-01-04 06:05

To debug the issue, I set debug mode to true, but it does not provide useful messages.

It seems that set output layers stringlist to {} is the only way to get it works.

Any comments would be appreciated! Thanks.

  • Up0
  • Down0
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Thu, 2018-01-04 21:13

Hi,

I test setOutputLayers in snpe-sample example codes, when pass parameter to setOutputLayers, it would crash, android reports error logs listed below, it seems that setOutputLayers API is not support, but documents says the API should work.

So is it something that I missed or I set wrong paremeters?

Hope for detail reason, or is there a way to debug this issue?

01-05 13:08:42.310 15356-15356/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-05 13:08:42.311 15356-15356/? A/DEBUG: Build fingerprint: 'Xiaomi/gemini/gemini:7.0/NRD90M/7.9.14:user/release-keys'
01-05 13:08:42.311 15356-15356/? A/DEBUG: Revision: '0'
01-05 13:08:42.312 15356-15356/? A/DEBUG: ABI: 'arm64'
01-05 13:08:42.312 15356-15356/? A/DEBUG: pid: 15345, tid: 15345, name: snpe-sample  >>> ./snpe-sample <<<
01-05 13:08:42.312 15356-15356/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
01-05 13:08:42.313 15356-15356/? A/DEBUG:     x0   0000000000000000  x1   0000007fc3ac3668  x2   0000000000000003  x3   000000557ba2a7d4
01-05 13:08:42.313 15356-15356/? A/DEBUG:     x4   0000000000000057  x5   4000000000000000  x6   0000000000800000  x7   7702ff514b4f79fe
01-05 13:08:42.313 15356-15356/? A/DEBUG:     x8   0000007fc3ac3660  x9   0000007fa840c788  x10  0000000000000057  x11  0000000000000000
01-05 13:08:42.313 15356-15356/? A/DEBUG:     x12  0000000000000001  x13  00000000ffffffff  x14  00000000001eb180  x15  0000000000001fe3
01-05 13:08:42.314 15356-15356/? A/DEBUG:     x16  000000557ba48c50  x17  0000007fa8bb0a18  x18  0000000000000000  x19  0000007fc3ac3688
01-05 13:08:42.314 15356-15356/? A/DEBUG:     x20  000000557ba49000  x21  0000007fc3ac3900  x22  0000007fc3ac3660  x23  0000007fc3ac3638
01-05 13:08:42.314 15356-15356/? A/DEBUG:     x24  0000007fc3ac3578  x25  0000007fc3ac36c0  x26  0000007fc3ac3588  x27  0000000000000001
01-05 13:08:42.314 15356-15356/? A/DEBUG:     x28  0000000000000001  x29  0000007fc3ac3490  x30  000000557ba29c50
01-05 13:08:42.314 15356-15356/? A/DEBUG:     sp   0000007fc3ac3490  pc   0000007fa8bb0a20  pstate 0000000020000000
01-05 13:08:42.312 15356-15356/? W/debuggerd64: type=1400 audit(0.0:306389): avc: denied { search } for name="tmp" dev="dm-1" ino=25 scontext=u:r:debuggerd:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
01-05 13:08:42.312 15356-15356/? W/debuggerd64: type=1400 audit(0.0:306390): avc: denied { search } for name="tmp" dev="dm-1" ino=25 scontext=u:r:debuggerd:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
01-05 13:08:42.326 15356-15356/? A/DEBUG: backtrace:
01-05 13:08:42.327 15356-15356/? A/DEBUG:     #00 pc 000000000009ba20  /data/local/tmp/libSNPE.so
01-05 13:08:42.327 15356-15356/? A/DEBUG:     #01 pc 0000000000005c4c  /data/local/tmp/snpe-sample
01-05 13:08:42.327 15356-15356/? A/DEBUG:     #02 pc 000000000001a794  /system/lib64/libc.so (__libc_init+88)
01-05 13:08:42.327 15356-15356/? A/DEBUG:     #03 pc 0000000000006790  /data/local/tmp/snpe-sample

  • Up0
  • Down0
seewoo79
Join Date: 14 Apr 14
Posts: 3
Posted: Fri, 2018-01-05 01:41

I'm also use multiple output layer & my code is below.

layer name is changed....

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

    zdl::SNPE::SNPEBuilder snpeBuilder(container_.get());

    zdl::DlSystem::StringList outputList(0);
    outputList.append("xxxx/aaaa);   //output1 layer name
    outputList.append("xxxx/bbbb"); // output2 layer name
 
    snpe_ = snpeBuilder.setOutputLayers(outputList)
                .setRuntimeProcessor(runtime_)
                .setPerformanceProfile(performance_)
                .build();
================================================
 
before old snpe version, even though I didn't set the setOutputLayers, I could get multiple output from snpe. but, newer version I have to specify about output layers...
  • Up0
  • Down0
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Fri, 2018-01-05 04:09

Hi seewoo79,

I use SNPE SDK version 1.8.0, what about your version?

It seems that the differences between our code is the way how we declare outputList,

I use the way the example does: snpe=snpeBuilder.setOutputLayers({}), so I initialized outputList as '{}'.

In the doc of SNPE SDK 1.8.0, it says that when set en empty list to setOutputLayers, it would use only the final layer as the output layer.

Next week I would try your way to see if it works.

Thanks for sharing!

  • Up0
  • Down0
seewoo79
Join Date: 14 Apr 14
Posts: 3
Posted: Sat, 2018-01-06 04:21

I tested my app for all version of SNPE (1.2.2 ~ 1.8.0) .

  • Up0
  • Down0
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Sat, 2018-01-06 04:42

So your code works fine with all the versions?

Are there other different code may effect the multiple outputs?

I will test it on Monday.

  • Up0
  • Down0
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Sun, 2018-01-07 21:57

Hi,

Finally I found that if I add tf.sigmoid to the layer output, then it can be used as the output layer.

Does your output layer's values are all between 0 ~ 1?

Does it mean that if all the output values must be normalized between 0 ~ 1?

  • Up0
  • Down0
seewoo79
Join Date: 14 Apr 14
Posts: 3
Posted: Mon, 2018-01-08 17:46

No. my network has 2 output layers and one of them has output value range(0 ~ 700).

I just check that you use tf. maybe it is main difference....because I used caffe prototxt...

 

 

Output Value : 72.350838
Output Value : 91.408913
Output Value : 74.347046
 
  • Up0
  • Down0
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Mon, 2018-01-08 19:19

Yeah, I use tensorflow, and don't know why adding sigmoid to output would works.

Thanks for information.

  • Up0
  • Down0
kshamajayantvete
Join Date: 6 Sep 17
Posts: 9
Posted: Thu, 2018-05-10 22:41

Hi DamonZhou,

Have you solved this problem?

I am facing similar issue. My model has two output layers , I am doing the same way as you, but getting only one output tensor (final layer).

If you have solved the issue then kindly help me regarding this.

Thanks in Advance,

Kshama Vete

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