Skip to main content
Associate II
September 21, 2025
Question

RGB Value Normalization

  • September 21, 2025
  • 1 reply
  • 580 views

Hey,

Looking at the image classification application example, I couldn't find any part of the code that handles the normalization of pixel value from [0,255] to [-1,1] or [0,1] that I would expect from a CV model of that kind. 

Do you mind explaining how this implementation that is based on the mobilenet_v2_0 skips the need for normalization?

Thanks.

 

1 reply

Julian E.
Technical Moderator
September 22, 2025

Hello @pmiracle,

 

In the example you linked, the deployed model is a model from model zoo: 

mobilenet_v2_0.35_128_fft_int8.tflite

 

This model takes a float32 input [-1,1] and contains the scale and offset:

JulianE_0-1758528831057.png

 

The yaml from model zoo only indicate the scripts how to edit the getting started application for model zoo to deploy it on the stm32. ie:

JulianE_0-1758529015167.png

If you run the deployment yaml throught the stm32ai_main.py, you can look at the edited and deployed application here:  /application_code/image_classification/STM32N6/

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
pmiracleAuthor
Associate II
September 22, 2025

Thanks for the reply,

This doesn't makes sense to me, because the camera on the DevKit creates RGB values in the range of 0-255 and there is no code in the example project that I have seen that translates these values to -1,1.

Any explanation?

Julian E.
Technical Moderator
September 23, 2025

Hello @pmiracle,

 

You're right, I misread. 

The float32[-1:1] is the output (look at the image).

The input is uint8[128,128,3] and most likely RGB values in the range of 0-255 as you pointed out.

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.