Method for off-line realization of Ruycore micro end side model conversion on Windows system
By enabling WSL2 and installing the RKNN conversion tool on a Windows system, offline conversion of Rockchip's client-side models was achieved. This solved the problems of strong environment dependence and online deployment limitations, met the needs of scenarios with high security requirements, and improved the efficiency and security of model conversion.
Patent Information
- Application Number
- CN202511095885.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-11-21
AI Technical Summary
Existing technologies cannot achieve offline deployment of Rockchip's client-side model conversion on Windows systems, and they suffer from strong environmental dependence, online deployment limitations, and data security risks, failing to meet the needs of scenarios with high security requirements.
By enabling WSL2, an offline WSL2 installation package is installed on the Windows system, a specified version of the Linux distribution package is installed, and the RKNN transformation tool is installed on the Linux system. The transformation program is written and packaged, and finally the RKNN transformation tool is called offline in the Windows environment to achieve model transformation.
It enables Rockchip client-side model conversion in the absence of network connectivity, simplifies the model conversion process, facilitates tool migration and rapid deployment, and improves security and efficiency.
Smart Images

Figure CN120994209A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, specifically to a method for offline implementation of Rockchip client-side model conversion on a Windows system. Background Technology
[0002] With the rapid development of edge AI applications, Rockchip's RKNN toolchain has become a core tool for deploying neural network models adapted to its chips. It supports converting models from frameworks such as PyTorch and MXNet into the dedicated RKNN format for efficient execution on edge devices, and even supports the edge deployment of large language models. However, existing model conversion solutions have the following significant limitations:
[0003] First, it has strong environmental dependence. RKNN-Toolkit needs to run on a Linux system, and Windows users need to rely on a virtual machine or dual system, which is complex to configure and has performance loss.
[0004] Second, online deployment limitations: Although RKNN-Toolkit supports graphical interface (GUI) and Docker deployment to improve ease of use, its installation and updates still require an internet connection to download dependency packages, which cannot meet the offline needs of industrial control and security scenarios.
[0005] Third, there is a lack of existing offline solutions. Patent CN202311769341 proposes a model conversion method based on cloud services, which completes model optimization through a remote server. However, this solution relies entirely on network connection and cannot run in an offline environment, and there are data security risks.
[0006] Especially in scenarios with high security requirements, model conversion needs to be completed entirely offline, but current technologies lack solutions for end-to-end offline conversion on Windows systems. Although the Windows Subsystem for Linux (WSL) can run a Linux environment, its kernel installation, distribution package updates, and RKNN toolchain deployment all require real-time internet access, causing offline scenarios to fail. Therefore, there is an urgent need for a network-free, WSL-based encapsulated conversion method to achieve secure and efficient offline model deployment. Summary of the Invention
[0007] The purpose of this invention is to provide a method for offline implementation of Rockchip client-side model conversion on a Windows system, which solves the problems mentioned in the background art.
[0008] To achieve the above objectives, the present invention provides the following technical solution: a method for offline implementation of Rockchip client-side model conversion on a Windows system, comprising the following steps:
[0009] Step 1: Enable WSL functionality in the Windows environment and install the offline installer for WSL2;
[0010] Step 2: Install the Linux system by running the installation package for the specified Linux distribution.
[0011] Step 3: Install the RKNN conversion tool on the Linux system, write the RKNN conversion program, and package it into an executable program;
[0012] Step 4: Package the Linux distribution containing the RKNN conversion program;
[0013] Step 5: Enable WSL in the Windows environment, install the offline installation package from Step 1, and install or upgrade WSL2;
[0014] Step Six: Install the WSL distribution package and RKNN conversion tool offline;
[0015] Step 7: Use the RKNN conversion tool offline to perform model conversion;
[0016] Steps five through seven are all deployed offline and do not rely on the internet.
[0017] Furthermore, enabling WSL functionality in step one further includes:
[0018] Run PowerShell as administrator and enable WSL functionality in the command group.
[0019] Installing the offline WSL2 installation package in step one further includes:
[0020] Run PowerShell as administrator and execute the command wsl--update to install WSL2;
[0021] If WSL2 is already installed, execute the command to check the WSL2 kernel version on GitHub and download the corresponding offline installation package wsl.xxxxx64.msi.
[0022] Furthermore, the instruction group includes the following two instructions:
[0023] Enable-WindowsOptionalFeature-Online-FeatureName Microsoft-Windows-Subsystem-Linux-NoRestart-ErrorAction Stop|Out-Null;
[0024] Enable-WindowsOptionalFeature-Online-FeatureNameVirtualMachinePlatform-NoRestart-ErrorAction Stop|Out-Null.
[0025] Furthermore, in step two, the command to install the specified version of the Linux distribution package is: wsl--install--distribution <distroname>,in <distroname>The name of the Linux distribution package to be installed.
[0026] Furthermore, the installation of the RKNN toolchain and the encapsulation of the RKNN conversion program on the Linux system in step three further includes:
[0027] Install cmake, gcc, g++, and mini-conda sequentially on the Linux system;
[0028] Then, create a new virtual environment in mini-conda:
[0029] Install the rknn-toolkit2 toolchain in the newly created virtual environment, and write Python code for RKNN model transformation;
[0030] Use PyInstaller to encapsulate the above Python code and generate... <rknntranspack>The .exe executable file and its corresponding _internal dependency folder.
[0031] Furthermore, in step four, packaging the Linux distribution containing the RKNN conversion program further includes:
[0032] Use the command wsl--terminate <distroname>Close the distribution instance created in step three;
[0033] Execute the command wsl--export <distroname> <savepath>Export the distribution instance containing the RKNN transformation tool created in step three;
[0034] in, <savepath>This is the path name for storing the packaged distribution instance; the file ends with .tar.
[0035] Furthermore, enabling WSL functionality in the Windows environment in step five further includes: enabling WSL functionality using the command group; opening PowerShell as administrator to install the offline installation package from step one, installing or upgrading WSL2, and executing the following code:
[0036] Start-Process msiexec -Verb RunAs-ArgumentList" / i`"wsl.xxxxx64.msi`" / quiet / norestart"-PassThru-Wait-ErrorAction Stop.
[0037] Furthermore, the instruction group includes the following two instructions:
[0038] Enable-WindowsOptionalFeature-Online-FeatureName Microsoft-Windows-Subsystem-Linux-NoRestart-ErrorAction Stop|Out-Null;
[0039] Enable-WindowsOptionalFeature-Online-FeatureNameVirtualMachinePlatform-NoRestart-ErrorAction Stop|Out-Null.
[0040] Furthermore, the offline installation of the WSL distribution package and RKNN conversion tool in step six further includes:
[0041] Run the command wsl--import <distroinstallname> <installpath> <savepath>;
[0042] in, <distroinstallname>It's the name of the WSL distribution after installation. <installpath>This is the path to the installed WSL distribution. <savepath>Yes, it is the offline distribution package packaged in step four.
[0043] Furthermore, in step seven, the offline invocation of the RKNN conversion tool to achieve model conversion further includes:
[0044] Run the command: `source / etc / profile && source ~ / .bashrc && cd / home / {EXE_PATH} / && chmod 777` <onnx2rknn>.exe&&. / <onnx2rknn>.exe{ONNX_PATH}{TXT_PATH}
[0045] Where {EXE_PATH} is the conversion program in step three. <onnx2rknn>The path to the .exe file, {ONNX_PATH} is the path to the ONNX model to be converted, and {TXT_PATH} is the data used for model quantization.
[0046] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0047] This invention facilitates the automation of Rockchip's edge model conversion by enabling WSL2, installing the WSL2 system, installing the RKNN conversion tool, and completing the edge model conversion process all through commands. Furthermore, it packages the Rockchip edge model conversion tool as a whole, simplifying the edge model conversion process and making it easier to migrate and quickly deploy the edge model conversion tool. Attached Figure Description
[0048] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0050] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "horizontal," "vertical," "top," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations of the invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0051] Please see Figure 1 The present invention provides an embodiment of a method for offline implementation of Rockchip client-side model conversion on a Windows system, comprising a first stage and a second stage, to achieve offline model conversion of the Rockchip client-side model, hereinafter referred to as RKNN;
[0052] Phase One requires an online Windows system environment and includes steps one through four. Further details are needed.
[0053] Step 1: In the Windows environment, run PowerShell as administrator, execute the command group to enable WSL functionality, and install the offline installer for WSL2;
[0054] Run the command as administrator to open PowerShell and execute the command group, which contains:
[0055] Enable-WindowsOptionalFeature-Online-FeatureName Microsoft-Windows-Subsystem-Linux-NoRestart-ErrorAction Stop|Out-Null; Enables the Linux Subsystem (WSL) feature for the currently running Windows system without restarting the system. If an error occurs during execution, it terminates immediately and hides all output.
[0056] The command execution results in the following: Activating Windows' underlying WSL support; subsequent operations require manual handling; the system prompts for a restart, which must be completed manually; the WSL2 kernel installation (wsl--update) must continue, and it is applicable to enterprise security management environments and automated deployment scripts. Further of the above tasks must be run in PowerShell with administrator privileges.
[0057] Enable-WindowsOptionalFeature-Online-FeatureNameVirtualMachinePlatform-NoRestart-ErrorAction Stop|Out-Null; Enables virtual machine platform features (Hyper-V underlying support) for the current Windows system without requiring a system restart. If any error occurs during execution, it will immediately abort and discard all command line output.
[0058] The two instructions in the instruction set are a mandatory combination in the WSL2 environment. Neither can be omitted, and the subsystem must be executed before the virtual machine platform. The second instruction requires the CPU to support VT-x / AMD-V technology.
[0059] Furthermore, run PowerShell as administrator and execute the command `wsl --update` to install WSL2. Once WSL2 is installed, execute the command to check the WSL2 kernel version on GitHub and download the corresponding offline installation package `wsl.xxxxx64.msi`.
[0060] Step 2: Install the Linux system and run the installation program to install the specified version of the Linux distribution package:
[0061] Execute the command: wsl--install--distribution <distroname>Install the specified version of the Linux distribution package, among which <distroname>The name of the Linux distribution package to be installed.
[0062] Step 3: Install the RKNN conversion tool on the Linux system, write the RKNN conversion program, and package it as an executable program:
[0063] Install cmake, gcc, g++, and mini-conda sequentially on the Linux system. Then, create a new virtual environment in mini-conda and install the rknn-toolkit2 toolchain and write Python code for RKNN model conversion within this virtual environment. Use pyinstaller to package the Python code and generate... <rknntranspack>The .exe executable file and its corresponding _internal dependency folder.
[0064] Step 4: Package the Linux distribution containing the RKNN conversion program;
[0065] Use the command wsl--terminate <distroname>Close the distribution instance created in step three; execute the command wsl--export <distroname> <savepath>Export the distribution instance containing the RKNN transformation tool created in step three.
[0066] in, <savepath>This is the path name for storing the packaged distribution instance; the file ends with .tar.
[0067] Phase 2 requires offline deployment and does not rely on the Internet. Phase 2 includes steps 5 and 6.
[0068] Step 5: Enable WSL in the Windows environment, install the offline installation package from Step 1, and install or upgrade WSL2:
[0069] Enable WSL functionality using the command group; open the offline installer package from step one of PowerShell installation as an administrator, install or upgrade WSL2, and execute the following code:
[0070] The `Start-Process msiexec-Verb RunAs-ArgumentList" / i`"wsl.xxxxx64.msi`" / quiet / norestart"-PassThru-Wait-ErrorAction Stop` command silently installs the WSL2 kernel offline installer (wsl.xxxxx64.msi) at the specified path with administrator privileges, without triggering a system reboot, and monitors the installation process status in real time. If any errors occur during the installation process (such as file corruption / insufficient permissions), execution will terminate immediately.
[0071] The instruction group executed in step five is the same as the instruction group in step one.
[0072] Step Six: Offline installation of the WSL distribution package and RKNN conversion tool:
[0073] Run the command wsl--import <distroinstallname> <installpath> <savepath>Install the pre-exported WSL distribution package (.tar file) as a new Linux subsystem instance, specifying the instance name and storage location.
[0074] in, <distroinstallname>It's the name of the WSL distribution after installation. <installpath>This is the path to the installed WSL distribution. <savepath>Yes, it is the offline distribution package packaged in step four.
[0075] Furthermore, in step seven, the offline invocation of the RKNN conversion tool to achieve model conversion further includes:
[0076] Run the command: `source / etc / profile && source ~ / .bashrc && cd / home / {EXE_PATH} / && chmod 777` <onnx2rknn>.exe&&. / <onnx2rknn>.exe{ONNX_PATH}{TXT_PATH}; loads the system-level environment variable configuration file / etc / profile and the user-level bash configuration file ~ / .bashrc; then switches to the directory / home / {EXE_PATH} / ; then... <onnx2rknn>Change the permissions of the .exe file to 777 (meaning all users have read, write, and execute permissions); finally, execute the file in the current directory. <onnx2rknn>The program generates an .exe file and passes in the parameters {ONNX_PATH} and {TXT_PATH} to complete the RNKK model conversion.
[0077] Where {EXE_PATH} is the conversion program in step three. <onnx2rknn>The path to the .exe file, {ONNX_PATH} is the path to the ONNX model to be converted, and {TXT_PATH} is the data used for model quantization.
[0078] This technical solution uses instructions to complete the WSL2 activation, WSL2 system installation, RKNN conversion toolchain installation, and terminal model conversion process, which helps to automate Rockchip's terminal model conversion.
[0079] This technical solution simplifies the edge model conversion process by packaging the Rockchip edge model conversion tool as a whole, making it easier to migrate and quickly deploy the edge model conversion tool.
[0080] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims. < / savepath> < / installpath> < / distroinstallname> < / savepath> < / installpath> < / distroinstallname> < / savepath> < / savepath> < / distroname> < / distroname> < / rknntranspack> < / distroname> < / distroname> < / savepath> < / installpath> < / distroinstallname> < / savepath> < / installpath> < / distroinstallname> < / savepath> < / savepath> < / distroname> < / distroname> < / rknntranspack> < / distroname> < / distroname>
Claims
1. A method for offline implementation of Rockchip client-side model conversion on a Windows system, characterized in that: Includes the following steps: Step 1: Enable WSL functionality in the Windows environment and install the offline installer for WSL2; Step 2: Install the Linux system by running the installation package for the specified Linux distribution. Step 3: Install the RKNN conversion tool on the Linux system, write the RKNN conversion program, and package it into an executable program; Step 4: Package the Linux distribution containing the RKNN conversion program; Step 5: Enable WSL in the Windows environment, install the offline installation package from Step 1, and install or upgrade WSL2; Step Six: Install the WSL distribution package and RKNN conversion tool offline; Step 7: Use the RKNN conversion tool offline to perform model conversion; Steps five through seven are all deployed offline and do not rely on the internet.
2. The method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 1, characterized in that: Enabling WSL functionality in step one further includes: Run PowerShell as administrator and enable WSL functionality in the command group. Installing the offline WSL2 installation package in step one further includes: Run PowerShell as administrator and execute the command wsl--update to install WSL2; If WSL2 is already installed, execute the command to check the WSL2 kernel version on GitHub and download the corresponding offline installation package wsl.xxxxx64.msi.
3. The method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 2, characterized in that: The instruction group contains the following two instructions: Enable-WindowsOptionalFeature-Online-FeatureName Microsoft-Windows-Subsystem-Linux-NoRestart-ErrorAction Stop|Out-Null; Enable-WindowsOptionalFeature-Online-FeatureName VirtualMachinePlatform-NoRestart-ErrorAction Stop|Out-Null.
4. The method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 1, characterized in that: In step two, the command to install the specified version of the Linux distribution package is: wsl--install--distribution <distroname>,in <distroname> The name of the Linux distribution package to be installed.< / distroname> < / distroname> 5. The method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 1, characterized in that: Step three, installing the RKNN toolchain and packaging the RKNN conversion program on the Linux system, further includes: Install cmake, gcc, g++, and mini-conda sequentially on the Linux system; Then, create a new virtual environment in mini-conda: Install the rknn-toolkit2 toolchain in the newly created virtual environment, and write Python code for RKNN model transformation; Use PyInstaller to encapsulate the above Python code and generate... <rknntranspack> The .exe executable file and its corresponding _internal dependency folder.< / rknntranspack> 6. The method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 1, characterized in that: Step four further includes packaging the Linux distribution containing the RKNN conversion program, including: Use the command wsl--terminate <distroname> Close the distribution instance created in step three;< / distroname> Execute the command wsl--export <distroname> <savepath>Export the distribution instance containing the RKNN transformation tool created in step three;< / savepath> < / distroname> in, <savepath> This is the path name for storing the packaged distribution instance; the file ends with .tar.< / savepath> 7. The method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 1, characterized in that: Step five, enabling WSL in the Windows environment, further includes: using the command group to enable WSL; opening PowerShell as administrator to install the offline installer from step one, installing or upgrading WSL2, and executing the following code: Start-Process msiexec -Verb RunAs-ArgumentList" / i`"wsl.xxxxx64.msi`" / quiet / norestart"-PassThru-Wait-ErrorAction Stop.
8. The method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 6, characterized in that: The instruction group contains the following two instructions: Enable-WindowsOptionalFeature-Online-FeatureName Microsoft-Windows-Subsystem-Linux-NoRestart-ErrorAction Stop|Out-Null; Enable-WindowsOptionalFeature-Online-FeatureName VirtualMachinePlatform-NoRestart-ErrorAction Stop|Out-Null.
9. The method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 1, characterized in that: The offline installation of the WSL distribution package and RKNN conversion tool in step six further includes: Run the command wsl--import <distroinstallname> <installpath> <savepath> ;< / savepath> < / installpath> < / distroinstallname> in, <distroinstallname>It's the name of the WSL distribution after installation. <installpath>This is the path to the installed WSL distribution. <savepath> Yes, it is the offline distribution package packaged in step four.< / savepath> < / installpath> < / distroinstallname> 10. A method for offline implementation of Rockchip client-side model conversion on a Windows system according to claim 1, characterized in that: Step seven, which involves offline invocation of the RKNN transformation tool to perform model transformation, further includes: Run the command: `source / etc / profile && source ~ / .bashrc && cd / home / {EXE_PATH} / && chmod 777` <onnx2rknn>.exe&&. / <onnx2rknn> .exe{ONNX_PATH}{TXT_PATH}< / onnx2rknn> Where {EXE_PATH} is the conversion program in step three. <onnx2rknn> The path to the .exe file, {ONNX_PATH} is the path to the ONNX model to be converted, and {TXT_PATH} is the data used for model quantization.< / onnx2rknn>
Citation Information
Patent Citations
Method for sharing GPU on Windows system as edge computing AI reasoning node
CN117762524A