Overview
I built a small Edge-AI system by combining NXP's i.MX8M Plus and Hailo's AI accelerator Hailo-8.
I summarized the procedure, so if you want a small / high performance / low power consumption AI execution environment, please try it!
<Main products used in this project
・LEC-IMX8MP-QN-4G-32G-ER (SMARC short size module with NXP i.MX 8MPlus, 4G RAM, built-in NPU, extended temperature product (-40°C to 85°C))
https://www.adlinktech.com/Products/Computer_on_Modules/SMARC/LEC-IMX8MP?lang=ja
SMARC module with NXP i.MX8M Plus
・I-Pi SMARC IMX8M Plus
https://www.ipi.wiki/pages/i-pi-smarc-imx8m-plus
This is the Starter Kit for the SMARC module above, including a carrier board.
(The Starter Kit includes a 2GRAM SMARC module, but this time we replaced it with the above 4GRAM SMARC module.)
・Hailo-8 M.2 Module (B+M Key)
https://hailo.ai/product-hailo/hailo-8-m2-module/
M.2 module with AI accelerator from Hailo
Setup procedure
Advance preparation (hardware)
Please follow the link below to assemble the I-Pi SMARC IMX8M Plus.
https://www.ipi.wiki/pages/imx8mp-docs?page=index.html
Next, insert and fix the Hailo-8 M.2 module (B+M key) on the back.
The completed form will look like the picture below.
The carrier board is also 110mm x 110mm, so you can feel how small it is.
Advance preparation (SD card)
This time, we will use the Ubuntu 20.04 image file prepared by ADLINK as the OS.
Click the "+" button for Ubuntu from the link below (display All Releases) and download "LEC-IMX8MP-4G-IPi-SMARC-PLUS-Ubuntu20_04-1v2-20220425.img".
https://www.ipi.wiki/pages/downloads-imx8mplus
Next, prepare a 128G microSD card and write the image file downloaded above.
(Since the size of the demonstration tool provided by Hailo is large, a microSD card of 128G or more is required.)
This time I wrote using Win32DiskImager.
Select the image file on Win32DiskImager, check the microSD card drive, and execute writing with the Write button.
If the writing is successful, the preparation of the microSD card is complete.
Advance preparation (various settings/connections)
Perform the following settings/connections
・Insert the microSD card with the image written into the slot
・Set boot device to microSD card
Set the DIP SW to "0110" as shown in the left photo below.
・Connect to a monitor with an HDMI cable
・Inserting a LAN cable
・USB mouse/keyboard connection
* Only one USB port can be used with the SMARC module used this time.
As shown in the photo on the right, connect the USB Hub to the connector on the bottom left and use it.
Finally connect the power adapter and boot.
If the preparation is successful, the Ubuntu20.04 screen will be displayed on the HDMI monitor as shown below.
(The password on the login screen is "adlink")
Install Hailo related tools
Ubuntu setup
Immediately after writing the Ubuntu image file to the SD card, there is only a little free space left on the SD card.
This time, I expanded the free space by gparted.
sudo apt install gparted
However, a running Process occurred, so I stopped it with the kill command and ran the installation again. I do not know if it will occur every time, but just in case, I will post the screen below, so please refer to it when it occurs.
After installing gparted, start it with sudo gparted.
Select the yellow part in the left figure below and execute Resize by right-clicking. Then, the screen in the middle below will appear, so drag and pull it to the maximum value. After that, it is completed by reflecting it with Edit → Apply All Operations (right figure below)
Next, just in case, I ran sudo apt update and upgrade.
(Upgrading takes a long time...)
Install HailoRT
Next, we will install the Hailo environment.
A brief description of the tools to be installed this time is given below.
HailoRT---Hailo Runtime. A collection of APIs for accessing Hailo's HW and performing inference via HailoRT
Tappas---Demo application for checking various network models
Each can be downloaded from the Hailo Website below, but please note that you will not be able to download it just by registering as a user.
ご興味ございましたら弊社までお問い合わせをお願いします。
https://hailo.ai/developer-zone/sw-downloads/
This time, HailoRT uses Ver4.5.0 and Tappas uses Ver3.16.0.
Now let's move on to installing HailoRT.
Basically, the HailoRT manual is prepared, so it's not difficult if you follow it. I am using the Ubuntu Installer this time.
The following are specified as required packages, so first install them with apt.
• build-essential package (needed to compile the PCIe driver)
• (Optional) bison, flex, libelf-dev and dkms packages (needed to regsiter the PCIe driver using DKMS)
• (Optional) cmake (needed to compile the HailoRT examples)
• (Optional) pip and virtualenv (needed for pyhailort)
A shell script called install.sh is prepared in the download file, so you can easily install it just by executing this.
(The installation screen is shown below on the left)
Reboot after installation and you're done.
As an operation check, when I entered the virtual environment of HailoRT and executed scan, the HW of Hailo was successfully recognized (right figure below).
Install Tappas
Next, Tappas installation is not difficult if you install it according to the manual.
First of all, it is necessary to install Docker, but since it was already installed, I only registered it in the Docker group just in case.
sudo usermod -aG docker $USER
This time, we installed with "Build Docker image by your own" without using pre-built Docker image.
The file to download is small, but it takes time to build the Docker image yourself (actually, I regretted it later...).
In this case, it is necessary to copy the entire HailoRT installation folder to the release folder, and it will look like the following.
After that, we will build and run Docker, but shell scripts (build_docker.sh, run_docker.sh) are prepared for both, so you can easily install without having to type commands yourself.
However, it took about 5 hours to build, so it is recommended to leave it after executing the shell script.
(Since it is an ARM-based CPU, there is no way around this. I would like to consider cross-compiling from the next time.)
When it is finished, the container starts up as shown in the left figure below, and when you actually run Tappas, you can check the operation as shown in the right figure below.
Summary
We aimed to build an Edge-AI system based on an ARM microcomputer that is compact and inexpensive, but does not compromise on performance.
The AI performance of this system is introduced in the video. Please check this link if you are interested.
Thank you for reading this article.
Inquiry
If you have any questions regarding this article, please contact us below.
Hailo manufacturer information Top
If you want to return to Hailo manufacturer information top page, please click below.