Open scholz opened 2 years ago
I had the same exact problem, but for Darknet with YOLO. My fix was to just use the 5.10
kernel. But currently, it is even working with the bleeding-edge stable kernel 5.16.2
. So maybe try to switch to the lts-kernel.
Hi @2tefan , thanks for your reply.
Okay interesting. I think when I tried the 5.16 kernel last (ie. using https://dl.khadas.com/Firmware/VIM3/Ubuntu/SD_USB/VIM3_Ubuntu-gnome-focal_Linux-5.16-rc2_arm64_SD-USB_V1.0.9-211217.img.xz - I believe I wasnt able to run anything on the NPU at all - I think there was some driver issue. I think also the khadas team in their forums advised to stick to the 4.9 kernel version). But following your suggestion I might try it again.
Also based on your comment - I tried to convert yolo3 darknet as documented in the readme.md from ksnn. And it works for me with the current kernel -> both the model file and library file are generated. However, I have not yet tried to run them in the provided demos and the md5sums are different.
Here's the code I used to convert the original yolo3:
wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov3.cfg
wget https://pjreddie.com/media/files/yolov3.weights
./convert \
--model-name yolov3 \
--platform darknet \
--model yolov3.cfg \
--weights yolov3.weights \
--mean-values '0,0,0,256' \
--quantized-dtype asymmetric_affine \
--kboard VIM3 --print-level 1
# [..lots of output..]
ls -l outputs/yolov3/
total 62476
-rwxr-xr-x 1 root root 167824 Jan 24 17:30 libnn_yolov3.so
-rw-r--r-- 1 root root 63804794 Jan 24 17:30 yolov3.nb
# when comparing these file to the files provided in ksnn example for darknet the md5sums are different
I also tried as in my last comment to use the convert script with yolov5s.tflite as input but this did also not create any files.
Using the previous conversion chain ie. the bash scripts provided in aml_npu_sdk/acuity_toolkit/demo works with yolov5s.onnx (generates model file and code but not library -> so this may be the problem).
I will try one more time to convert yolov3 to onnx and then see if yields an output + try again with the other kernel. Then I may try to use the output of the other conversion chain and see if I can also integrate this in the python example...
Yolov3 from ultralytics -> onnx -> convert is working (output is in outputs). So Yolov5 seems to differ in some regard relevant to the conversion.
Since I couldn't get the pyTorch model to convert (see other ticket). I tried to convert the model to onnx and go from there. Unfortunately I also did not suceed.
However, when running the convert script no output model is generated (with same parameters as your example in https://github.com/khadas/ksnn/tree/master/examples/onnx) albeit no error is reported.
I generated a yolov5s.onnx using the following steps:
Then used the following script (adapted from resnet50v2.onnx) as in the example. I also tried to run the convert on resnet50v2.onnx and an output is generated - so yolov5s seems to trigger some edge case.
I attached the full log of the convert output (yolo-conv.log).
The last part of the output is:
There are also some remains of the conversion in /tmp/... If you have any hint whats going wrong here - that would be very much appreciated. Maybe there are some operations which are not supported? Anyhow, I will try the tflite conversion next.