目录

Refer to Latest version of ML Kit. This version optimizes all services provided by ML Kit to deliver better user experience.

Upgrading 1.0.0.xxx to 2.0.0.xxx

  1. dependencies{
  2.    implementation 'com.huawei.hms:ml-computer-vision-cloud:2.0.0.300'
  3. }

If you use on-cloud image classification and landmark recognition, modify the integrated SDK's basic dependencies (com.huawei.hms:ml-computer-vision) as follows:

  1. dependencies{
  2.    implementation 'com.huawei.hms:ml-computer-vision-cloud:1.0.4.300'
  3. }
  1. dependencies{
  2.    // To integrate multiple services, you can add them together.
  3.    implementation 'com.huawei.hms:ml-computer-vision-ocr:2.0.0.300'
  4.    implementation 'com.huawei.hms:ml-computer-vision-classification:1.0.4.300'
  5.    implementation 'com.huawei.hms:ml-computer-vision-object:1.0.4.300'
  6.    implementation 'com.huawei.hms:ml-computer-vision-face:1.0.4.300'
  7. }

Then, if you use the Full SDK mode to integrate the face detection service, delete com.huawei.hms:ml-computer-vision-face-recognition-model from the integrated capability package and perform the upgrade as follows:

1. If your app uses the following API of face detection:

getEmotions()

You can import the facial expression detection capability package.

  1. dependencies{
  2.    // Import the facial expression detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-emotion-model:1.0.4.300'
  4. }

2. If your app uses the following API of face detection:

getFeatures()

You can import the feature detection capability package.

  1. dependencies{
  2.    // Import the feature detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-feature-model:1.0.4.300'
  4. }

3. If your app uses the following APIs of face detection:

getAllPoints()

getFaceKeyPoint(int keyPointType)

getFaceKeyPoints()

getFaceShape(int shapeType)

getFaceShapeList()

getRotationAngleX()

getRotationAngleY()

getRotationAngleZ()

You can import the contour and key point detection capability package.

  1. dependencies{
  2.    // Import the contour and key point detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-shape-point-model:1.0.4.300'
  4. }

4. The following four APIs are basic APIs and can be supported as long as one or more of the preceding packages are imported:

getBorder()

getCoordinatePoint()

getHeight()

getWidth()

Upgrading 1.0.2.xxx to 2.0.0.xxx

  1. dependencies{
  2.    implementation 'com.huawei.hms:ml-computer-vision-cloud:2.0.0.300'
  3. }

If you use on-cloud , text translation, language detection, image classification, and landmark recognition, modify the integrated SDK's basic dependencies (com.huawei.hms:ml-computer-vision) as follows:

  1. dependencies{
  2.    implementation 'com.huawei.hms:ml-computer-vision-cloud:1.0.4.300'
  3. }
  1. dependencies{
  2.    // To integrate multiple services, you can add them together.
  3.    implementation 'com.huawei.hms:ml-computer-vision-ocr:2.0.0.300'
  4.    implementation 'com.huawei.hms:ml-computer-vision-icr:1.0.4.300'
  5.    implementation 'com.huawei.hms:ml-computer-vision-classification:1.0.4.300'
  6.    implementation 'com.huawei.hms:ml-computer-vision-object:1.0.4.300'
  7.    implementation 'com.huawei.hms:ml-computer-vision-face:1.0.4.300'
  8.    implementation 'com.huawei.hms:ml-computer-vision-segmentation:1.0.4.301'
  9. }

Then, perform the following steps:

1. If you use the Full SDK mode to integrate the face detection service, delete com.huawei.hms:ml-computer-vision-face-recognition-model from the integrated capability package and perform the upgrade as follows:

  1. dependencies{
  2.    // Import the facial expression detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-emotion-model:1.0.4.300'
  4. }
  1. dependencies{
  2.    // Import the feature detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-feature-model:1.0.4.300'
  4. }

getAllPoints()

getFaceKeyPoint(int keyPointType)

getFaceKeyPoints()

getFaceShape(int shapeType)

getFaceShapeList()

getRotationAngleX()

getRotationAngleY()

getRotationAngleZ()

You can import the contour and key point detection capability package.

  1. dependencies{
  2.    // Import the contour and key point detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-shape-point-model:1.0.4.300'
  4. }

getBorder()

getCoordinatePoint()

getHeight()

getWidth()

Upgrading 1.0.3.xxx to 2.0.0.xxx

If you use the Full SDK mode to integrate the face detection service, delete com.huawei.hms:ml-computer-vision-face-recognition-model from the integrated capability package and perform the upgrade as follows

1. If your app uses the following API of face detection:

getEmotions()

You can import the facial expression detection capability package.

  1. dependencies{
  2.    // Import the facial expression detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-emotion-model:1.0.4.300'
  4. }

2. If your app uses the following API of face detection:

getFeatures()

You can import the feature detection capability package.

  1. dependencies{
  2.    // Import the feature detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-feature-model:1.0.4.300'
  4. }

3. If your app uses the following APIs of face detection:

getAllPoints()

getFaceKeyPoint(int keyPointType)

getFaceKeyPoints()

getFaceShape(int shapeType)

getFaceShapeList()

getRotationAngleX()

getRotationAngleY()

getRotationAngleZ()

You can import the contour and key point detection capability package.

  1. dependencies{
  2.    // Import the contour and key point detection capability package.
  3.    implementation 'com.huawei.hms:ml-computer-vision-face-shape-point-model:1.0.4.300'
  4. }

4. The following four APIs are basic APIs and can be supported as long as one or more of the preceding packages are imported: 

getBorder()

getCoordinatePoint()

getHeight()

getWidth()

If you have integrated bank card recognition, you need to upgrade the bank card recognition plug-in to the latest version. If you have integrated the bank card recognition capability package, upgrade it to the latest version.

  1. dependencies{
  2.    // Import the bank card recognition plug-in package.
  3.    implementation 'com.huawei.hms:ml-computer-card-bcr-plugin:2.0.0.300'
  4.    // Import the bank card recognition capability package.
  5.    implementation 'com.huawei.hms:ml-computer-card-bcr-model:2.0.0.300'
  6. }

If the capability packages of other services are integrated, upgrade the capability package version to the latest version of ML Kit.

Upgrading 1.0.4.xxx to 2.0.0.xxx

  1. dependencies{
  2.    // Import the TTS SDK.
  3.    implementation 'com.huawei.hms:ml-computer-voice-tts:2.0.0.401'
  4. }

Add the onAudioAvailable method to the TTS callback (MLTtsCallback callback = new MLTtsCallback()).

  1. MLTtsCallback callback = new MLTtsCallback() {
  2.    @Override
  3.    public void onAudioAvailable(String taskId, MLTtsAudioFragment audioFragment, int offset, Pair<Integer, Integer> range,
  4.        Bundle bundle){
  5.        // Audio stream processing logic.
  6.    }
  7. }

This method is used to return the synthesized audio stream to your app. You can use this method to process the audio stream generated by TTS. For details, please refer to Development Process of TTS.