Neural Network Stick

ga
Last updated 11 days ago

Introduction

Product Overview

The Bitmain Sophon Neural Network Stick (NNS) a fan less USB stick that designed for Deep Learning inference on various edge application. NNS is powered by high performance, low power Sophon BM1880 chip. BM1880 chip supports DNN/CNN/RNN/LSTM models or uniquely trained networks, and can perform facial detection, recognition, facial expression analysis, object detection, recognition, vehicle license plate recognition, voiceprint recognition, etc. The NNS enables traditional product with AI functions, and can be used in smart IPC, Robots, industrial PC, etc.

Neural Network Stick (NNS)

Product Features

  • Power and all data provided over a single USB type A port

  • 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

Target AI functions

  • Facial detection (Frame by Frame), recognition and expression analysis, such as Age, Gender, etc.

  • Human attributes and pose analysis

  • Object detection and recognition

  • Vehicle license plate recognition

  • Voice print recognition

Product Technical Specification

Processor

Sophon BM1880

Supported Framework

Caffe, ONNX, Tensorflow, Pytorch

Supported AI Models

ResNet50, Yolo V2, GoogleNet V1, MobileNet v1&v2, SSD300, AlexNet, VGG16

H.264 decoder, MJPEG encoder/decoder

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

Connectivity

USB3.0/USB2.0 slave mode, Type A

Dimensions

93.52715mm

Operating environmental temperature

0 – 40C (commercial level)

Hot plugin/plugoff

Yes

Certification

EMC/FCC/3C/CE

Minimum system requirement

X86_64 computer running Ubuntu 16.04 USB3.0 or USB2.0 port

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

Setup the Neural Network Stick (NNS) by following the steps provided below.

Step 1: Prepare Your Equipment

In USB mode, BMNNSDK is installed on the X86 host, and calling NNS’s computing for deep learning, the environment requirement are as follows.

  • Hardware environment: X86 host with usb type-A

  • Bitmain Sophon Neural Network Stick (NNS)

  • Operating system: Ubuntu* 16.04 operating system, or Ubuntu VirtualBox 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

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

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

After installation the SDK, you can estimate whether the software and hardware environment is normal by running the test program in the installation directory(the file system needs to support bash for script execution correctly).

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