Skip to main content
123456dad
Associate II
October 21, 2023
Solved

I had some problems when i want to deploy a flower classification model from STM32 ai model zoo

  • October 21, 2023
  • 1 reply
  • 3259 views

123456dad_0-1697860087558.png

This is the model i use(through X cube ai 8.1.0)

By annalyze it ,the output should be float as below

123456dad_1-1697860219346.png

But the auto generated code declare it as ai_i8,why?

123456dad_2-1697860308592.png

and I can`t get result in the following way,I don`t konw the reason

123456dad_3-1697860519431.png

123456dad_0-1697861474939.png

 

Because of the limits ,I can only provide three files here.

I`d appreciate it if someone could answer my questions!!!

This topic has been closed for replies.
Best answer by STea

Hello @123456dad ,

this is due to the quantization of the model as explained in the UM2526 section 1.3:

  1. The code generator quantizes weights and bias, and associated activations from floating point to 8-bit precision.
    These are mapped on the optimized and specialized C implementation for the supported kernels.
    Otherwise, the floating-point version of the operator is used and float-to-8-bit and 8-bit-to-float convert operators
    are automatically inserted.
  2. The objective of this technique is to reduce the model size while also improving the CPU and hardware accelerator latency (including power consumption aspects) with little degradation in model accuracy.

so to improve CPU and hardware accelerator latency this conversion from float to the ai_i8 is needed.

Hope this answers your request .

BR

 

1 reply

STeaBest answer
ST Employee
November 10, 2023

Hello @123456dad ,

this is due to the quantization of the model as explained in the UM2526 section 1.3:

  1. The code generator quantizes weights and bias, and associated activations from floating point to 8-bit precision.
    These are mapped on the optimized and specialized C implementation for the supported kernels.
    Otherwise, the floating-point version of the operator is used and float-to-8-bit and 8-bit-to-float convert operators
    are automatically inserted.
  2. The objective of this technique is to reduce the model size while also improving the CPU and hardware accelerator latency (including power consumption aspects) with little degradation in model accuracy.

so to improve CPU and hardware accelerator latency this conversion from float to the ai_i8 is needed.

Hope this answers your request .

BR