Issue running examples with custom model

Trying to run bytetrack_plus_demo generic inference demo with custom model. Model was converted from onnx to nef successfully, but using NEF_Parser_lite produces an error.

AssertionError: Invalid setup.bin format

Ignoring/commenting out the error and trying to proceed produces another error later on.

Error: inference failed, error = Error raised in function: generic_raw_inference_bypass_pre_proc_receive. Error code: 30. Description: 30

This is the onnx model used at the beginning. Unsure if this was a conversion issue or a KL720 issue.


Comments

  • edited October 2023

    @Clarence

    Hi Clarence.

    I'm not sure which version of Kneron Toolchain you are using, would you mind letting us know.

    This should be a problem with the model conversion, in KL720, the main reason for this model error is because the value info of the model is dynamic input instead of fixed input.

    So you can try to change the model unk__32 to 1 and it should work.

  • Thank you for the reply. I have changed the input batch size to be fixed at 1, as shown below.

    However I am still receiving the invalid setup.bin error.

    Traceback (most recent call last):
     File "<path truncated>\run.py", line 182, in <module>
       main()
     File "<path truncated>\run.py", line 104, in main
       nef_radix = NEF_Parser_lite.extract_input_radix_from_kl720_nef(nef_model_path) # only support single model NEF
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "<path truncated>\utils\NEF_Parser_lite.py", line 226, in extract_input_radix_from_kl720_nef
       innode_radix = extract_radix(fw_info, allmodels_data)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "<path truncated>\utils\NEF_Parser_lite.py", line 209, in extract_radix
       assert raw[0] == 0x8EB5A462, "Invalid setup.bin format"
              ^^^^^^^^^^^^^^^^^^^^
    AssertionError: Invalid setup.bin format
    

    Again if I ignore and comment out the assert line...

    Traceback (most recent call last):
     File "<path truncated>\run.py", line 182, in <module>
       main()
     File "<path truncated>\run.py", line 127, in main
       img_input *= (1 << nef_radix)
    numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'multiply' output from dtype('O') to dtype('float64') with casting rule 'same_kind'
    

    And then again I receive the following...

    Error: inference failed, error = Error raised in function: generic_raw_inference_bypass_pre_proc_receive. Error code: 30. Description: 30
    


  • @Clarence

    Hi Clarence,

    The reason for the error may be that your onnx model is missing "value_info" between layers.

    You can try to run onnx's "shape_infernece" or "polish_model", these should help to calculate the middle shape.

  • I have updated the model to look as above, but I get the same errors as before.

  • edited October 2023

    @Clarence

    Hi Clarence,

    I may need to confirm with you that the model you are using (onnx, nef) and the Scrtips, and was wondering if you could provide them.

    I'm guessing you're probably using the byte-tracing code you provided earlier in the contest since the byte-tracing code in PLUS shouldn't have "NEF_Parser_lite.py" in it now.

    For the current Kneron PLUS you may refer to: https://www.kneron.com/tw/support/developers/


The discussion has been closed due to inactivity. To continue with the topic, please feel free to post a new discussion.