MNN - Q-engineering
Q-engineering
Q-engineering
Go to content
images/empty-GT_imagea-1-.png
Install MNN software on Raspberry Pi 5

Install MNN deep learning framework on a Raspberry Pi 5.


Last updated: May 18, 2024

Introduction.

This page guides you through the installation of Alibaba's MNN framework on a Raspberry Pi 5. 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 used for building the C++ examples and is not needed for MNN.
# 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

Installation.

With the dependencies installed, the library and converter tools can be built.
# download MNN
$ git clone --depth=1 https://github.com/alibaba/MNN.git
# common preparation (installing the flatbuffers)
$ cd MNN
$ ./schema/generate.sh
# install MNN
$ mkdir build
$ cd build
# generate build script
$ cmake -D CMAKE_BUILD_TYPE=Release \
        -D MNN_OPENMP=ON \
        -D MNN_ARM82=ON \
        -D MNN_USE_THREAD_POOL=OFF \
        -D MNN_BUILD_QUANTOOLS=ON \
        -D MNN_BUILD_CONVERTER=ON \
        -D MNN_BUILD_DEMO=ON \
        -D MNN_BUILD_BENCHMARK=ON ..
# build MNN (± 10 min)
$ make -j4
$ sudo make install
MNN_Build_Ready_RPi5

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

MNN_include

MNN_lib_RPi5

MNN_convert

Please note also the folder with the examples.

MNN_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
Deep learning software for Raspberry Pi
Deep learning examples for Raspberry Pi
images/GithubSmall.png
images/YouTubeSmall.png
images/SDcardSmall.png
Back to content