CAN IT BE POSSIBLE FOR MACHINES TO WORK WITHOUT HUMAN INTERACTION?
Have you ever thought that Machines can’t do much without human interaction and commands?
Its sound so excited to work on the Machine learning modules and replicate the human behavior in Machines.
Let us explore a contrivance which replicate the human behavior of reading the text and writing to a paper.
YES!! You are thinking right. I am talking about Text-Recognition mechanism.
HUAWEI ML KIT introduced plenty of such concepts to ease down the human processing in order to get the work done by Machines.
HUAWEI ML KIT enable your applications to easily leverage the proven expertise in machine learning to support diverse Artificial Intelligence (AI) applications.
Let’s take a glace on supported services:
Text-related Services
Text Recognition
Document Recognition
Bank Card Recognition
General Card Recognition
Language-related Services
Text Translation
Language Detection
Audio File Transcription
Automatic Speech Recognition (ASR)
Text to Speech (TTS)
Image-related Services
Image Classification
Object Detection and Tracking
Landmark Recognition
Image Segmentation
Product Visual Search
Face/Body-related Services
Face Detection
We will be focusing on Text-related Services:
As Text-related services leverage multiple capabilities to implement useful AI applications.
We will be discussing on General card recognition capability in detail.
General card recognition service provides universal development framework based on text recognition technology.
General Card recognition service provides API’s for processing the text extraction from the travel card, Identity cards using camera streams, pictures taking and locally saved images.
Processing
The algorithm scan through the uploaded card, check if it’s supported and identify the text. Once the text is identified, it gives the result back in a text format which can further be customized.
Set Up Needed
· Must have a Huawei Developer Account
· Must have a Huawei phone with HMS 4.0.0.300 or later
· Android Studio setup
Preparation
In order to develop the HMS react native apps following steps are mandatory.
· Create a new project in Android studio.
· Configure your app into AGC.
· Enable ML kit Api & add SHA-256.
· Download the agconnect-services.json from AGC. Paste into app directory.
Integration
· Configure android level build.gradle
1) Add to allprojects/repositories
maven {url ‘http://developer.huawei.com/repo/'}
2) Add to buildscript/repositores
maven {url ‘http://developer.huawei.com/repo/'}
3) Add to buildscript/dependencies
classpath ‘com.huawei.agconnect:agcp:1.3.1.301’
· Adding the Base SDK for text recognition into app.gradle
dependencies{
implementation ‘com.huawei.hms:ml-computer-vision-ocr:2.0.0.300’ }
· Import the general card recognition plug-in package into app.gradle
dependencies{
implementation’com.huawei.hms:ml-computer-card-gcr-plugin:2.0.0.300' }
· Add agc plugin in the top of app.gradle file
apply plugin: ‘com.huawei.agconnect’
· If you want the model to get updated automatically then add the below line of code above the application tag in Manifest.
<meta-data
android:name=”com.huawei.hms.ml.DEPENDENCY”
android:value= “ocr”/>
Adding permissions
Add below permissions to Android. Manifest file.
1. <uses-permission android:name=”android.permission.CAMERA” />
2. <uses-permission android:name=”android.permission.INTERNET” />
3. <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” />
4. <uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE” />
Adding features to Manifest
1. <uses-feature android:name=”android.hardware.camera” />
2. <uses-feature android:name=”android.hardware.camera.autofocus” />
Sync Gradle and build the project.
Development Process
· Add the below code in order to upload the card images on the Main activity using camera or local folder.
· Implement the method for handling the Camera stream
· Implement the method for handling Local image
· Handling the call Back
// Recognition result processing logic.
Product
Below are the screen shots attached from the working application.
Main Activity screen
Upload card images screen
Select supported card from the local storage
Note: Currently only Hong Kong, China, Macao and Taiwan card and Travel cards are supported.
Text- Recognition results
References
For official documentation visit here:
Conclusion
We can now read the text from any supported card and use them in our applications for further use with the customization.
Isn’t cool?