Skip to content

AI Model Conversion Environment Setup Guide

1. Overview

Setting up the model conversion environment is a prerequisite for converting AI models into RKNN format. This document describes how to deploy the rknn-toolkit2 Docker image to an Ubuntu 20.04 environment and start the model conversion tool runtime environment in Docker.

The overall flow is as follows.

StepDescription
1Download the model conversion tool
2Move the Docker image to the Ubuntu 20.04 environment
3Load the Docker image
4Enter the bash environment and verify the RKNN libraries

2. Download the Model Conversion Tool

To run the model conversion tool properly, download the following Docker image.

Download link:

https://dl.dragonwake.com/download/rv1126b/AI/images/rknn-toolkit2-v2.3.2-cp38-docker.tar.gz

3. Move the Tool to Ubuntu 20.04

Move the downloaded Docker image to the rknn-toolkit directory on Ubuntu 20.04.

Model conversion environment setup flow

Reference image: Place the Docker image in the rknn-toolkit directory.

4. Start the Model Conversion Tool Environment

After placing the Docker image, start the model conversion tool environment by following the steps below.

4.1 Open a Terminal

Open a terminal in the directory where the Docker image is located.

Docker image

4.2 Load the Docker Image

Run the following command to load the Docker image of the model conversion tool.

Terminal window
docker load --input rknn-toolkit2-v2.3.2-cp38-docker.tar.gz

4.3 Enter the Bash Environment of the Image

Run the following command to enter the bash environment of the Docker image.

Terminal window
docker run -t -i --privileged -v /dev/bus/usb:/dev/bus/usb -v /home/developer/rknn-toolkit2/model_convert_test:/test rknn-toolkit2:2.3.2-cp38 /bin/bash

After execution, you can enter the root shell inside the container.

Docker shell

Next, enter python to start the Python environment. Then verify that the RKNN-related libraries can be imported.

python
>>> import rknn

Docker Python

The model conversion tool environment setup is now complete.