Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
HUAWEI HMS Core
Documents from this version have been archived, and will not continue to be maintained. Please use the latest version.
ML Kit provides two SDK integration modes: full SDK and base SDK. You can select either one based on your needs. For details, please refer to Full SDK and base SDK in Overview.
Integrate the base SDK package and then the model package. The following table describes the model package.
Package Type | Function | Package Name | SDK Size | Storage Position |
Contour and key point detection model package | Detects the face contour and key points. | ml-computer-vision-face-shape-point-model | 4.9M | com.huawei.hms:ml-computer-vision-face-shape-point-model:1.0.4.300 |
Facial expression detection model package | Detects facial expressions such as smiling and anger. | ml-computer-vision-face-emotion-model | 2.8M | com.huawei.hms:ml-computer-vision-face-emotion-model:1.0.4.300 |
Facial feature detection model package | Detects facial features such as the age, gender possibility, and possibility of wearing a hat. | ml-computer-vision-face-feature-model | 4.4M | com.huawei.hms:ml-computer-vision-face-feature-model:1.0.4.300 |
When you integrate the face detection model packages, the sizes of the integrated packages are greater than those listed in the preceding table because the algorithm package (about 6.4 MB) is automatically downloaded during integration.
The following is the sample code for integration in full SDK mode:
- dependencies{
- // Import the base SDK.
- implementation 'com.huawei.hms:ml-computer-vision-face:1.0.4.300'
- // Import the contour and key point detection model package.
- implementation 'com.huawei.hms:ml-computer-vision-face-shape-point-model:1.0.4.300'
- // Import the facial expression detection model package.
- implementation 'com.huawei.hms:ml-computer-vision-face-emotion-model:1.0.4.300'
- // Import the facial feature detection model package.
- implementation 'com.huawei.hms:ml-computer-vision-face-feature-model:1.0.4.300'
- }
The sample code is as follows:
- dependencies{
- implementation 'com.huawei.hms:ml-computer-vision-face:1.0.4.300'
- }
After integrating the SDK, add the following configuration to the file header:
- apply plugin: 'com.huawei.agconnect'
Add the configuration following the configuration item below:
- apply plugin: 'com.android.application'
To enable your app to automatically update the latest machine learning model on a device after the user installs your app downloaded from HUAWEI AppGallery, add the following statements to the AndroidManifest.xml file of your app:
- <manifest
- ...
- <meta-data
- android:name="com.huawei.hms.ml.DEPENDENCY"
- android:value= "face"/>
- ...
- </manifest>
Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Quick start
Helps you find desired resources with ease.