Install MNN on Jetson Nano - Q-engineering
Q-engineering
Q-engineering
Go to content
images/empty-GT_imagea-1-.png
Install MNN software on Jetson Nano

Install MNN deep learning framework on a Jetson Nano.

Introduction.

This page will guide you through the installation of Alibaba's MNN framework on a Jetson Nano. Because the MNN framework targets mobile devices, like Android phones, it has no CUDA support. However, most Android phones use the Vulkan API for low-level access to their GPU's. The MNN framework cleverly utilizes Vulkan, OpenGL and OpenGL ES routines to accelerate the convolutions of a deep learning model. The Jetson Nano has Vulkan support which MNN will be using. More information about the software structures can be found here and here. The given C ++ code examples are written in the Code::Blocks IDE for the Nano. We only guide you through the basics, so in the end, you can build your application. For more information about the MNN library, see https://github.com/alibaba/MNN. Perhaps unnecessarily, but the installation is the C ++ version. It is not suitable for Python.
Dependencies.
The MNN framework has a few dependencies. It requires protobuf. OpenCV is being used for building the C++ examples and is not needed for MNN. The installation of MNN on a Jetson Nano with a Linux Tegra operating system begins as follows.
# check for updates
$ sudo apt-get update
$ sudo apt-get upgrade
# install dependencies
$ sudo apt-get install cmake wget
$ sudo apt-get install libprotobuf-dev protobuf-compiler
$ sudo apt-get install libglew-dev
Before you can compile the MNN software, there is one thing to be done. The MNN Vulkan interface uses the OpenGL ES 3.0 library. It is a low-level graphics rendering interface for Android. Luckily it is backwards compatible with the version 2.0 library found in the JetPack 4.4 on your Jetson Nano. And, as far as we know, the MNN framework doesn't use any unique version 3.0 calls. It makes it possible to use a symbolic link redirecting libGLES3.0 to libGLES2.0. This strategy works very well and relieves you from a cumbersome installation of version 3.0.
# make symlink
$ sudo ln -s /usr/lib/aarch64-linux-gnu/libGLESv2.so /usr/lib/aarch64-linux-gnu/libGLESv3.so

Installation.

With the dependencies installed, the library and converter tools can be built.
# download MNN
$ wget -O mnn.zip https://github.com/alibaba/MNN/archive/master.zip
$ unzip mnn.zip
$ mv MNN-master mnn
$ rm mnn.zip
# common preparation
$ cd mnn
$ ./schema/generate.sh
# install MNN
$ mkdir build
$ cd build
# generate build script
$ cmake -DCMAKE_BUILD_TYPE=Release \
        -DMNN_BUILD_QUANTOOLS=ON \
        -DMNN_BUILD_CONVERTER=ON \
        -DMNN_OPENCL=ON \
        -DMNN_OPENGL=ON \
        -DMNN_VULKAN=ON \
        -DMNN_BUILD_DEMO=ON \
        -DMNN_BUILD_BENCHMARK=ON ..
LibBuildMNN

Time to build the library and install it in the appropriate folders.
# build MNN (± 25 min)
$ make -j4
$ sudo make install
Make_MNN_Jetson

And after sudo make install.

MNN_build_rdy

If everything went well, you have the following folders on your Raspberry Pi 4.

MNN_include

MNN_lib



Please note also the folder with the examples.



If you like to download some example deep learning models, use the commands below.
# download some models
$ cd ~/mnn
$ ./tools/script/get_model.sh
Github C++ example
Install 64 OS
Install 32 OS
Raspberry and alt
Raspberry Pi 4
Jetson Nano
Back to content