0
$\begingroup$

I'm following a Xilinx Tutorial about the implementation of a Neural Network in a System on Chip (ARM Processor + Xilinx FPGA) and I have come up with an error during the compilation step.

I've trained a U-Net in Matlab 2020b and exported to Keras via onnx2keras and followed the steps of the tutorial without any errors:

  • Verification of getting the same test scores in Matlab and in Vitis AI (correct exportation).
  • Transformation of the Keras model into TF checkpoint and inference graph.
  • Freezing the TF graph.
  • Quantization from 32-bit floating point to 8-bit fixed point.
  • Running the compiler (Error while parsing raw model).

The full error message is:

 Traceback (most recent call last):

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/bin/xnnc-run", line 33, in module
 sys.exit(load_entry_point('xnnc==1.4.0', 'console_scripts', 'xnnc-run')())

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/__main__.py", line 49, in main
runner.normal_run(args)

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/runner.py", line 123, in normal_run
target=target,

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/xconverter.py", line 145, in run
model_files, model_type, _layout, in_shapes, batchsize

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/core.py", line 123, in make_xmodel
model_type=model_t,

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/translator/tensorflow_translator.py", line 107, in to_xmodel
model_type,

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/translator/tensorflow_translator.py", line 173, in create_xmodel
name, layers, layout, in_shapes, batchsize

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/translator/tensorflow_translator.py", line 289, in __create_xmodel_from_tf1
batchsize,

 File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/xnnc/translator/tensorflow_translator.py", line 3192, in __generate_xmodel
), f"[ERROR] Not found op in super_const_dict: name: {weights_id}"
AssertionError: [ERROR] Not found op in super_const_dict: name: Decoder_Section_1_UpConv_1/kernel

At first, I thought that the compiler may not support certain layers such as Conv2DTransposed (a way of upsampling images) but even though the documentation says that the Tensorflow version needs to be higher than 2.0 and I'm using 1.15.2, the tutorial includes a U-Net made of those layers and I've compiled it without any problem so, that's not the problem, I think.

Then, I've decided to compare both neural networks after freezing and also after quantization, so as to try to find some information that may be missing in my U-Net that does include it the other one.

Inspection results after freezing. Op types used (my U-Net --> tutorial U-Net):

  • Const 78 --> 52
  • Identity 28 --> 26
  • BiasAdd 13 --> 13
  • LeakyRelu 12 --> ---
  • Relu -- --> 11
  • Conv2D 11 --> 11
  • Pad 10 --> ---
  • AddV2 8 --> ---
  • Sub 8 --> ---
  • StridedSlice 6 --> 6
  • Mul 4 --> 4
  • ConcatV2 2 --> 2
  • Conv2DBackpropInput 2 --> 2
  • MaxPool 2 --> 2
  • Pack 2 --> 2
  • Shape 2 --> 2
  • Placeholder 1 --> 1

There are differences between the two freezing processes as the two U-Nets are two different modified versions of the original one. However, as I see it, I don't think that LeakyRelu, Pad, AddV2 or Sub (the ones that appear in my model and not in the model of the tutorial) are related to the error.

Similarly, after quantization these are the differences. Op types used (my U-Net --> tutorial U-Net):

  • Const 78 --> 52
  • FixNeuron 48 --> 44
  • BiasAdd 13 --> 13
  • LeakyRelu 12 --> --
  • Relu -- --> 11
  • Convd2D 11 --> 11
  • Pad 10 --> --
  • AddV2 8 --> --
  • Sub 8 --> --
  • StridedSlice 6 --> 6
  • Mul 4 --> 4
  • ConcatV2 2 --> 2
  • Conv2DBackpropInput 2 --> 2
  • MaxPool 2 --> 2
  • Pack 2 --> 2
  • Shape 2 --> 2
  • Placeholder 1 --> 1

I don't know exactly where the error comes from so any kind of help would be highly appreciated.

$\endgroup$

1 Answer 1

1
$\begingroup$

It seems that the error has nothing to do with Vitis AI and is due to an error during the export process Matlab-ONNX. I've created in Vitis AI a bare copy of the neural network trained in Matlab and just copied the weights and biases from it. The compilation error has now dissappeared.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.