Sipeed Maix-II SoM and Devboard for AI/IoT/Machine Learning

Linux, Python 3.8.5, ResNet18 at 20 FPS – Jetson Nano alternative for 7.9 USD?

Original article published on Hackster.io by Dmitry Maslov.

In this article I’m going to tell you about the newest and latest development kit and SoM for AIoT – Sipeed MAIX II.

Viewers of my channel and people who are following the developments of hardware for AI on the Edge are familiar with MAIX I board series – these are various K210 based boards, I have reviewed and made tutorials about on Seeed blog and on my channel.

K210 is a good solid chip for performing vision and audio ML tasks in situations when power consumption and footprint are of concern. It does have its own disadvantages though – namely small amount of RAM available, which constraints both the image resolution and maximum size of networks that can be run on the chip. If you’re detecting/recognizing object that is up close, that won’t be an issue. But low resolution and model size limitation can impact performance when detecting smaller objects, for example faces in the crowd form a distance. Likewise, proper OCR or open-domain speech recognition are hard to implement, when model size is limited to about 2.5-3Mb.

MAIX II dev board and SoM based on Allwinner V831 chip aims to eliminate these problems and allow users to run larger models on a higher resolution image input.

Allwinner V831 AI Camera SoC

The dev kit consists of reference carrier board, a screen, a camera and an SoM.

Let’s have a look at the specs of new module and compare them both to old MAIX I(k210) core module and Nvidia Jetson Nano 2Gb module specs.

To summarize, MAIX I (K210) was and still is a good cheap alternative to Raspberry Pi – if you only care about ML inference applications, and new MAIX II is aiming to be a good cheap alternative to Jetson Nano. If you think this comparison is far-fetched, forget for a moment about all the things Raspberry Pi and Jetson Nano are good for as SBCs (personal computer replacement, retro video game console, network/cloud storage attached device, etc) and think about it purely from ML on the Edge application standpoint.

Raspberry Pi 4 can fork out 13-15 FPS running MobileNet2 SSD with input resolution 300×300 – that’s maximum possible FPS currently with 64bit OS and Tensorflow Lite Thread acceleration enabled. It will consume close to maximum power while performing the inference on all 4 cores and the cheapest you can get it is 25 USD for SoM. MAIX I (K210) easily processes 320×240 video stream with MobileNet object detection network at around 15 -17 FPS and can achieve better speeds if using YOLOv2 backbone network instead and/or switching to using C++ instead of Micropython. No Raspberry Pi, nor K210 boards are suitable for running larger networks, such as ResNet18 or performing image processing/audio processing with ML simultaneously.

Here is where MAIX II comes in – while it’s ML inference accelerator has same processing speed (0.2 TOPS) as K210 KPU, it has more RAM and thus able to easily run ResNet18 or MobileNet + speech transcription model at the same time. It also supports MIPI interface for image input and thus provides better resolution and picture quality, up to 1080P@60fps for two lanes, thus eliminating two main limitations of K210 and bringing this new SoM and dev board closer to Nvidia Jetson series level – that is, again if you only care about ML inference applications and do not plan to have more than two cameras connected. All this at an attractive price point of 7.9 USD for SoM and 28.8 USD for SoM + reference carrier board.

Hardware overview

Watch this part of the video for hardware overview.

MAIX II SoM looks really tiny in comparison with Jetson Nano SoM and Raspberry Pi 4 CM and that’s because it is. There are only a few noteworthy things on top of the module, namely V831 SoC, power supply IC, connectors reserved for optional FLASH chip and M2 key connector to the carrier board.

There is already Hardware Development Kit available for SoM, if you’d like to have a look at detailed schematics and integrate it in your own product.

Now for the reference carrier board – unlike SoM, this thing is packed. It has 3Mp 6mm camera with 1/2.5’’ sensor, 1.3’’ LCD screen, 2 USB Type-C connectors, SD card slot, microphone, speaker, WiFi module, 2 User Configurable buttons and 1 Hard Reset Button and even 3-axis accelerometer.

Still the reference carrier board is quite compact, with dimensions 48.9 * 33.9 * 36.1.

Software overview

Hardware is just plastic and silicon without software to make use of it. How is the situation on that front for MAIX II? MAIX II is meant to offer a (relatively) beginner friendly Linux firmware (based on OpenWRT) adapted for edge computing, users can enjoy a more complete development environment and abundant software resources under LINUX, unlike K210 which only could run Micropython firmware or C++ compiled user code.

As of moment, since MAIX II is brand new, the software environment is pretty much work in progress. There is provides opkg package source for MAIX-Linux, python3.8.5 is installed and default Python version for the system. ML inference and hardware related functions are to be integrated and accessible from MAIX3 pip package.

There is also work to make RPYC-Kernel work with MAIX II, allowing users to connect to board remotely using Jupyter Notebook and execute code in Notebooks, which are so popular among Data Scientists and Machine Learning practitioners.

Getting started

Watch this part of the video for software installation and demo.

Since it’s still early in development I prepared for the worst, when trying new MAIX board software. To my surprise I did not encounter many bugs, although the functions are incomplete at the moment.

To flash latest firmware first install the dependencies – flash tool depends on older version of libpng, which you will need to download and compile yourself.

sudo apt install dkms libtool m4 automake zlib1g-dev
wget http://archive.ubuntu.com/ubuntu/pool/main/libp/libpng/libpng_1.2.54.orig.tar.xz
tar xvf libpng_1.2.54.orig.tar.xz
cd libpng-1.2.54
./autogen.sh
./configure
make -j8
sudo make install

Create the necessary links and cache the most recent shared libraries with

sudo ldconfig

Finally download and install livesuit tool for flashing firmware:

git clone --recursive https://github.com/QinYUN575/allwinner-livesuit.git
cd allwinner-livesuit
chmod +x livesuit_installer.run
sudo ./livesuit_installer.run

And run it with

sudo livesuit

Choose the firmware file, connect MAIX-II (without SD card) with USB Type-C cable. When you see a prompt about formatting the partition, insert SD card and press Yes. The tool will format SD card and flash the firmware into it.

After flash process is finished, connect the USB cable to USB UART and install picocom tool

sudo apt-get install picocom

Then you’ll be able to connect to the board over UART with

sudo picocom -b 115200 /dev/ttyUSB0

From there you can use MAIX-II as a normal Linux development board. I’d suggest to start with connecting the board to WiFi, so you could install the necessary packages directly to the board. For that, execute

vim etc/wpa_supplicant.conf

And edit the SSID and password of WiFi network to match your setup. If something goes wrong – :q! and don’t panic 🙂

After you’re connected to WiFi, update opkg index with

opkg update

and install latest version of MaixPy3 package with

pip3 install maixpy3

Then you can start Jupyter Remote Kernel hook with

python3 -c "from maix import rpycs; rpycs.start()" &

After that, on your local machine install Jupyter notebook and RPYC-kernel for it:

pip3 install notebook
pip3 install rpyc_ikernel && python3 -m rpyc_ikernel.install

Open an example notebook and change the IP address in the first line to actual IP address of your MAIX-II board. Press on execute and you’re connected! Your code in the notebook will be executed on remote machine.

I will be making a full tutorial soon on how to train, convert and run your own neural networks on MAIX-II boards, for now if you’d like to try some examples, you can download and compile samples from here.

Judging from past experience with Sipeed products, if new MAIX board is even mildly popular, the product support will be on par with MAIX I boards – not stellar, but steady and long-term. Here I have to say, as a software developer, that no matter how hard the developers try, the documentation will always be incomplete and a lot of support actually comes from community – for instance, that is Raspberry Pi boards strongest side. So, if you have basic Linux and Python development skills and not afraid of the little challenge when developing ML on the Edge applications, this new board might just the right choice for you.

Do comment on what you think of this new SoM and board – would you like to get one? Do you have application in mind that can benefit from using larger neural networks at affordable price? I’m eager to hear from you!

About Author

1 thought on “Sipeed Maix-II SoM and Devboard for AI/IoT/Machine Learning

  1. Having trouble flashing the firmware.
    1) I launch livesuit
    2) select the firmware image – v831_sipeed_20210203_image
    3) connect the MAIX-II without the SD card installed via the USB-OTG port
    4) a dialog box appears, I insert the SD card
    5) I press yes in the dialog to format.
    6) nothing happens at this point, progress bar does not move.
    I waited 20 minutes and switched to the uart port and tried to connect and nothing responds.
    I’ve tried multiple times, with different SD cards (Sandisk Ultra 32GB and a Lexar 16GB)

    Suggestions?

Comments are closed.

Calendar

January 2021
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031