Introduction


We'll introduce Debian10 and Rockx on RV1126 by using the facial recognition cloud server application.


Debian10: While Rockchip officially adapted the Buildroot system for the RV1126, it may not be the most developer-friendly 

option for application deployment. Therefore, Firefly has adapted Debian10 for RV1126. The greatest advantage of Debian 10 lies in its wealth of deb resources.

With the convenience of apt, developers can swiftly set up their development environment and easily employ Python for deep learning.


Rockx: an API interface developed by Rockchip to enable users to quickly build AI applications. 

It provides a convenient way for users to use Rockchip's npu platform so users can temporarily set aside concerns about AI model generation.

Currently, Rockx supports various models such as facial recognition, license plate recognition, finger and body keypoint detection, and object detection. 



Application Introduction


You may have used facial recognition APIs from companies like Baidu and Alibaba.

Their basic principle involves setting up cloud servers using hardware and providing a set of HTTP interfaces for customers to utilize their own hardware for cloud computing.

In this case, we will create a similar service for cloud-based facial recognition on the Core-1126-JD4 platform.



Environment Setup


Hardware: Core-1126-JD4 (with the backplane)

Operating System: Debian 10



1. Upgrade Debian 10

The board comes with the Buildroot system by default. If you haven't upgraded Debian10 yet, please refer to the Wiki for instructions. 

Here is the link:  https://wiki.t-firefly.com/en/CORE-1126-JD4/Debian10.html


2. Pull the code

sudo apt update
sudo apt install git
git clone https://gitee.com/Blg-daijh/pywebservice.git -b rv1126_rockx


3. Environment setup

sudo apt update
sudo apt install libdbus-1-dev
sudo apt install  libglib2.0-dev
sudo apt install libdbus-glib-1-dev
sudo apt install python3-pip
pip3 install flask


4. Compile the recognition program

make



Running Application


1. Running the server program

# Run the following commands on RV1126================

sudo chmod 777 /dev/galcore

# The absolute path of the rockx directory in the code

export ROCKX_DATA_PATH=/home/firefly/pywebservice/rockx/

./client &

#Before running, change Pywebservice.py host ip to your own network IP, which can be checked by running the "ifconfig" command

python3 Pywebservice.py


2. Running the Client Program

# The following command is executed on a device (such as a computer or another ARM device) in the same local area network as RV1126

# Before running, change Pyupload.py according to your RV1126 IP

python3 Pyupload.py


3. Results

The "test.jpg" file will be uploaded from the client to cloud. The server will process the images, detect faces, and mark them. 

The processed image will be returned to users in JPG format and saved as "test_save.jpg".


01.png


FAQ

1. Q: Only 2.0T computing power, is it not suitable for a cloud server?

A: Indeed, only a single Core-1126-JD4 board may not be ideal. 

However, Core-1126-JD4 is compatible with Cluster Server R1, which can support up to 10 Core-1126-JD4 boards per server. For more information, please refer to the wiki tutorial.


02.jpg


Q: Is 10 boards not enough?

A: Core-1126-JD4 is also compatible with Cluster Server R2, which can support up to 72 Core-1126-JD4 boards, 

providing 144T computing power. Each RV1126 board can simultaneously handle hardware encoding and decoding of 4-channel 1080p video stream. 

In theory, 72 boards can process up to 288 -channel 1080p video stream. . For more information, please refer to the wiki tutorial.


01 (1).jpg


2. Q:Is the network bandwidth sufficient for connecting so many SoCs?

A: Cluster Server R2 is equipped with 10 Gigabit Ethernet.


3. Q: What is the software structure?

A: To demonstrate the convenience of deploying software on Debian10, the Python Flask module to build a Webservice is used. NPU recognition is the highly encapsulated Rockx, so there is no need to develop model. Additionally, Dbus  is used for communication between Python and C processes.



4. Q: Is there any information available about Rockx?

A: In fact, the Rockx repository is included in the RV1126 official SDK source code, containing a wealth of examples and documentation. 

You can find the Rockx repository within the SDK at the following path: sdk_path/external/rockx.