VIM3 yolov3 convert issue

@Frank As per your advice, I will add extra classes to my training. In that case, how many images do I have to place in “validation_tf.txt”? For example, I have 3 classes, do I have to place 3 images ?
Can you please tel me what does this file do ? @numbqq

@Akkisony This file is used to verify the converted model, you can add any number of pictures

@Frank Any number of pictures, but it has to be of size only 416x416 is it? Am I right about the dimension of the image?

@Akkisony Yes. Use 416x416 is the best choice

@Frank Okay thank you for your input! I"ll try it today. :slight_smile:

@Frank Hi Frank. I tried training the model with 3 classes, yet, I am getting the same output!


Can you please suggest me where am I going wrong? As, I said before, when I do inference on the PC, everything is fine! The predictions are good.

Please suggest me a solution. @Frank @numbqq

@Akkisony

Remove this judgment, or lower the critical value to see if there is a recognized result, and you can add some printing information to the code

@Frank Thank you for your suggestion. I have added print statement in the file. After that I build the folder and copied the .so file into the detect demo picture directory.
Surprisingly, I am not able to see the print statement! :confused:

@Akkisony Did you run sudo ./INSTALL after copied the file?

1 Like

@Frank Thank you! :slight_smile: Now I can visualize the print statement!

@Frank Can you please tell me what values does these variable “scale” and “threshold” indicate?
I am getting 0 for predictions, do you have any idea where I need to check in order to overcome this?

float prob = scale*predictions[class_index+j];

I tried printing the values of “predictions[class_index+j]” and I got to know it’s always 0.

@Frank @numbqq I am getting this output after removing the indicated statement by you!
I could not understand the meaning of scale and threshold in this context.

I printed probs value also and I am getting it as 0.
prob=0
probs=0

@Akkisony This is an AI-related major. You need to study this part by yourself

@Frank I would like to know if I can use Tengine SDK instead of NPU SDK to use the NPU? Because, my model predicts everything perfectly on PC, but it has problems only when I use NPU SDK. So I would like to give a try with Tengine SDK.
I hope that also works similar to NPU SDK.

@Akkisony You can use tengine

@Frank Thank you for the info. Please correct me if I am wrong.
I generated the .tmfile(uint8) in my host computer ubuntu 18.04. Now I copied this into my khadas board to run it using NPU.
During this process, I changed the following paramters in the .cpp file.

  1. num_classes
  2. coco_names[]
    I did not modify anthing else other than these paramteres. Have I missed anything here?

I generated the .tmfile and copied it to khadas VIM3.

Now I created a .tmfile(uint8) as per the khadas documentation using the following paramter.

./quant_tool_uint8 -m …/convert_tool/yolov3.tmfile -i ~/data/git/npu/datesets/tengine_test_datasets_100/ -o yolov3_u8.tmfile -g 3,416,416 -a MINMAX -w 0,0,0 -s 0.003922,0.003922,0.003922 -c 0 -t 4 -b 1 -
y 416,416

Are there any modification required in setting these parameters?

I generated the .tmfile(uint8) and copied into the khadas board. Meanwhile I also installed OpenCV 4 into the khadas board.

After executing the final command I am getting this output. Can you please let me know where am I going wrong? @Frank @numbqq

Hi Akkisony,
As issue 781, we need more info to analyse why this issue happened.
equation as shown below verify quantization process:
input scale * weight scale = bias scale
the real computational process is(this is a fp32 process, not chip uint8 process):
output fp32 val = (input value - input zp) * input scale * (weight - weight zp) * weight scale + (bias - bias zp) * bias scale
so a fast verification is needed.
now the quantization tool is a open source at tools/quantize.

2 Likes

Hi AkkiSony, as your quantization tool log, pls change:
-s 0.003922,0,003922,0,003922
to
-s 0.003922,0.003922,0.003922
hope this will help.

@alcohol I changed the following parameter

and copied the new tmfile(uint8) to the khadas board. Again, I did ./build-cv4.sh.

Now, when I run the model with my image, I am getting the following output.

@Akkisony The demo we provided can only work under X11 desktop, you run it under framebuffer console so you get the GTK errors. Please use the Gnome desktop image to run the demo.