OAID / Tengine

Tengine is a lite, high performance, modular inference engine for embedded device
Apache License 2.0
4.61k stars 998 forks source link

Yolov4 tiny uint8 model freezed at #578

Open stevenwudi opened 3 years ago

stevenwudi commented 3 years ago

Hi, I have follow the tutorial from (tm_classification_timvx ) trying to make a yolov4_tiny_timvx my own. However, my app does not produce any boxes.

The following is my implementation:

  1. model quantization (https://github.com/OAID/Tengine/blob/tengine-lite/tools/quantize/README.md) "./quant_tool_uint8 -m ~/models/yolov4-tiny.tmfile-i ./coco128/images/train2017/ -o ~/models/yolov4-tiny_uint8.tmfile -g 3,416,416 -w 0,0,0 -s 0.00392,0.00392,0.00392 -t 8" I choose -s 0.00392 because yolov4 use image from 0-1 (hence -s= 1/255. = 0.00392)

  2. Run the script ./tm_yolov4_tiny_timvx -m /home/khadas/models/yolov4-tiny_uint8.tmfile -i /home/khadas/models/bus_320.jpg -r 1 -t 4

  3. (https://github.com/stevenwudi/Tengine/blob/yolov4_tiny_tim_vx/examples/tm_yolov4_tiny_timvx.cpp) https://github.com/OAID/Tengine/blob/tengine-lite/doc/npu_tim-vx_user_manual.md to make a similar yolov4 tiny model:

However, there is no output of bounding boxes. I have run tm_yolov4 correctly, could the team assist some demo of yolov-tiny-timvx?

Many thanks in advance.

AkkiSony commented 3 years ago

@stevenwudi Hi, I am also working with Khadas VIM3 board, but with darknet framework using Yolov3. 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.

num_classes 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?

**khadas@Khadas:~/test/tengine_sdk/tengine_khadas_app/yolov3-picture/cv4_output$ ./tengine_khadas_yolov3_picture -m ../yolov3_u8.tmfile -i .. /holes1.png tengine-lite library version: 1.4-dev failed ! mbedtls_net_connect returned -82

authorise failed ret[-82] E [vsi_nn_QuantCheck:402]input_scale[-1334440575053054352202761503860850688.000000000000] * weight_scale[0.009132571518] != bias_scale[-121 86873482064061837878380642435072.000000000000] E [setup_node:456]Check node[2] CONV2D fail Tengine Fatal: Pre-run subgraph(0) on TIMVX failed. Tengine: Scheduler(sync) prerun failed. Prerun graph failed**

Can you help me please?