Forums - Build SNPE Network failure

2 posts / 0 new
Last post
Build SNPE Network failure
bsd040
Join Date: 8 Aug 18
Posts: 1
Posted: Wed, 2018-08-15 01:29

I have a problem with building SNPE neural network corresponding to my DLC file.

I took existing PB model file, which worked fine in an application using TensorFlow interface.

public class TensorFlowClassifier {
    static {
        System.loadLibrary("tensorflow_inference");
    }

    private TensorFlowInferenceInterface inferenceInterface;
    private static final String MODEL_FILE = "file:///android_asset/frozen_model.pb";
    private static final String INPUT_NODE = "inputs";
    private static final String[] OUTPUT_NODES = {"y_"};
    private static final String OUTPUT_NODE = "y_";
    private static final long[] INPUT_SIZE = {1, 200, 3};
    private static final int OUTPUT_SIZE = 6;

    public TensorFlowClassifier(final Context context) {
        inferenceInterface = new TensorFlowInferenceInterface(context.getAssets(), MODEL_FILE);
    }

    public float[] processData(float[] data) {
        float[] result = new float[OUTPUT_SIZE];
        inferenceInterface.feed(INPUT_NODE, data, INPUT_SIZE);
        inferenceInterface.run(OUTPUT_NODES);
        inferenceInterface.fetch(OUTPUT_NODE, result);

        return result;
    }
}

I converted the PB model to DLC  by means of the following command:

./snpe-1.17.1/bin/x86_64-linux-clang/snpe-tensorflow-to-dlc --graph ~/ALPHA/FrozenModelLSTM/frozen_har.pb -i "input" 1,200,3 --out_node "y_" --dlc frozen_har.dlc --allow_unconsumed_nodes

I used the created DLC model file in my application:

final SNPE.NeuralNetworkBuilder builder = new SNPE.NeuralNetworkBuilder(mApp)
        .setDebugEnabled(false)
        // Allows selecting a runtime order for the network.
         .setRuntimeOrder(CPU)
        // Loads a model from DLC file
        .setModel(new File(modelFileWithPath));


Log.e(LOG_TAG, "Before builder.build()");

network = builder.build();

However builder.build() command fails with exception:

"Unable to create network! Cause: error_code=403; error_message=No output is defined. Network has empty outputs; error_component=Dl Network; line_no=302; thread_id=548102384280"

It is so strange that TensorFlow interface succeeds to read output layer in PB file, however the SNPE SDK does not see the same layer.

Please help.  Will be very grateful for your prompt answer.

Regards, Svetlana.
  • Up0
  • Down0
howardd
Join Date: 3 Nov 17
Posts: 5
Posted: Fri, 2018-08-24 15:22

Hi Svetlana,

Could you try adding '.setOutputLayers("y_")' to your list of builder options? I'm not sure why the builder couldn't determine this automatically, hopefully telling it the name explicitly will help.

Regards,

David

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