Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⭐ Some useful advice that may help you ⭐ #274

Open
zen-xingle opened this issue Jul 26, 2022 · 4 comments
Open

⭐ Some useful advice that may help you ⭐ #274

zen-xingle opened this issue Jul 26, 2022 · 4 comments

Comments

@zen-xingle
Copy link

zen-xingle commented Jul 26, 2022

RKNN-Toolkit:

  1. Is there a simple Capi demo that works on my model?
    Yeah. Please try this https://github.com/airockchip/rknn_model_zoo/tree/main/common/rknn_converter.

  2. For yolov5,yolov7,yolox, please refer here : https://github.com/airockchip/rknn_model_zoo/tree/main/models/CV/object_detection/yolo

  3. For loading already quantized model, refer here: https://github.com/rockchip-linux/rknn-toolkit/tree/master/examples/common_function_demos/load_quantized_model

  4. For how to export a .pt model(torchscript format), refer here: https://github.com/rockchip-linux/rknn-toolkit/blob/master/examples/pytorch/resnet18/test.py

  5. Quantization RKNN model drop accuracy, please refer here: https://github.com/rockchip-linux/rknn-toolkit/tree/master/examples/common_function_demos/accuracy_analysis

  6. Model got error when setting rknn.build(precompile=True)? Please try this way: https://github.com/rockchip-linux/rknn-toolkit/tree/master/examples/common_function_demos/export_rknn_precompile_model

  7. Want to using Python api on board (such as rk1808/rv1126/rv1109/rk3399pro)? Using PC(x86) to generate RKNN model, and the using RKNN-Toolkit-lite for deplotment. https://github.com/rockchip-linux/rknn-toolkit/tree/master/rknn-toolkit-lite/packages

  8. Pytorch version higher than RKNN-Toolkit requires? There are two way to do this:
    First way: Install RKNN-Toolkit first. Then "pip uninstall torch". Then "pip install torch==1.10.0"
    Second way: Install Pytorch first like "pip install torch==1.10.0". Then "pip install rknn-toolkit.whl --no-deps"

  9. Other format data instead of image(lile jpg/png etc.)? The npy format is also accept for quantize model. NOTICE! If your npy data is 4D, then the layerout of the data should be "nhwc"! If dims not equal to 4D, then the raw data is ok.

Please tell us if anything confuse you.

@airockchip airockchip pinned this issue Jul 27, 2022
@zen-xingle
Copy link
Author

zen-xingle commented Jul 27, 2022

RKNPU(Capi)

  1. For RK1808/RV1109/RV1126, refer here https://github.com/rockchip-linux/rknpu

  2. For RK3399pro, refer here https://github.com/rockchip-linux/RKNPUTools (This respository was old, the newer one is coming )

@zen-xingle
Copy link
Author

zen-xingle commented Aug 1, 2022

About rknn.init_runtime with devices connected

  1. Init Failed
    There could be many reasons for the failure of the rknn.init_runtime. Normally it only returns a short code or description. To obtained more information about the failure, you can try to connect the devices with the serial port. Type in this code

export RKNN_SERVER_LOG_LEVEL=5
export RKNN_LOG_LEVEL=5
export TRANSFER_LOG_LEVEL=5

Then restart the rknn server

restart_rknn.sh
or
find / -name rknn_server
find the path of server file. Kill the 'rknn_server' process manually and then {your_path}/rknn_server &

Then try to init_runtime with your model again. The error reason is supposed to be printed on the serial port terminal.

  1. If serial port not available
    The rknn_server log information is only available on the serial port. If there is any reason that you can't connect the board serial port. You can try to run the model with the Capi. Capi log is both available on ADB port and serial port. Before invoking with the model, set the environment as follows:

export RKNN_LOG_LEVEL=5

  1. Python API Inference speed is lower than rknn capi
    Yes. If you have higher requirement for inference speed, the Capi is the better to achieve it. RKNN python api is convenient but slower than Capi.

@NickM-27
Copy link

NickM-27 commented Aug 9, 2022

This was helpful thank you, do you have any advice or insight on a way to use this with python 3.9 (trying to avoid using venvs)? Haven't tried just using it so perhaps it will work as with previous versions

@zen-xingle
Copy link
Author

This was helpful thank you, do you have any advice or insight on a way to use this with python 3.9 (trying to avoid using venvs)? Haven't tried just using it so perhaps it will work as with previous versions

Sorry, at this time only python 3.6/3.8 is supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants