Edge Developer Board

ga
Last updated 17 minutes ago

Introduction

Product Overview

The Bitmain SophonTM Edge Developer Board(EDB) is designed for bringing powerful Deep Learning capability to various type of applications through its quick prototype development. Sophon Edge Developer Board is powered by BM1880, which equips tailored TPU supporting DNN/CNN/RNN/LSTM operations and models. The edge developer board is compatible with Linaro 96boards while supporting modules for Arduino and Raspberry Pi. Developers can leverage off-the-shelf modules and develop cutting edge DL/ML applications, like facial detection and recognition, facial expression analysis, object detection and recognition, vehicle license plate recognition, voiceprint recognition, etc.

Product Features

  • Supports DNN/CNN/RNN/LSTM models profiling, compiling and tuning

  • Real-time inference in edge device

  • Quickly deploy existing DNN/CNN/RNN/LSTM models or uniquely trained networks

  • Features Bitmain SophonTM BM1880 with energy efficient DNN/CNN/RNN/LSTM processing

  • Compatible to 96Boards Consumer Edition Spec.

  • Support Caffe, ONNX, Pytorch, Tensorflow framework

  • Support ResNet50, Yolo V2, GoogleNet V1, MobileNet v1/v2, SSD300, Alexnet, VGG16… etc

Developer Board Specification

Processor

Sophon BM1880

System Memory

LPDDR4 1GB

Flash Memory

8GB eMMC + micro SD card slot

Connectivity

Gigabit Ethernet(RJ-45), Wi-Fi, Bluetooth

USB

USB 3.0 x 3 (support camera, U-disk..etc)

I/O Expansion

40-pin 96Boards low-speed expansion header

Audio

I2S x 2 (included in 40-pin header)

H.264 decoder, MJPEG encoder/decoder

1x 1080p @60fps or 2x 1080p @30fps H.264 decoder, 75fps for FHD images

Toolkit

  • BMNet: Bitmain Compiler which can convert supported AI models to internal format accelerated by Sophon TPU.

  • ONNC: ONNX Compiler which can convert ONNX format to internal format accelerated by Sophon TPU

  • Quantization Tool: Convert FP32 to INT8 and support calibration function

Get Started

Edge Developer Board(EDB) is designed to work in two mode, we called it USB mode and SoC mode.

Setup the Edge Developer Board(EDB) by following the steps provided below.

USB Mode

Step 1: Prepare Your Equipment

In USB mode, Edge Developer Board(EDB) as a USB device role, BMNNSDK is installed on the X86 host, and calling EDB’s computing for deep learning, the environment requirement are as follows.

  • Hardware environment: X86_64 host with usb port

  • Bitmain SophonTM Edge Developer Board(EDB)

  • Operating system: Ubuntu* 16.04 operating system, or Ubuntu VMware instance

  • Package: libgoogle-glog-dev、libboost-all-dev、libprotobuf-dev, libusb-1.0-0-dev

  • Bitmain Sophon Neural Network Software Development Kit (SDK), such as bmtap2-bm1880-usb-x.y.z.tar.gz or bmtap2-bm1880-usb_x.y.z.run, you can download the compression package from https://www.sophon.cn/drive/36.html

  • Set the DIP switch to bit[1:8]=11000001 to config the usb port work in device mode.

Step 2:Install the BMNNSDK

You can execute below commands to install package

$ sudo apt-get install libgoogle-glog-dev libboost-all-dev libprotobuf-dev libusb-1.0-0-dev

There are two ways to install BMNSDK, you can have a choice you like

Compression package installation

Compression package include installation script, please copy the compression package to x86, unzip and execute the script install.sh.

$ tar zxvf bmtap2-bm1880-usb-x.y.z.tar.gz
$ cd bmtap2-bm1880-usb-x.y.z
$ sudo ./install.sh

The script will install the BMNNSDK to default directory: /opt/bmtap2, and Symbolic Link will be created in the system content:

// you will see the installation folder in the/opt/bmtap2 after successful installation
$ ls /opt/bmtap2
// symbolic link will be found in /usr/bin、/usr/lib、/usr/include
$ ls -alh /usr/bin/bm*
$ ls –alh /usr/lib/bm*
$ ls –alh /usr/include/bmtap2
// if the host has BM1880 NNS,you will find device fold in the directory/dev
$ ls /dev/ttyACM*
/dev/ttyACM0

To uninstall the BMNNSDK ,simply execute the uninstall script in the installation directory.

$ sudo /opt/bmtap2/bm1880-usb-x.y.z/uninstall.sh

Package Installation

Installation package is a self-extracting file that can be run directly. Please copy the installation package to x86 host and run it.

$ chmod +x bmtap2-bm1880-usb_x.y.z.run
$ sudo ./bmtap2-bm1880-usb -x.y.z.run

The installation package will install the BMNNSDK to default directory: /opt/bmtap2, and Symbolic Link will be created in the system content, it also will automatically compile and load the BM1880’s USB device by DKMS, which will drive the bmdnn.ko:

// you will see the installation folder in the directory /opt/bmtap2 after successful installation
$ ls /opt/bmtap2
// symbolic link will be found in /usr/bin、/usr/lib、/usr/include
$ ls -alh /usr/bin/bm*
$ ls –alh /usr/lib/bm*
$ ls –alh /usr/include/bmtap2
// if the host has BM1880 NNS, you will find the device file in the /dev directory
$ ls /dev/ttyACM*
/dev/ttyACM0

To uninstall the BMNNSDK ,simply execute the uninstall script in the installation directory.

$ sudo /opt/bmtap2/bm1880-usb-x.y.z/uninstall.sh

Step 3: Basic function testing

The Basic function testing use the network model and data include in the installation package for Neural Network inference, the test results will be output to the out subdirectory of the current directory, please make sure that the user has the write rights to the current directory.

$ source /opt/bmtap2/bm1880-<Mode>-x.y.z /test/test_bmnet.sh
$ mkdir out
$ run_test_bmnet_bm1880

The test results are as follow:

# run_test_bmnet_bm1880
begin to test net: mtcnn det1 <1,3,12,12>
<CMD> test_bmnet_bmodel /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_input_1_3_12_12.bin /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_1_3_12_12.bmodel out//det1_output.bin 1 3 12 12
input size: 432
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1026 19:41:03.865362 2635 bm_firmware.cpp:76] check firmware status ...
I1026 19:41:03.865628 2635 bm_firmware.cpp:82] firmware loading ...
I1026 19:41:03.929674 2635 bm_firmware.cpp:47] firmware load success
I1026 19:41:08.937716 2635 bm_firmware.cpp:98] firmware is running
I1026 19:41:08.937757 2635 bm_device.cpp:104] device[0] opened,gmem_size : 0x40000000
output size:6
outputs[0]: [1,4,1,1], "conv4-2"
outputs[1]: [1,2,1,1], "conv4-1"
test_bmnet_bmodel: load 107 us, run 106 us, read 76 us
('/opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_output_1_3_12_12_ref.bin', ' vs. ', 'out//det1_output.bin')
Result matched @ epsilon = 0.000000
det1<1,3,12,12> passed
begin to test net: mobilenet mobilenet <1,3,224,224>
<CMD> test_bmnet_bmodel /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_input_1_3_224_224.bin /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_1_3_224_224.bmodel out//mobilenet_output.bin 1 3 224 224
input size: 150528
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1026 19:41:09.092887 2662 bm_firmware.cpp:76] check firmware status ...
I1026 19:41:09.093133 2662 bm_firmware.cpp:85] firmware is running
I1026 19:41:09.093152 2662 bm_device.cpp:104] device[0] opened,gmem_size : 0x40000000
output size:1000
outputs[0]: [1,1000,1,1], "fc7"
test_bmnet_bmodel: load 3773 us, run 2820 us, read 222 us
('/opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_output_1_3_224_224_ref.bin', ' vs. ', 'out//mobilenet_output.bin')
Result matched @ epsilon = 0.000000
mobilenet<1,3,224,224> passed
test_bmnet_bm1880 success

SoC Mode

Step 1: Prepare Your Equipment

In SoC mode, EDB works as a host role, BMNNSDK is installed on the BM1880 Edge Developer Board(EDB), use the computing resources on the BM1880 SoC board to accelerate the deep learning calculation.

Step 2:Install the BMNNSDK

The environment requirements are as follows.

  • Hardware environment:

    • BM1880 Edge Developer Board(EDB)

    • 5V@2A or 12V@2A power adapter

  • Operating system:BM1880 Linux Release(You can download from:https://www.sophon.cn/drive/36.html or use the git clone command below)

  • Set the DIP switch to bit[1:8]=10100010 to config the usb OTG port work in host mode.(SD boot mode)

https://github.com/BM1880-BIRD/bm1880-system-sdk.git

Before you start to install the BMNNSDK in SoC mode, you need setup the EDB's linux environment at first. How to setup EDB's linux environment you can visit this section to get the steps

Compression package installation

Compression package contains the installation script, please copy it to the SoC board, unzip and execute the script install.sh in the directory.

$ tar zxvf bmtap2-bm1880-SoC-x.y.z.tar.gz
$ cd bmtap2-bm1880-SoC-x.y.z
$ sudo ./install.sh

The script will install the BMNNSDK to default directory: /opt/bmtap2, and Symbolic Link will be created in the system content, it also will load the BM1880’s TPU driver by insmod, which will drive the bmdnn.ko:

// you will see the installation folder in the/opt/bmtap2 after successful installation
$ ls /opt/bmtap2
// symbolic link will be found in /usr/bin、/usr/lib、/usr/include
$ ls -alh /usr/bin/bm*
$ ls –alh /usr/lib/libbm*
$ ls –alh /usr/include/bmtap2
// use lsmod to find driver information
$ lsmod | grep bmnpu
bmnpu
// you will find device file in the /dev directory
$ ls /dev/bm*
/dev/bm-npu

To uninstall the BMNNSDK ,simply execute the uninstall script in the installation directory.

$ sudo /opt/bmtap2/bm1880-SoC-x.y.z/uninstall.sh

Package installation

Installation package is a self-extracting file that can be run directly. Please copy the installation package to BM1880 SoC board and run it.

$ chmod +x bmtap2-bm1880-SoC_x.y.z.run
$ sudo ./bmtap2-bm1880-SoC-x.y.z.run

The installation package will install the BMNNSDK to default directory: /opt/bmtap2, and Symbolic Link will be created in the system directory, it also will load the BM1880’s TPU device by insmod, which will drive the bmdnn.ko:

// you will see the installation folder in the directory /opt/bmtap2 after successful installation
$ ls /opt/bmtap2
// symbolic link will be found in /usr/bin、/usr/bin、/usr/include
$ ls -alh /usr/bin/bm*
$ ls –alh /usr/lib/libbm*
$ ls –alh /usr/include/bmtap2
// use lsmod to find driver information
$ lsmod | grep bmnpu
bmnpu
// you will find the device file in the /dev directory
$ ls /dev/bm*
/dev/bm-npu

To uninstall the BMNNSDK ,simply execute the uninstall script in the installation directory.

$ sudo /opt/bmtap2/bm1880- SoC-x.y.z/uninstall.sh

Step 3: Basic function testing

The Basic function testing use the network model and data include in the installation package for Neural Network inference, the test results will be output to the out subdirectory of the current directory, please make sure that the user has the write rights to the current directory.

$ source /opt/bmtap2/bm1880-<Mode>-x.y.z /test/test_bmnet.sh
$ mkdir out
$ run_test_bmnet_bm1880

The test results are as follow:

./test_bmnet.sh
BMNET_OUT_PATH = out/
begin to test net: mtcnn det1 <1,3,12,12>
<CMD> ../bin/test_bmnet_bmodel /workspace/bmtap2-bm1880-soc_1.0.3.1/test/../models/mtcnn/det1_input_1_3_
Runtime Version : [1.0.3]
input size: 432
output size:6
outputs[0]: [1,4,1,1], "conv4-2"
outputs[1]: [1,2,1,1], "conv4-1"
test_bmnet_bmodel: load 5 us, run 85 us, read 9 us
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0101 09:18:24.895155 360 bm_device_soc.cpp:216] device[0] closed
*** Similarity: 1.0 (6/6)
det1<1,3,12,12> passed
begin to test net: mobilenet mobilenet <1,3,224,224>
<CMD> ../bin/test_bmnet_bmodel /workspace/bmtap2-bm1880-soc_1.0.3.1/test/../models/mobilenet/mobilenet_i
Runtime Version : [1.0.3]
input size: 150528
output size:1000
outputs[0]: [1,1000,1,1], "fc7"
test_bmnet_bmodel: load 114 us, run 2566 us, read 11 us
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0101 09:18:24.947519 362 bm_device_soc.cpp:216] device[0] closed
*** Similarity: 1.0 (1000/1000)
mobilenet<1,3,224,224> passed
test_bmnet_bm1880 success

Setup EDB's Linux ENV

Our EDB can support three boot mode you can select it by setting the switch on board

Download boot

To download the latest version of the release package , please visit the website https://github.com/BM1880-BIRD/ .

https://github.com/BM1880-BIRD/bm1880-system-sdk.git

Released package includes:

  • fip.bin : bootloader and uboot package

  • sdboot.itb : Linux kernel image (SD boot mode)

  • rootfs : rootfs for sd boot (on TF-card)

  • bm_update.img (eMMC boot mod)

Boot Modes

EDB supports SD boot, eMMC boot, Boot modes can be selected by the switch SW1

  • BOOT_SEL[2:0] = 3’b101: loading linux kernel from SD card.

  • BOOT_SEL[2:0] = 3’b100: loading linux kernel from eMMC.

SD Boot

(1) Download SD boot files form github (https://github.com/BM1880-BIRD/bm1880-system-sdk/tree/master/install/soc_bm1880_asic_edb) .

(2) Mount TF card to ubuntu system,format TF card and make two partitions: IMAGES partition(FAT file system, 128MB), rootfs partition (EXT4 file system, 3GB or more). You can refer the file "sd_create_rootfs.sh" (https://github.com/BM1880-BIRD/bm1880-system-sdk/tree/master/build/sd_tools).

~$sudo apt install expect
~$sudo sd_create_rootfs_sd.sh /dev/sdb
~$ sudo fdisk -l /dev/sdb
/dev/sdb1 on /media/bitmain/IMAGES type vfat
/dev/sdb2 on /media/bitmain/rootfs type ext4

(3) Copy the files to the sd partitions.

~$cd edb_sd_boot
~$cp fip.bin sdboot.itb /media/bitmain/IMAGES ; sync
~$sudo cp -fr rootfs/* /media/bitmain/rootfs; sync

(4) Select boot mode as SD boot, insert TF card to start Linux system.

eMMC Boot

Extract the file edb_emmc_boot.tar.gz (can't download from github yet, coming soon). Please prepare a SD card first, and make two FAT32 partitions on the SD card:

  • One 128M, put into fip.bin.

  • The other partition should larger than the size of the upgrade image bm_update.img, put in bm_update.img.

Start the board with the SD boot mode and stop at u-boot command line:

  • copy bm_update.img to the sd card.

  • connect the sd card to the board.

  • ecutes the bm_update command.

After the programming is completed: select BootMode to "BOOT_SEL[2:0] = 3'b100". Press the reset button to boot from the eMMC, the first time the system will into recovery mode, press the reset button again , the second time will boot into normal mode.