How to calculate mean values for NPU model conversion?

What is this max and min value? how to find it?
scale = (max_value - min_value)/255
zero_point = max_value - max_value/scale

Hello @Omkar_Shende

@Frank will help you with this.

1 Like

do i have to repost in VIM3 section ??

@Omkar_Shende You can find the answer in the docs in SDK

1 Like

I am following that document but it gives this information after step 2
Step 1 :
$pegasus import darknet
–model ./model/${NAME}.cfg
–weights ./model/${NAME}.weights
–output-model ${NAME}.json
–output-data ${NAME}.data \

$pegasus generate inputmeta
–model ${NAME}.json
–input-meta-output ${NAME}_inputmeta.yml
–channel-mean-value “0 0 0 0.0039”
–source-file dataset.txt

Step 2 :
$pegasus quantize
–quantizer asymmetric_affine
–qtype uint8
–rebuild
–with-input-meta ${NAME}_inputmeta.yml
–model ${NAME}.json
–model-data ${NAME}.data

I want to know how it is decided what -channel-mean-value to provide during step 1.
The issue is I am testing a Yolo model, but the accuracy on NPU is very low same model gives me an accuracy of about 74% on CPU and GPU.

how I am using the model :
to convert : sudo ./convert --model-name yolov3_tiny0_0036 --platform darknet --model yolov3-tiny-416.cfg --weights yolov3-tiny-416.weights --mean-values ‘0 0 0 0.00390625’ --quantized-dtype asymmetric_affine --qtype uint8 --source-files ./data/dataset/dataset0.txt --kboard VIM3 --print-level 0

I used –channel-mean-value “0 0 0 0.0039” value because it was used in all the yolo examples in “ksnn/examples/darknet at master · khadas/ksnn · GitHub” . But it is giving poor accuracy 1.6%