Deploying SSCMA on Grove - Vision AI
A computer with Linux or Windows (WSL) (this example uses Ubuntu 20.04)
A USB cable
Installing Synopsys GUN Toolchain
Grove - Vision AI uses the Himax HX6537 chip, where we need to install the Synopsys GUN Toolchain in order to cross-compile the firmware afterwards, the installation is divided into the following steps.
First, download the pre-compiled toolchain from Synopsys GUN Toolchain - GitHub Releases.sh
wget https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2020.09-release/arc_gnu_2020.09_prebuilt_elf32_le_linux_install.tar.gz -P ~/ && \ tar -zxvf ~/arc_gnu_2020.09_prebuilt_elf32_le_linux_install.tar.gz --directory ~/
Then, specify the directory of the Synopsys GUN Toolchain executable in the PATH and add it to
~/.bashrcto facilitate automatic import when shell starts.sh
echo 'export PATH="$HOME/arc_gnu_2020.09_prebuilt_elf32_le_linux_install/bin:$PATH" # Synopsys GUN Toolchain' >> ~/.bashrc
If you are using Zsh or other Shells, the above
~/.bashrcshould be adjusted accordingly.
Get Examples and the SDK
Please go to the root of the SSCMA project, then run the following command to get the examples and download the SDK.
git clone https://github.com/Seeed-Studio/sscma-example-vision-ai examples/grove && \
pushd examples/grove && \
make download && \
If you have not installed Make, on Linux distributions that use APT as the default package manager, you can install it with the following command.
sudo apt-get update && \
sudo apt-get install make -y
In addition, we recommend that you complete the installation and configuration of SSCMA in advance. If you have not installed SSCMA yet, you can refer to SSCMA Installation Guide.
Prepare the Model
Before you start compiling and deploying, you need to prepare the models to be deployed according to the actual application scenarios. Models are included in the default Grove - Vision AI SDK, or you can try to train different models yourself.
Therefore, you may need to go through steps such as model or neural network selection, customizing the dataset, training, exporting and converting the model.
To help you understand the process in a more organized way, we have written complete documentation for different application scenarios.
Before Compile and Deploy, you need to prepare the appropriate model.
Compile and Deploy
Compile the Firmware and Model Firmware
First, please go to the root directory of the SSCMA project and run the following command to access the example directory
cd examples/grove # SSCMA/examples/grove
Second, choose the compilation parameters according to selected model and compile them, the optional parameters are
make HW=grove_vision_ai APP=fomo && make flashsh
make HW=grove_vision_ai APP=meter && make flashsh
make HW=grove_vision_ai APP=digtal_meter && make flash
You can view all optional parameters for APP using the following command.sh
ls examples # SSCMA/examples/grove/examples
After compilation, a binary file named
output.imgwill be generated in the
Third, generate the UF2 firmware image.sh
python3 tools/ufconv/uf2conv.py -t 0 -c tools/image_gen_cstm/output/output.img -o firmware.uf2
Last, generate UF2 model image from TFLite model.sh
python3 tools/ufconv/uf2conv.py -t 1 -c <TFLITE_MODEL_PATH> -o model.uf2
You need to replace
<TFLITE_MODEL_PATH>with the path to the TFLite model obtained in the Prepare the Model step. You can also use the pre-trained model, which is located in the
model_zonedirectory, and simply copy its path.
Note that the model type selected should be consistent with the selection which you have made in Compile Firmware and Model Firmware - Step 2.
The deployment process of Grove - Vision AI is divided into two main steps, which need to be executed in strict order.
firmware.uf2firmware image and reboot or reconnect.
model.uf2model firmware image and reboot or reconnect.
In the browser interface and Grove Vision AI Console, select Grove AI in the pop-up window and click Connect button to connect.
Before flash the firmware, you must check if the device bootloader version matches the firmware version. If it does not match, you will need to flush the bootloader firmware first, and then the firmware.
How to flash the firmware and model?
Connect Grove - Vision AI module to your computer via USB Type-C cable.
Double click on the BOOT button of Grove - Vision AI module to put it into DFU mode.
Wait for a moment and a storage device named GROVEAI or VISIONAI will appear.
Copy the UF2 firmware to the root directory of the storage device. When the device disappears, the flashing process is complete.
The performance of SSCMA related models, measured on different chips, is summarized in the following table.
|Grove Vision AI
|Grove Vision AI
For more models go to SSCMA Model Zoo
If your Grove Vision AI is not recognized by your computer, we recommend your to try reinstall the firmware or update the bootloader, the detailed steps can be found on Grove - Vision AI Module: Restore Factory Firmware.
If you find any issues in these examples, or wish to submit an enhancement request, please use GitHub Issue.
For Synopsys GUN Toolchain related issues please refer to Synopsys GUN Toolchain.
For information about TensorFlow Lite Micro, please refer to TFLite-Micro.
For SSCMA related information, please refer to SSCMA.
These examples are released under the MIT License.
For Synopsys GUN Toolchain, it is released under the GPLv3 License.
The TensorFlow library code and third-party code contain their own licenses, which are described in TFLite-Micro.