AI Development Platform For Smart Devices
AI Development Platform For Smart Devices
AI Development Platform For Smart Devices
and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their
respective holders.
Notice
The purchased products, services, and features are stipulated by the contract made between Huawei
and the customer. All or part of the products, services, and features described in this document may
not be within the purchase scope or the usage scope. Unless otherwise specified in the contract, all
statements, information, and recommendations in this document are provided "AS IS" without
warranties, guarantees, or representations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been made
in the preparation of this document to ensure accuracy of the contents, but all statements,
information, and recommendations in this document do not constitute a warranty of any kind,
express, or implied.
Contents
HUAWEI HiAI is an open AI capability platform for smart devices, which adopts a "chip-
device-cloud" architecture, opening up chip, application, and service capabilities for a fully
intelligent ecosystem. It assists developers in delivering a better smart application
experience for users, by fully leveraging Huawei's powerful AI processing capabilities.
7.1.2 Architecture
The HUAWEI HiAI platform builds a three-layer ecosystem of cloud, device, and chip. It
supports various mainstream frontend frameworks on the cloud (Service) side. Various
upper-layer service APIs are provided on the device (Engine) side to ensure efficient running
on mobile devices. Heterogeneous resources can be flexibly scheduled on the chip
(Foundation) side, meeting developers' demand to accelerate neural network model
computing and operator computing. In addition, HUAWEI HiAI has a systematic tool chain,
comprehensive documents, various APIs, and source code that is easy to use, enabling quick
application development. Figure 7-2 shows the architecture of the HUAWEI HiAI mobile
computing platform.
Huawei Open AI Platform for Smart Devices Page 4
HiAI is an AI computing platform that is designed for mobile devices. Compared with
device-side AI and cloud-side AI, HiAI has three core advantages: higher security, cost
effective, and lower latency. HiAI builds a three-layer AI ecosystem: open service
capabilities, open application capabilities, and open chip capabilities. This three-layer open
platform utilizes features of the chips, devices, and clouds to deliver an extraordinary
experience to both users and developers. Figure 7-3 shows the features of each layer:
Cloud: created once and reused multiple times.
Device: distributed and all-scenario.
Chip: stronger computing power, more operators and frameworks, and smaller
models.
HiAI can bring the following benefits to applications: real time, ready-to-use, stability,
security, and cost effective.
HUAWEI HiAI 3.0 features distributed AI enablement across all scenarios. HiAI has a three-
layer architecture: cloud, device, and chip. The sub-module corresponding to cloud is HiAI
Service, which is used to open service capabilities. HiAI Service pushes services to users
based on users' need so that the services can actively find the users. HiAI Service enables
users to create a service once and reuse it for multiple times. The sub-module
Huawei Open AI Platform for Smart Devices Page 5
The HiAI Foundation supports dedicated AI instruction sets for neural network model
calculation, and can efficiently and concurrently execute more neural network operators
with a minimum clock cycle.
The HiAI Foundation can compile a variety of neural network operators, such as
convolution, pooling, activation, and full-connection operators, into dedicated AI
instruction sequences for the NPU in offline mode, with the data and weight rearranged.
The instructions and data are then combined together to generate an offline execution
model. Furthermore, during offline compilation, cross-layer operators can be fused
together (convolution, ReLU, and pooling), in order to reduce the read-write bandwidth of
the double data rate (DDR) and thus improve performance.
HiAI Foundation can rearrange related data (batch, channel, height, and width) of the
neural network model in the most efficient manner. In particular, for channel data of the
feature map, the channel-related calculation efficiency will be greatly improved during
convolution operations.
HiAI Foundation supports sparse model acceleration. The NPU can skip the multiply-add
algorithms with a coefficient of zero, which can greatly improve the calculation efficiency
and reduce the bandwidth while maintaining the calculation precision.
As shown in Figure 7-4, by using compilation tools, a trained neural network model is
converted into an offline model that can be efficiently executed on the HiAI Foundation,
and output as a binary file, that is, the offline model.
Standard neural network models (such as Caffe) are compiled and converted into offline
models. The purpose of compilation is to optimize network configurations and generate
target files (that is, offline models) after the optimization. Offline models are serially stored
in disks. In this way, the neural network can directly use target files obtained after the
optimization for faster computing.
Figure 7-5 shows that during offline model calculation, the HiAI Foundation loads offline
models from files and copies the user input data (such as images) to the HiAI NPU for
calculation. User data only needs to be imported from the DDR to the NPU once for each
inference during calculation.
Huawei Open AI Platform for Smart Devices Page 7
Figure 7-6 Integration of HiAI IDE and Android Studio 批注 [s(1]: 需更换为英文版界面图片
The HiAI platform plug-in provides the HiAI Engine and HiAI Foundation functions. HiAI
Engine provides APIs integrated with applications. It can be invoked directly. HiAI
Foundation integrates trained models, which can be downloaded and used directly, as
shown in Figure 7-7.
Huawei Open AI Platform for Smart Devices Page 10
Figure 7-7 HiAI functions integrated with Android Studio 批注 [s(2]: 需更换为英文版界面图片
When an application has been developed and entering the real device commissioning, full
series of convenient, efficient, and smooth remote debugging services are provided by
Huawei. Developers can access the real devices in Huawei remote terminal lab by one click
to perform real-time remote control and single-step commissioning. In addition, Huawei
also provides performance and log analysis. Figure 7-8 shows some of the supported
Huawei models.
The procedure for integrating the HiAI deep learning development kit (DDK) is as follows:
Obtain the trained Caffe or TensorFlow model and use the offline model generator (OMG)
conversion tool to convert the original model of the open-source framework into the offline
Huawei Open AI Platform for Smart Devices Page 11
model (OM) suitable for the Da Vinci platform. The OM model can contain the 8-bit
quantization function. Finally, integrate applications, including model preprocessing and
model inference, as shown in Figure 7-9.
The procedure of application integration is as follows:
① In Android Studio, create a project. Make sure Include C++ support is selected.
② Select C++11 from the C++ Standard drop-down list box. Select Exceptions Support (-
fexceptions) and Runtime Type Information Support (-frtti).
----End
children around the world. They cannot hear the wonderful voice or verbally express their
ideas. The way they communicate with the world is full of challenges.
The reality is cruel that 90% of children with hearing disabilities have healthy parents, 78%
of whom are unable to communicate with children. For children who are severely or
profoundly deaf, learning and reading can be an overwhelming challenge.
Languages are learned by listening, speaking, reading, and writing. Listening is a key part
for language learning. When encountering a strange word, a normal child can understand
its meaning with their family's explanation, and master it by speaking the word
continuously. Children with hearing disabilities, however, can only learn languages through
sign language. Without the help of professional sign language teachers, they cannot
communicate with normal person.
To address this issue, Huawei developed StorySign in partnership with nonprofit European
Union of the Deaf, the publisher Penguin Random House and animation gurus Aardman.
With Huawei HiAI's open image recognition and Optical Character Recognition (OCR)
capabilities, animation effect can be displayed as soon as users hold their smartphones
over the words in the physical edition. Then the lovely avatar "Star" appears to translate
the text on the book into sign language, as shown in Figure 7-10.
Figure 7-11 Huawei HiAI improves visual experience of Yuanbei Driving Test 批注 [s(4]: 需更换为英文版界面图片
reservation, flight ticket reservation, train ticket reservation, travel guides, preferential
tickets, and travel insurance.
During the journey, users often take many photos, hoping to capture beautiful scenery and
keep the pleasant time through cameras. However, it is difficult for most ordinary person
to accurately determine the quality of photos taken by themselves due to the lack of
professional photography knowledge. As a result, users cannot determine whether the
photos are good or not and whether the best effect is achieved. In addition, when the
photos taken by users are not clear and sharp enough and the display effect is poor, image
quality improvement becomes the requirement of many users.
By integrating the aesthetic rating capability of HUAWEI HiAI Engine, it can automatically
integrate technical factors such as out-of-focus and jitter as well as subjective aesthetics
such as skewness, color, and image composition to score images. Users can quickly
understand the image quality based on the scores and adjust the image quality accordingly
to get the most beautiful scenery.
In addition, with the help of the HUAWEI HiAI, the application can be woken up by voice
and make poems with just one click, as shown in Figure 7-12.
Figure 7-12 HUAWEI HiAI enables Ctrip to make poems with one click 批注 [s(5]: 需更换为英文版图片
Document calibration to quickly adjust the shooting angle to the center of view: This
is an enhanced auxiliary function for document rephotographing. It can
automatically adjust the shooting angle to the right front of the document, allowing
a maximum adjustment range of 45 degrees, as shown in Figure 7-14.
Huawei Open AI Platform for Smart Devices Page 16
Access to OCR to edit the image content: By integrating OCR, WPS can automatically
recognize and extract the text in images so that users can modify, cut, copy, or
delete texts in the PowerPoint, as shown in Figure 7-16.
Huawei Open AI Platform for Smart Devices Page 17
7.4 Summary
This chapter describes the three-layer architecture of the HUAWEI HiAI platform: HUAWEI
HiAI Foundation, HUAWEI HiAI Engine and HUAWEI HiAI Service APIs so that service
capability openness, application capability openness, and chip capability openness can be
implemented. These related capabilities and some HiAI solutions are also introduced in this
chapter.
Last but not least, HUAWEI HiAI has carried out the following events to fully connect
developers, encourage innovation, and achieve win-win ecosystem.
Offline connection for in-depth communication:
① salon city station
② HiAI open courses
③ special technical conferences
1 billion investment, stimulating innovations in all scenarios:
① openness and innovation of device capabilities
② all-scenario digital service innovation
③ cloud service ecosystem co-construction
Innovation competitions for continuous development:
① AI Application Innovation Contest
② Future Application Creative Contest
③ AR Application Innovation Contest
Huawei Open AI Platform for Smart Devices Page 18
Huawei believes that AI can make life better by bringing unprecedented convenience for
both back end and devices. However, this requires actual application scenarios that allow
more enterprises and developers to play a part in improving user experience substantially.
Huawei is willing to work with partners to jointly promote intelligent transformation of
industries with more developers and enterprises based on the HiAI 3.0 platform.
7.5 Quiz
1. HUAWEI HiAI 3.0 was officially released at Software Green Alliance Developer
Conference on November 19, 2019, marking the leap from the device-side AI to the
distributed AI, which will bring ultimate smart life experience across all scenarios. What
is the three-layer AI ecosystem of HUAWEI HiAI?
2. Which layer can convert a standard neural network model into an offline model?
3. Which layer can easily integrate multiple AI capabilities into applications to make
applications more intelligent and powerful?
4. HiAI aims to help developers quickly, conveniently, and efficiently use Huawei EMUI
open capabilities. Which tool can be integrated with HiAI?
5. What is the procedure of application integration?