Overview

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. This assists you in delivering an optimal smart app experience for users, by fully leveraging Huawei's powerful AI processing capabilities.

In order to open up app capabilities, HUAWEI HiAI Engine provides a wide range of AI capabilities that can be integrated into apps. Image category labeling, one such AI capability, empowers apps to:

For more information, please visit our official website:
https://developer.huawei.com/consumer/en/hiai#Engine

What You Will Create

In this codelab, you can use this AI capability to create an Android app that can automatically classify photos.
For example:

What You Will Learn

In this codelab, you will learn how to:

What You Will Need

Hardware Requirements

Software Requirements

Step 1: Install the plugin

Go to File > Settings > Plugins > Marketplace.
Enter "HMS Toolkit" to search for the plugin and install it.

Step 2: Restart Android Studio

Click Restart.

Step 1: Import the project

Download the project via the link below:

Download

Step 2: Open ImageCategoryLabelActivity

Step 1: Open the Coding Assistant

Go to HMS > Coding Assistant, and sign in to the HUAWEI ID.

Step 2: Go to AI > HUAWEI HiAI Engine

Step 3: Click Image Category Label

Step 4: Drag the code to the project

Drag the code block "1. Initialization" to the initHiAI(){ } method in the project.

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

After project syncing, select a device as the deployment target, and click the Run icon to install and start sample app, as shown in the following figure.

Code copied