Does KL520 support the darknet backbone?

edited February 2021 in AI Model migration

After generating models and use "DME" to check my model performance, I found the result of the prediction different from the original model. (First image: Original model, Second image: After convert model)

I think the problem is the upsample layer not support in the KL520 structure.

So, I delete this node in my ONNX file.

In the third image is my cutting node position.

Model convertor environment:
Python 3.5
Tensorflow 1.15.3
PyTorch 1.2.0+cpu
ONNX 1.4.1

Steps:
1.Using pytorch convert darknet Weights file to onnx
2.Using pytorch2onnx.py
3.Using editor.py to remove nodes
4.Using onnx2onnx.py
5.Using fpAnalysiscompiler.py

DME config:
Dme_Cfg.model_id = 19;
Dme_Cfg.output_num = 1;
Dme_Cfg.image_col = 640;
Dme_Cfg.image_row = 480;
Dme_Cfg.image_ch = 3;
Dme_Cfg.image_format = (uint)(KdpPixelFormat.IMAGE_FORMAT_RIGHT_SHIFT_ONE_BIT | KdpPixelFormat.NPU_FORMAT_RGB565);


Comments

  • We support darknet, and our tool did support by moving the upsample layer to the cpu node. It should be correct since we have verified many times. The difference between two images should be due to the threshold value. Since the floating point and fixed point result would be different, you should try to adjust the threshold after you experiment with some target images. Usually, you have to lower the threshold. Please note that the fix and floating results would not always the same. the best measurement method is to run a test data set with fixed results and measure MAP and F1 score.

  • @kidd HI,

    Where could I found to set threshold value or you mean detection threshold?

    Both of them were set "0.1f" to detect.

  • edited February 2021

    By the way, my output model is no upsample node.

    Because I can not bypass to fpAnalysiscompiler when I keep this node.

    So, I'm not sure this operation relates to the accuracy.

  • In latest version of toolchain, we provided a python api for model inference. You can compare your onnx model and nef model through the api "kneron_inference()". For more detail, please refer to the link below.


The discussion has been closed due to inactivity. To continue with the topic, please feel free to post a new discussion.