Neural Network Module
Introduction
Product Overview
The Bitmain Sophon Neural Network Module (NNM) is a USB module that designed for Deep Learning inference on various edge application. NNM 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 NNM enables traditional product with AI functions, and can be used in smart IPC, Robots, industrial PC, etc.

Product Features
Power and all data provided over USB 9pin (pin width: 1.25mm) interface
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
Sophon 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
USB 9pin (pin width: 1.25mm) interface
Dimensions
38*38 mm
Operating environmental temperature
0 – 40C (commercial level)
Hot plugin/plugoff
Yes
Certification
EMC/FCC/3C/CE
Minimum system requirement
X86_64 computer running Windows or Ubuntu USB3.0 or USB2.0 port
Toolkit
BMNet: Bitmain Compiler which can convert supported AI models to internal format accelerated by Sophon TPU.
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
You can freely download BM1880 BSP/SDK package and demo programs at Sophon BM1880 GitHub https://github.com/BM1880-BIRD/.
In following sections, we will guide you how setup hardware and software environment, and how to build and run demo programs. Please check Sophon BM1880 GitHub for more information.
Setup Neural Network Module
Setup Neural Network Module by the steps provided below.
Step 1: Preparation
Before you start, make sure you have the following:
Host PC with Ubuntu 18.04 operation system & OpenCV 3.4.0 & Python 2.7 & Python 3 & libusb & libgoogle-glog
BM1880 SDK from https://github.com/BM1880-BIRD/bm1880-system-sdk
Demo programs from https://github.com/BM1880-BIRD/bm1880-ai-demo-program
Neural Network Module with USB cable
3 pins USB-to-UART cable
Serial communication program (minicom) at host PC
UVC Camera on host PC
Step 2: Hardware Installation
Step 2.1: Connect NNM and host PC with USB cable
Connect NNM to host PC via USB type A interface, host PC will identify NNM automatically, it will generate one USB device node named /dev/ttyACM0 if connection succeed. You can check it by below command:
Install pyusb on host PC. It will download image to NNM by python script later.
Step 2.2: Plug UART cable to NNM
To show messages from NNM, plug UART cable to NNM as below. And then connect USB-to-UART cable to host PC.

Step 2.3: Plug USB cable to NNM

Step 3: Build image for NNM
Go to https://github.com/BM1880-BIRD/bm1880-system-sdk and follow the README to build image on host PC for NNM.
Step 4: Download image to NNM
Now we can start to download image to BM1880 USB module.
It will show:
Re-plug NNM into host PC, and it will start downloading.
It can check with BM1880 UART output.
Now, image downloaded successfully.
Build and Run Demo Program
We prepares two demo programs for NNM.
Face detection
Object detection
Download source code
We will put demo source code in same folder as bm1880-system-sdk.
Get source code and bmodel by below command:
---
Face detection (MTCNN)
Device Requirement:
NNM (inference)
PC with Ubuntu 18.04 (capture image and display result)
UVC camera on host PC
Step 1: Build demo program
Demo source code is located in bm1880-ai-demo/rtsp_fd_fr.
Build binary for NNM:
build binary for PC:
NNM program is rtsp_fd_fr/build/fdfr_soc/bin/test_libusb_fdfr.
PC program is rtsp_fd_fr/build/fdfr_host/bin/test_libusb_fdfr.
Step 2: Put NNM demo program and bmodel into image
To modify rootfs folder, we need to unpack emmc.tar.gz, and then unpack rootfs.tar.gz.
Copy test_libusb_fdfr and necessary bmodels to rootfs folder, and then pack emmc.tar.gz.
Step 3: Re-download image to NNM
Download image to NNM again for updating rootfs
Re-plug NNM to start downloading. After finished, you can check in NNM's serial console by this:
Step 4: Run demo program (NNM)
In NNM's serial console, input commands below to start demo program:
Add a new configuration file:
Start program:
Step 5: Run demo program (PC)
In PC's terminal, input commands below to start demo program:
There will be a window showing the results of face detection.
---
Object detection (YOLOv3)
Device Requirement:
NNM (inference)
PC with Ubuntu 18.04 (capture image and display result)
UVC camera on host PC
Step 1: Build demo program
Demo source code is located in bm1880-ai-demo/rtsp_fd_fr.
Build binary for NNM:
build binary for PC:
NNM program is rtsp_fd_fr/build/objdet_soc/bin/yolo_nnm.
PC program is rtsp_fd_fr/build/objdet_host/bin/yolo_host.
Step 2: Put NNM demo program and bmodel into image
To modify rootfs folder, we need to unpack emmc.tar.gz, and then unpack rootfs.tar.gz.
Copy yolo_nnm and necessary bmodels to rootfs folder, and then pack emmc.tar.gz.
Step 3: Re-download image to NNM
Download image to NNM again for updating rootfs
Re-plug NNM to start downloading. After finished, you can check in NNM's serial console by this:
Step 4: Run demo program (NNM)
In NNM's serial console, input commands below to start demo program:
Start program:
Step 5: Run demo program (PC)
In PC's terminal, input commands below to start demo program:
There will be a window showing the results of face detection.
USB communication between Host and BM1880
Please refer to
https://github.com/BM1880-BIRD/bm1880-ai-demo-program/tree/master/usb_api
https://github.com/BM1880-BIRD/bm1880-ai-demo-program/tree/master/darknet_nnm_sample
Troubleshooting
Add later
Last updated