Skip to content
How to run Keras model on RK3399Pro
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
.gitignore
LICENSE
README.md
benchmark_incption_v3.py
convert_rknn.py
dataset.txt
freeze_graph.ipynb
freeze_graph.py add freeze_graph.py, edit readme May 2, 2019
requirements.txt

README.md

Run Keras/Tensorflow model on RK3399Pro

Clone or download this repo

git clone https://github.com/Tony607/Keras_RK3399pro

Download pre-compiled Python wheel files from my aarch64_python_packages repo and rknn_toolkit wheels from their official GitHub.

Step1: Freeze Keras model and convert to RKNN model (On Linux development machine)

Require Python 3.5+.

Install required libraries for your development machine

pip3 install -r requirements.txt

The install rknn toolkit with the following command.

pip3 install rknn_toolkit-0.9.9-cp36-cp36m-linux_x86_64.whl

To freeze a Keras InceptionV3 ImageNet model to a single .pb file. The frozen graph will accept inputs with shape (N, 299, 299, 3).

freeze_graph.py

To convert the .pb file to .rknn file, run

python3 convert_rknn.py

Step2: Make prediction (On RK3399Pro board)

Setup for the first time.

sudo dnf update -y
sudo dnf install -y cmake gcc gcc-c++ protobuf-devel protobuf-compiler lapack-devel
sudo dnf install -y python3-devel python3-opencv python3-numpy-f2py python3-h5py python3-lmdb
sudo dnf install -y python3-grpcio

sudo pip3 install scipy-1.2.0-cp36-cp36m-linux_aarch64.whl
sudo pip3 install onnx-1.4.1-cp36-cp36m-linux_aarch64.whl
sudo pip3 install tensorflow-1.10.1-cp36-cp36m-linux_aarch64.whl
sudo pip3 install rknn_toolkit-0.9.9-cp36-cp36m-linux_aarch64.whl

To run inference benchmark on RK3399Pro board, in its terminal run,

python3 benchmark_incption_v3.py
You can’t perform that action at this time.