Skip to content

Latest commit

 

History

History

MLKit-Sample

MLKit-Sample

English | 中文

Table of Contents

Introduction

Sample code demoing features of the ML Kit and split into modules:

Text module (module-text)

Features: text recognition, document recognition, ID card recognition, bank card recognition, general card recognition, text translation, language detection, real-time speech recognition, speech synthesis, audio file conversion, voice recognition, text embedding, and real-time speech translation.

Vision module (module-vision)

Features: image segmentation, image classification, object detection and tracking, landmark recognition, image super-resolution, text image super-resolution, scene detection, table/form recognition, and document skew correction.

Body module (module-body)

Features: face detection, skeleton detection, liveness detection, hand key points detection, 3D face detection, face comparison, and hand gesture recognition.

Custom Model Module (module-custom)

Features: use customized models for label and object detection.

Project directory structure

module-text

|-- com.huawei.mlkit.sample
    |-- Activity
        |-- AsrActivity //Real-time speech recognition entry
        |-- AsrAudioActivity //Automatic Speech Recognition
        |-- TtsAnalyseActivity //Text to speech entry
        |-- AudioFileTranscriptionActivity //Audio File Transcription
        |-- IDCardRecognitionActivity // ID card recognition
        |-- BankCardRecognitionActivity // Bank card recognition
        |-- GeneralCardRecognitionActivity // General card recognition
        |-- TextRecognitionActivity  // Text recognition
        |-- RemoteDetectionActivity  // Document recognition
        |-- StartActivity  // Service entry
        |-- BaseActivity  // Activity base class
        |-- SettingActivity  // moduletext Basic Information
        |-- TranslateActivity // Translation entry
        |-- LocalTranslateActivity // LocalTranslation
        |-- RemoteTranslateActivity // RemoteTranslation
        |-- SoundDectActivity // Voice recognition
        |-- TextEmbeddingActivity // Text Embedding

module-vision

|-- com.huawei.mlkit.sample
    |-- Activity
        |-- ImageSegmentationActivity //Image Segmentation
        |-- LoadPhotoActivity //Image Segmentation Related
        |-- TakePhotoActivity //Background Change Related
        |-- StillCutPhotoActivity //Capture Image Related
        |-- ObjectDetectionActivity //Object detection and tracking
        |-- ImageClassificationActivity //Image classification
        |-- RemoteDetectionActivity //Landmark recognition
        |-- ImageSuperResolutionStartActivity // image super resolution entry
        |-- ImageSuperResolutionActivity // image super resolution
        |-- TextImageSuperResolutionActivity // text image super resolution
        |-- SceneStartActivity // Scene Dection entry
        |-- SceneDectionActivity // Scene Dection
        |-- TableRecognitionStartActivity // Table recognition entry
        |-- TableRecognitionActivity // Table recognition
        |-- DocumentSkewStartActivity // Document correction entry
        |-- DocumentSkewCorretionActivity // Document correction
        |-- StartActivity  // Service entry
        |-- BaseActivity  // Activity base class
        |-- SettingActivity  // modulevision Basic Information

module-body

|-- com.mlkit.sample
    |-- Activity
        |-- FaceDetectionActivity //Face detection
        |-- Live3DFaceAnalyseActivity //3D face detection
        |-- FaceVerificationActivity // Face match
        |-- HumanSkeletonActivity // Human skeleton
        |-- TemplateActivity // Bone Template Selection Class
        |-- HumanLivenessDetectionActivity // Liveness detection
        |-- HandKeypointActivity // Key points of the hand
        |-- HandKeypointImageActivity // Hand static detection
        |-- GestureActivity // Gesture recognition
        |-- GestureImageActivity // Static detection of gesture recognition
        |-- StartActivity  // Service entry
        |-- BaseActivity  // Activity base class
        |-- SettingActivity  // modulebody Basic Information

module-custom

|-- com.huawei.mlkit.sample
    |-- Activity
        |-- CustModelActivity //Cust model service entry
        |-- CustModelLabelActivity // Demonstration entry for custom model labels
        |-- CustModelObjectActivity // Demonstration entry for custom model object detection
        |-- BaseActivity // Base class of an activity.
        |-- SettingActivity // Basic module costom information

More Scenarios

HUAWEI ML Kit allows your apps to easily leverage Huawei's long track record in machine learning to support diverse artificial intelligence (AI) applications throughout a wide range of industries. Check out these success stories.

Getting Started

  • If you are not yet a Huawei developer, register an account here

  • Login with your Huawei developer credentials to AppGallery Connect (AGC)

  • Use one of your existent projects/apps or create a new project and apps. You will need a separate app for each module and it makes sense to have them under the same project so that the API key and the enabled ML services are shared between apps.

  • In your project, access the Manage APIs tab and enable ML Kit (optionally, there are additional various configuration options under the dedicated ML Kit section under Build)

  • For each app, add in AGC the SHA-256 fingerprint of the used signing configuration (how to) even if you're using the default debug keystore ($ ./gradlew signingReport reveals the signing certificates used and the corresponding SHA-256 fingerprints)

  • Obtain the corresponding agconnect-services.json from each app on AGC and copy to the corresponding module's directory (how to)

  • Finally, replace the applicationId of each module (under <module>/build.gradle) with the package name entered when creating the apps in **AGC ** (at step #3)

Supported Environments

Devices with Android 4.4 or later are recommended.

License

The MLKit-Sample have obtained the Apache 2.0 license.