HUAWEI HiAI Image Super-Resolution Via DevEco

Nithin KC
4 min readNov 10, 2020

Introduction to HiAI Engine

HUAWEI HiAI is an open artificial intelligence (AI) capability platform for smart devices, which adopts a chip-device-cloud architecture, opening up chip, app, and service capabilities for a fully intelligent ecosystem. Chip Capabilities helps achieving optimal performance and efficiency, App capabilities make apps more intelligent and powerful and Service Capabilities helps in connecting users with our services.

DevEco IDE Introduction

DevEco IDE is an integrated development environment provided by HUAWEI Technologies. It helps app developers to leverage HUAWEI device EMUI open capabilities. DevEco IDE is provided as an Android Studio plugin. The current version provides development toolsets for HUAWEI HiAI capability, including HiAI Engine tools, HiAI Foundation tools, AI Model Marketplace, Remote Device Service.

Image Super-Resolution Service Introduction

Image super-resolution AI capability empowers apps to intelligently upscale an image or reduce image noise and enhance detail without changing resolution, for clearer, sharper, and cleaner images than those processed in the traditional way.

Here we are creating an Android application that converts blurred image to clear image. Originl image is a low resolution image and after being processed by the app, the image quality and resolution are significantly improved. The image is intelligently enlarged based on deep learning, or compression artifacts are suppressed while the resolution remains unchanged, to obtain a clearer, sharper, and cleaner photo.

Hardware Requirements

  1. A computer (desktop or laptop)
  2. A Huawei mobile phone with Kirin 970 or later as its chipset, and EMUI 8.1.0 or later as its operating system.

Software Requirements

  1. Java JDK installation package
  2. Android Studio 3.1 or later
  3. Android SDK package
  4. HiAI SDK package

Install DevEco IDE Plugins:

Step 1: Install

Choose the File > Settings > Plugins

Enter DevEco IDE to search for the plugin and install it.

DevEco IDE Plugin

Step 2: Restart IDE

Click Restart IDE

Configure Project

Step 1: Open HiAi Code Sample

Choose DevEco > SDK & DevTools

Choose HiAI

HiAI

Step 2: Click Image Super-Resolution to enter the detail page.

Step 3: Drag the code to the project.

Drag the code block 1.Initialization to the project initHiai(){ } method.

Drag code block 2. API call to the project setHiAi (){ } method

Step 4: Try Gradle Sync.

Check auto enabled code to build.gradle in the APP directory of the project.

HiAI build.gradle

Check auto enabled vision-release.aar to the project lib directory.

Code Implementation

Initialize with the VisionBase static class and asynchronously get the connection of the service.

Prepare the input image for super-resolution processing.

Construct the super-resolution processing class.

Construct and set super-resolution parameters.

Run super-resolution and get result of processing

The results are processed to get bitmap.

Accessing image from Asset.

Accessing image from Gallery.

Capture picture from camera.

Screenshot

Conclusion:

The DevEco plugin helps to configure the HiAI application easily without any requirement to download HiAI SDK from App Services. The super resolution interface converts low-resolution images to high-definition images, identifying and suppressing noise from image compression, and allowing pictures to be viewed and shared across multiple devices.

Reference:

HiAI Guide

--

--