Jump to content
Sign in to follow this  
marco@bigsis.tech

how to set mean_values/std_values when converting to rknn?

Recommended Posts

Hi All,

I understand that in order to run an AI model on the NPU I have to convert it to RKNN, but whenever I do that my model (tf-lite) looses accuracy up to 15-20%.

 I have checked Rockchip_Trouble_Shooting_RKNN_Toolkit_V1.7.3_EN.pdf  document in section 8.1 and it says that this issue might be related to setting mean_values/std_values incorrectly.

then I found the below section in  Rockchip_Trouble_Shooting_RKNN_Toolkit_V1.3.2_EN.pdf on how to set mean_values/std_values, but still don't quite understand it:

image.png

I have 3 questions:

1) I am doing a binary classification and my Input data is (240,240,3) for training,  would this be my (Cin0, Cin1,Cin2) ?

2) how do I set the Scale parameter ?

3)how do I get (Cout0,Cout1, Cout2) ?

 

thank you,

I would really appreciate your help

Share this post


Link to post
Share on other sites

hello @marco@bigsis.tech

On 1/20/2023 at 10:22 PM, marco@bigsis.tech said:

1) I am doing a binary classification and my Input data is (240,240,3) for training,  would this be my (Cin0, Cin1,Cin2) ?

 

yes, it'd be your (Cin0, Cin1, Cin2)

for q #2 & #3, we've used netron to open the model inception_v4_299_quant.tflite, in quantization columns:

 

to quantify with data range -1 ~ 1

-1 <=0.0089125 * (q – 128) =< 0.9921875 

from this example it shows that the scale parameter = 128, and it's the same with mean parameter

you will have to do it with models quantified, otherwise it'd be very confusing to set mean and std value

we've asked the vendor and were told that it depends on whether the model's input data's been processed wile training or not.

 

netron.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...