Skip to content

Latest commit

 

History

History
 
 

MLKit-Sample

MLKit-Sample

English | 中文

Table of Contents

Introduction

This sample code describes how to use the ML Kit SDK, including the following modules:

Text module

Module-text. including 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. It includes image segmentation, image classification, object detection and tracking, location identification, image overcommitment, text image overcommitment, scene recognition, table recognition, and document correction.

Body module

Module-body. including face detection, human skeleton detection, liveness detection, hand key points detection, 3D face detection, face comparison, and gesture recognition.

Custom Model Module

Module-costom. including the demonstration of the customized model of the label and the customized model of object detection.

For details about the HMS Core ML SDK, please refer to HUAWEI ML Kit

Project directory structure

moduletext

|-- 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

modulevision

|-- 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

modulebody

|-- 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

modulecostom

|-- 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-term proven expertise in machine learning to support diverse artificial intelligence (AI) applications throughout a wide range of industries. For more application scenarios, see: Huawei Machine Learning Service Integration Cases.

Getting Started

  • Clone the code library to the local computer.

    git clone https://github.com/HMS-Core/hms-ml-demo.git
    
  • If you have not registered as a developer, register and create an app in AppGallery Connect.

  • Obtain the agconnect-services.json file from Huawei Developers.

  • Replace the sample-agconnect-services.json file in the project.

  • Compile and run on an Android device or simulator.

Attention:

You can only use a custom package name to apply for the agconnect-services.json file. In this way, you only need to change the value of applicationId in HUAWEI-HMS-MLKit-Sample\app\build.gradle to the package name used in agconnect-services.json. Then, you can use cloud services of HUAWEI ML Kit.

Supported Environments

Devices with Android 4.4 or later are recommended.

License

The MLKit-Sample have obtained the Apache 2.0 license.