Error while running Case Code

Hi!
I have a very simple model - only 2 layers.
I’m unable to get it to run : it exits with the following output.
D [setup_node:367]Setup node id[0] uid[0] op[NBG]
D [print_tensor:129]in : id[ 1] shape[ 28, 28, 1 ] fmt[u8 ] qnt[ASM zp=128, scale=0.007812]
D [print_tensor:129]out: id[ 0] shape[ 256, 1 ] fmt[u8 ] qnt[ASM zp= 0, scale=0.003922]
D [optimize_node:311]Backward optimize neural network
D [optimize_node:318]Forward optimize neural network
I [compute_node:260]Create vx node
E [compute_node:286]Create node[0] NBG fail
E [vnn_CreateNeuralNetwork:174]CHECK PTR 174
E [main:210]CHECK PTR 210

How can I debug this?
Note that I can run the inceptionv3 example. I have modified the scripts from that to produce this.

Thanks!

@hmathava How do you run you case code ? Compile directly or replace into demo ?

Thanks for replying!
The following is the workflow I took:

  1. Change and run 0_import_model.sh

    #!/bin/bash

    NAME=my_example
    ACUITY_PATH=…/bin/

    convert_caffe=${ACUITY_PATH}convertcaffe
    convert_tf=${ACUITY_PATH}convertensorflow
    convert_tflite=${ACUITY_PATH}convertflite
    convert_darknet=${ACUITY_PATH}convertdarknet
    convert_onnx=${ACUITY_PATH}convertonnx

    $convert_tf
    –tf-pb ./model/tf_model.pb
    –inputs flatten_input
    –input-size-list ‘28,28’
    –outputs dense/Sigmoid
    –net-output ${NAME}.json
    –data-output ${NAME}.data

  2. Add test images and correct responses to data/validation_tf.txt

  3. Change and run 1_quantize_model.sh

    NAME=my_example
    ACUITY_PATH=…/bin/

    tensorzone=${ACUITY_PATH}tensorzonex

    #asymmetric_quantized-u8 dynamic_fixed_point-8 dynamic_fixed_point-16
    $tensorzone
    –action quantization
    –source text
    –source-file ./data/validation_tf.txt
    –channel-mean-value ‘128 128 128 128’
    –model-input ${NAME}.json
    –model-data ${NAME}.data
    –quantized-dtype asymmetric_quantized-u8
    –quantized-rebuild

    $tensorzone
    –action inference
    –source text
    –source-file ./data/validation_tf.txt
    –channel-mean-value ‘128 128 128 128’
    –model-input ${NAME}.json
    –model-data ${NAME}.data
    –dtype quantized

  4. Change and run 2_export_case_code.sh

    #!/bin/bash

    NAME=my_example
    ACUITY_PATH=…/bin/

    export_ovxlib=${ACUITY_PATH}ovxgenerator

    $export_ovxlib
    –model-input ${NAME}.json
    –data-input ${NAME}.data
    –channel-mean-value ‘128 128 128 128’
    –reorder-channel ‘0 1 2’
    –export-dtype quantized
    –model-quantize ${NAME}.quantize
    –optimize VIPNANOQI_PID0X88
    –viv-sdk …/bin/vcmdtools
    –pack-nbg-unify

    rm *.h *.c .project .cproject *.vcxproj *.lib BUILD *.linux

    mv nbg_unify nbg_unify_${NAME}

    cd nbg_unify_${NAME}

    mv network_binary.nb ${NAME}.nb

  5. Copy build_vx.sh and run that. Copy built executable and nb file to vim3 pro board and run.

Please let me know if I missed anything. Thanks!

@hmathava You model is a single channel model . Not a three channel model . So,--channel-mean-value can’t be ‘128 128 128 128’

Thanks for noticing that -I will change it.
What is that document you have attached? Where can I find that?

@hmathava It should be in SDK

Thanks for the inputs.
I have changed the scripts to reflect channel means parameter of 0 0 0 256 but I still get the same error.

Hello again,
Is there anything else you’d like me to change with my current process?

@hmathava Can you provide a complete running log information ?

Here it is:
D [setup_node:367]Setup node id[0] uid[0] op[NBG]
D [print_tensor:129]in : id[ 1] shape[ 28, 28, 1 ] fmt[u8 ] qnt[ASM zp= 0, scale=0.003906]
D [print_tensor:129]out: id[ 0] shape[ 10, 1 ] fmt[f16] qnt[NONE]
D [optimize_node:311]Backward optimize neural network
D [optimize_node:318]Forward optimize neural network
I [compute_node:260]Create vx node
E [compute_node:286]Create node[0] NBG fail
E [vnn_CreateNeuralNetwork:174]CHECK PTR 174
E [main:210]CHECK PTR 210

@hmathava This is the first time I have met this situation. The value prompt nbg create fail has no specific error type prompt and there is no way to judge .

Thats unfortunate :frowning:
I am trying to run a single dense layer through you API to gauge the performance. What would be your suggested methodology?

@hmathava Maybe you can tell me that what is the purpose of your model and what are the inputs and outputs?

My model is to just test the TOPs of the system using Dense Layers.
Currently it is:
(28,28)Input -> Flatten -> Dense(256 w/ Sigmoid) -> Softmax

@hmathava Do you want to evaluate the performance of those NPU ?

Yes I would like to evaluate performance specifically for Dense layers.

@hmathava Maybe you can use a google model to test . I find google model is always a good conversion