Install TNN deep learning framework on a Raspberry Pi 4.
Last updated: April 21, 2022
This page will guide you through the installation of Tencent's TNN framework on a Raspberry Pi 4. The given C ++ code examples are written in the Code::Blocks IDE for the Raspberry Pi 4. We only guide you through the basics, so in the end, you can build your application. For more information about the TNN library, see: https://github.com/Tencent/TNN. Perhaps unnecessarily, but the installation is the C ++ version. It is not suitable for Python.
The TNN framework has no dependencies that need to be pre-installed. OpenCV would be useful, but not necessary.
Please check your operating system before installing ncnn on your Raspberry Pi 4. Run the command getconf LONG_BIT and verify your version.
In case of a 64-bit operating system, please check also your C++ compiler with the command gcc -v. It must also be an aarch64-linux-gnu version. In case of a different gcc version, reinstall the whole operating system with the latest version. The guide is found here: Install 64 bit OS on Raspberry Pi 4. You must have a 64-bit C ++ compiler as we are going to build the ncnn libraries.
Also note the zram swap size of more than 3 Gbyte after installation according to our instructions.
If everything went well, you will get two folders. One with all header files and one with the library as shown in the screen dumps.
Please note also the folder with the examples. Many different types of deep learning are covered here.