In the tutorial document of hailo_dataflow_compiler, it mentions that the SNR value should not be higher than 10 after quantization:

“The graph shows the SNR values in decibels (dB) and any value higher than 10 should be fine”

Could someone give a deeper explanation how this number is calculated? How did we get the conclusion that the number 10 is the minimum acceptable value?

1 Like

**The SNR formula we use is **`SNR = 10 x log (signal / noise)`

The profiler report may contain two different types of SNR calculation, one at the top right (which requires full Layer Analysis Tool results), and another one on the optimization details of each layer (available with the simple LAT performed by default with optimization level >= 1).

Here is a description of the SNR chart in the top drawer section:

A plot of signal-to-noise ratio between the full precision and quantized model. The SNR value is measured at the output layer(s) of the model and in each measurement, only a single layer is quantized. This graph shows the sensitivity of each layer to quantization measured in dB. The most sensitive layers (< 10dB) are highlighted. In cases where there are multiple output layers, multiple graphs will be shown.

(Dataflow Compiler v3.28.0)

That means that in the formula `SNR_n = 10 x log (signal / noise_n)`

:

- SNR_n = for layer n
- signal = the native output of the model
- noise_n = diff between the output of the model with native weights and output of the model with only layer n quantized

And the SNR in layer optimization details is calculated as follows:

Signal-to-noise ratio between the full precision and quantized model, measured **at this layer’s output, when all the layers are quantized** . It helps to understand what is the SNR at this point on the quantized model, considering all previous layers have been quantized. Expect low on-layer SNR at the final nodes of the model, compared to the on-layer SNR at the beginning. Note the difference between this measure to the SNR chart on top drawer, which shows the SNR at the model’s outputs, when only one layer is quantized at a time.

That means that in the formula `SNR_n = 10 x log (signal / noise_n)`

:

- SNR_r = SNR for layer n
- signal = the native output of the layer
- noise_n = diff between the native and quantized output of layer n

About 10 being the minimum possible acceptable SNR, this was decided based on our observations. The higher the better, but a 10 SNR might not necessarily mean a terrible accuracy degradation. We recommend confirming it either with visualization or evaluating using the model’s accuracy measurement.

1 Like