Android | teaches you how to quickly integrate machine learning capabilities

Time:2020-7-13

@TOC

background

After the last blog post about how to quickly integrate code scanning, I went to the official website to learn about other functions. Among them, machine learning service is relatively popular at present, and it is still free. Just hurry in and learn. See what you can do quickly.

The link is here: https://developer.huawei.com/consumer/cn/doc/development/HMS-Examples/ml-samplecode-4
Download link of Huawei HMS machine learning service code: https://developer.huawei.com/consumer/cn/doc/development/HMS-Guides/ml-introduction-4

Note: the code in the above link cannot be called directly, and the corresponding agconnect needs to be matched- services.json Can be used. For convenience, I will share the registered JSON file of my account. There will be~


Ability introduction

It is divided into face recognition, image segmentation, text detection, translation, target detection, object recognition, landmark recognition, speech recognition. It seems that there will be a series of new functions such as photo shopping, pose detection and so on.

Android | teaches you how to quickly integrate machine learning capabilities


Construction Engineering

For details of Android installation and other early steps, please refer to my last blog post: Android ultra simple integration quick code scanning: https://blog.csdn.net/weixin_ 38132951/article/details/104797443

1 configuration verification

  in the previous article, since code scanning is an end-to-end service, it is not necessary to configure agconnect- services.json 。 However, some machine learning services need to be used in the cloud, so this file must be configured before it can be used. For convenience, I marked the end-to-side capabilities that do not require JSON files in red boxes.
   that is to say, if you want to use functions other than the red box, you must configure the JSON file.
   note: the code in the above link cannot be called directly, and the corresponding agconnect needs to be matched- services.json Can be used.

This is my JSON file: agconnect- services.json

{
 "agcgw":{
  "backurl":"connect-dre.dbankcloud.cn",
  "url":"connect-dre.hispace.hicloud.com"
 },
 "client":{
  "cp_id":"890086000300129143",
  "product_id":"9105385871708413564",
  "client_id":"275456434039161856",
  "client_secret":"890DA62DAA27FA182FAFE33DE81766A40E084B9E3849242970C7569EFCE0663D",
  "app_id":"101639565",
  "package_name":"com.huawei.mlkit.csdn",
 "api_key":"CV5G18pJUEauNSTgMPuabJyUiONxrmmUDpS28JDCfM3xQmDxuaOXmLcY9xt3aObN76MQQy9XR55yIQQ9ESvxKfm32h+g"
 },
 "service":{
  "analytics":{
   "collector_url":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
   "resource_id":"p1",
   "channel_id":""
  },
  "ml":{
   "mlservice_url":"ml-api-dre.ai.dbankcloud.com,ml-api-dre.ai.dbankcloud.cn"
  }
 },
 "region":"DE",
 "configuration_version":"1.0"
}

    then connect this- services.json Put it in the directory of the downloaded app layer.
Android | teaches you how to quickly integrate machine learning capabilities
Android | teaches you how to quickly integrate machine learning capabilities
Android | teaches you how to quickly integrate machine learning capabilities
Android | teaches you how to quickly integrate machine learning capabilities
   if you can’t see this menu, you need to be short of people. Is this the project directory? If not, you can switch over.
   then put it in the app directory. Note that it is in the app directory, build.gradle Change the applicationid to mlkit.csdn


function

Click the small arrow to start running~


Effect display

Face recognition (can you see me clearly)

Android | teaches you how to quickly integrate machine learning capabilities

2 image segmentation

Android | teaches you how to quickly integrate machine learning capabilities

3 text recognition (divided into cloud test end side)

Android | teaches you how to quickly integrate machine learning capabilities

4 translation

Android | teaches you how to quickly integrate machine learning capabilities

5 object classification

Android | teaches you how to quickly integrate machine learning capabilities

6 target tracking

Android | teaches you how to quickly integrate machine learning capabilities


Past links: fast application, fast service, direct service What the hell are these
Source: https://developer.huawei.com/consumer/cn/forum/topicview?tid=0201211368231230067&fid=18
Original author: Wisteria