Re-trained Tiny-YOLOv3 on KL520 AI SoC board doesn't detect any objects during inference
I'm following the documentation to re-train Tiny-YOLOv3.
After finishing the training, I can see the results when running yolo_video.py
.
I have also converted the Keras model to ONNX and created the NEF model.
I only edited the scpu
classes for the new classes.
After flashing it to the SoC board, it doesn't detect any objects.
Is there any setting I might be missing in the application?
Any help would be appreciated.
Thanks!
Tagged:
Comments
Have you ever tried running inference on your ONNX model using
ktc.kneron_inference()
in the Toolchain before converting it into NEF format?If you have already confirmed the performance of the ONNX model you trained, the difference in accuracy between the ONNX model and the NEF model could be caused by incorrect preprocessing or postprocessing.
Please try to run inference with both the ONNX and NEF models using
ktc.kneron_inference()
.https://doc.kneron.com/docs/#toolchain/manual_1_overview/#14-floating-point-model-preparation
If you are able to get correct results with the ONNX model but still encounter issues with the NEF model, please provide the corresponding materials, and we will help you check it.
Hi Ethon,
Thank you for your recommendation. I followed the example to check the
ktc.kneron_inference()
results and have also attached the log file.However, I made some modifications—specifically to the image tensor shape. The original code was:
I removed the transpose because it caused a reshape size error during inference.
When I used the new YOLOv3-Tiny
.nef
file to test the KL520 AI SoC example for YOLOv3-Tiny, no objects were detected. I was using the.weights
file on the COCO dataset for YOLOv3-Tiny.Hi,
Thank you for providing the log. For the code, did you mean the one below?
If so, the Yolov3 example on our documentation is outdated; it was written for toolchain v0.22.0, and our latest toolchain version is v0.30.0. Please refer to the main toolchain manual here: 1. Toolchain Manual Overview - Document Center
When you used your onnx model in ktc.kneron_inference() with postprocess function, was it able to detect anything? As Ethon said, before moving onto the .nef file, please make sure that using ktc.kneron_inference() with both your onnx model and your NEF model give the correct results on Kneron Toolchain. The link above also has example codes on ktc.kneron_inference().
Hi Maria,
When I try version v0.30.0 and use the ready-made 'Keras to ONNX' model for testing, I encounter a failure during the ONNX to NEF conversion process.
The error message is: 'Failure for model "input/input" when running on kdp520: HW not supported.
Is there a problem in the new version?
Hi Zhihao,
What is your onnx model's opset? If it was opset 13 or higher, we'd recommend you to use the onnx1.13 environment inside the toolchain.
Also, please check the following:
-Your onnx model has gone through onnx2onnx optimization
-Your onnx model's operators are all supported by KL520. If there were any operators not supported, the conversion would fail, so you could cut the them off and add them back in your postprocess function. Supported operators list: Hardware Supported Operators - Document Center
-Your input shape is the same as the one in your onnx model
If these are all checked and the problem still persists, could you provide your onnx model and your onnx to NEF conversion script? Thank you!
Hi Maria
My ONNX model uses opset 11, and I'm working in the base Conda environment.
I followed the tutorial to run ONNX optimization using
onnx2onnx
.In the optimized model, one of the operators is
Resize
.Should the
Resize
operator be removed from the model?I’ve attached my conversion script and the
yolov3-tiny.opt.onnx
fileI would appreciate your help in finishing this example.
Hi Zhihao,
Yes, you're using the right conda environment for opset 11.
The Resize operator isn't supported by KL520 so it should be removed and added in the postprocess function. Unfortunately, we could usually cut off operators that are not weighed, but there are weighed nodes (Conv) below Resize:
We would advise you to either use another model, or use other Kneron devices such as KL720.