Forums - Problem with building network in Android application using a DeepLabV3 model converted from tensorflow to .dlc file.

2 posts / 0 new
Last post
Problem with building network in Android application using a DeepLabV3 model converted from tensorflow to .dlc file.
gesqdn-forum
Join Date: 4 Nov 18
Posts: 184
Posted: Tue, 2019-05-28 04:21

While building the NeuralNetwork object (Using the code snippet below)


NeuralNetwork network = new SNPE.NeuralNetworkBuilder(application)
        .setDebugEnabled(false)
        .setOutputLayers(outputLayerNames)
        .setModel(assetInputStream, assetInputStream.available())
        .setPerformanceProfile(NeuralNetwork.PerformanceProfile.HIGH_PERFORMANCE)
        .setRuntimeOrder(selectedRuntime)
        .setCpuFallbackEnabled(needsCpuFallback)
        .build();
 

I am facing the below Exception :

java.lang.IllegalStateException: Unable to create network! Cause: error_code=300; error_message=Model parsing has failed.; error_component=Dl Container; line_no=319; thread_id=510488369816

Please let me know what modifications I need to do to successfully build the network.

 

  • Up0
  • Down0
gesqdn-forum
Join Date: 4 Nov 18
Posts: 184
Posted: Tue, 2019-05-28 04:24

I have been able to resolve this issue by ensuring the below points:

1. The issue could be because you might be creating the neural network object in the main thread.

One way of resolving this would be to create an Async Task and create the object of the NeuralNetwork in doInBackground() method.Below is an example snippet of building the network :

final SNPE.NeuralNetworkBuilder builder = new SNPE.NeuralNetworkBuilder(mApplication)
        .setDebugEnabled(false)
        .setRuntimeOrder(mTargetRuntime)
        .setModel(mInputstream, mInputstream.available())
        .setCpuFallbackEnabled(true)
        .setUseUserSuppliedBuffers(mTensorFormat != MainActivity.SupportedTensorFormat.FLOAT);
network = builder.build();


Please also note that, in this NeuralNetwork object we would not pass the output layer. Instead we would create the input stream of the model (.dlc) in the main thread.

2. Putting the model in the /raw directory instead of the /asset directory.

3. Please ensure that you use the snpe-release.aar as snpe library.
You can get the file by following the steps mentioned in the setup instructions below:
https://developer.qualcomm.com/docs/snpe/android_tutorial.html

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