ML Kit AutoML Vision Edge 마이그레이션 가이드

AutoML로 학습된 이미지 분류 모델을 커스텀 모델 API에 전달할 수 있습니다. 모델을 계속 앱 내에서 번들로 묶거나 Firebase Console에서 커스텀 모델로 호스팅할 수 있습니다. AutoML 이미지 라벨 지정 API는 커스텀 모델 이미지 라벨 지정 API로 완전히 대체되었으므로 ML Kit에서 삭제되었습니다.

API어떤 점이 달라지나요?
AutoML Vision Edge 이미지 라벨 지정 API 커스텀 모델 이미지 라벨 지정 API로 완전히 대체되었습니다. 기존 AutoML Vision Edge 이미지 라벨 지정 API는 삭제되었습니다.

현재 AutoML Vision Edge API를 사용하는 ML Kit 사용자인 경우 Android 및 iOS용 마이그레이션 안내를 따르세요.

자주 묻는 질문(FAQ)

변경 이유

이를 통해 ML Kit API를 간소화하고 ML Kit를 앱에 더 쉽게 통합할 수 있습니다. 이번 변경으로 AutoML 학습 모델을 커스텀 모델과 정확히 동일한 방식으로 사용할 수 있습니다. 또한 현재 지원되는 이미지 라벨 지정 외에도 객체 감지 및 추적을 위해 AutoML 학습 모델을 사용할 수 있습니다. 또한 커스텀 모델 API는 메타데이터에 라벨 맵이 삽입된 모델과 별도의 매니페스트 및 라벨 파일이 있는 모델을 모두 지원합니다.

새 SDK로 이전하면 어떤 이점이 있나요?

  • 새로운 기능: 이미지 라벨 지정과 객체 감지 및 추적 모두에 AutoML 학습 모델을 사용할 수 있고 메타데이터에 라벨 맵이 삽입된 모델을 사용할 수 있습니다.

Android용 이전 가이드

1단계: Gradle 가져오기 업데이트

다음 표에 따라 모듈(앱 수준) Gradle 파일 (일반적으로 app/build.gradle)에서 ML Kit Android 라이브러리의 종속 항목을 업데이트합니다.

특성오래된 아티팩트새로운 아티팩트
원격 모델을 다운로드하지 않고 AutoML 이미지 라벨 지정 com.google.mlkit:image-labeling-automl:16.2.1 com.google.mlkit:image-labeling-custom:16.0.0-beta5
원격 모델 다운로드로 AutoML 이미지 라벨 지정 com.google.mlkit:image-labeling-automl:16.2.1
com.google.mlkit:linkfirebase:16.0.1
com.google.mlkit:image-labeling-custom:16.0.0-beta5
com.google.mlkit:linkfirebase:17.0.0

2단계: 클래스 이름 업데이트하기

클래스가 이 표에 표시되면 표시된 대로 변경합니다.

이전 클래스새 수업
com.google.mlkit.vision.label.automl.AutoMLImageLabelerLocalModel com.google.mlkit.common.model.LocalModel
com.google.mlkit.vision.label.automl.AutoMLImageLabelerRemoteModel com.google.mlkit.common.model.CustomRemoteModel
com.google.mlkit.vision.label.automl.AutoMLImageLabelerOptions com.google.mlkit.vision.label.custom.CustomImageLabelerOptions

3단계: 메서드 이름 업데이트

최소한의 코드 변경사항은 있습니다.

  • LocalModel은 이제 모델 파일 경로 (모델에 라벨 맵이 포함된 메타데이터가 있는 경우) 또는 모델 매니페스트 파일 경로 (매니페스트, 모델, 라벨이 별도의 파일에 있는 경우)로 초기화할 수 있습니다.
  • Firebase Console을 통해 커스텀 모델을 원격으로 호스팅하고 FirebaseModelSourceCustomRemoteModel를 초기화할 수 있습니다.

다음은 기존 Kotlin 메서드와 새로운 Kotlin 메서드의 몇 가지 예입니다.

변경 전

val localModel = AutoMLImageLabelerLocalModel.Builder()
    .setAssetFilePath("automl/manifest.json")
    // or .setAbsoluteFilePath(absolute file path to manifest file)
    .build()

val optionsWithLocalModel = AutoMLImageLabelerOptions.Builder(localModel)
    .setConfidenceThreshold(0.5f)
    .build()

val remoteModel = AutoMLImageLabelerRemoteModel.Builder("automl_remote_model")
    .build()

val optionsWithRemoteModel = AutoMLImageLabelerOptions.Builder(remoteModel)
    .build()

신규

val localModel = LocalModel.Builder()
    .setAssetManifestFilePath("automl/manifest.json")
    // or .setAbsoluteManifestFilePath(absolute file path to manifest file)
    .build()

val optionsWithLocalModel = CustomImageLabelerOptions.Builder(localModel)
    .setConfidenceThreshold(0.5f)
    .build()

val firebaseModelSource = FirebaseModelSource.Builder("automl_remote_model")
    .build()
val remoteModel = CustomRemoteModel.Builder(firebaseModelSource).build()
val optionsWithRemoteModel = CustomImageLabelerOptions.Builder(remoteModel)
    .build()

다음은 이전 Java 메서드와 새로운 Java 메서드의 몇 가지 예입니다.

변경 전

AutoMLImageLabelerLocalModel localModel =
    new AutoMLImageLabelerLocalModel.Builder()
        .setAssetFilePath("automl/manifest.json")
        // or .setAbsoluteFilePath(absolute file path to manifest file)
        .build();
AutoMLImageLabelerOptions optionsWithLocalModel =
    new AutoMLImageLabelerOptions.Builder(localModel)
        .setConfidenceThreshold(0.5f)
        .build();
AutoMLImageLabelerRemoteModel remoteModel =
    new AutoMLImageLabelerRemoteModel.Builder("automl_remote_model").build();
AutoMLImageLabelerOptions optionsWithRemoteModel =
    new AutoMLImageLabelerOptions.Builder(remoteModel)
        .build();

신규

LocalModel localModel =
    new LocalModel.Builder()
        .setAssetManifestFilePath("automl/manifest.json")
        // or .setAbsoluteManifestFilePath(absolute file path to manifest file)
        .build()
CustomImageLabelerOptions optionsWithLocalModel =
    new CustomImageLabelerOptions.Builder(localModel)
        .setConfidenceThreshold(0.5f)
        .build();
FirebaseModelSource firebaseModelSource =
    new FirebaseModelSource.Builder("automl_remote_model").build();
CustomRemoteModel remoteModel =
    new CustomRemoteModel.Builder(firebaseModelSource).build();
CustomImageLabelerOptions optionsWithRemoteModel =
    new CustomImageLabelerOptions.Builder(remoteModel).build();

iOS용 이전 가이드

기본 요건

  • Xcode 13.2.1 이상이 필요합니다.

1단계: Cocoapods 업데이트

앱의 Podfile에서 ML Kit iOS 코코아포드의 종속 항목을 업데이트합니다.

특성이전 포드 이름새 포드 이름
원격 모델을 다운로드하지 않고 AutoML 이미지 라벨 지정 GoogleMLKit/ImageLabelingAutoML GoogleMLKit/이미지 라벨 지정
원격 모델 다운로드로 AutoML 이미지 라벨 지정 GoogleMLKit/ImageLabelingAutoML
GoogleMLKit/LinkFirebase
GoogleMLKit/ImageLabelingCustom
GoogleMLKit/LinkFirebase

2단계: 클래스 이름 업데이트하기

클래스가 이 표에 표시되면 표시된 대로 변경합니다.

Swift

이전 클래스새 수업
AutoMLImageLabelerLocalModel LocalModel
AutoMLImageLabelerRemoteModel CustomRemoteModel
AutoMLImageLabelerOptions CustomImageLabelerOptions

Objective-C

이전 클래스새 수업
MLKAutoMLImageLabelerLocalModel MLKLocalModel
MLKAutoMLImageLabelerRemoteModel MLKCustomRemoteModel
MLKAutoMLImageLabelerOptions MLKCustomImageLabelerOptions

Objective-C

3단계: 메서드 이름 업데이트

최소한의 코드 변경사항은 있습니다.

  • LocalModel은 이제 모델 파일 경로 (모델에 라벨 맵이 포함된 메타데이터가 있는 경우) 또는 모델 매니페스트 파일 경로 (매니페스트, 모델, 라벨이 별도의 파일에 있는 경우)로 초기화할 수 있습니다.
  • Firebase Console을 통해 커스텀 모델을 원격으로 호스팅하고 FirebaseModelSourceCustomRemoteModel를 초기화할 수 있습니다.

다음은 기존 Swift 메서드와 새로운 Swift 메서드의 몇 가지 예입니다.

변경 전

let localModel =
    AutoMLImageLabelerLocalModel(manifestPath: "automl/manifest.json")
let optionsWithLocalModel = AutoMLImageLabelerOptions(localModel: localModel)
let remoteModel = AutoMLImageLabelerRemoteModel(name: "automl_remote_model")
let optionsWithRemoteModel = AutoMLImageLabelerOptions(remoteModel: remoteModel)

신규

guard let localModel = LocalModel(manifestPath: "automl/manifest.json") else { return }
let optionsWithLocalModel = CustomImageLabelerOptions(localModel: localModel)
let firebaseModelSource = FirebaseModelSource(name: "automl_remote_model")
let remoteModel = CustomRemoteModel(remoteModelSource: firebaseModelSource)
let optionsWithRemoteModel = CustomImageLabelerOptions(remoteModel: remoteModel)

다음은 기존 Objective-C 메서드와 새로운 Objective-C 메서드의 몇 가지 예입니다.

변경 전

MLKAutoMLImageLabelerLocalModel *localModel =
    [[MLKAutoMLImageLabelerLocalModel alloc]
        initWithManifestPath:"automl/manifest.json"];
MLKAutoMLImageLabelerOptions *optionsWithLocalModel =
    [[MLKAutoMLImageLabelerOptions alloc] initWithLocalModel:localModel];
MLKAutoMLImageLabelerRemoteModel *remoteModel =
    [[MLKAutoMLImageLabelerRemoteModel alloc]
        initWithManifestPath:"automl/manifest.json"];
MLKAutoMLImageLabelerOptions *optionsWithRemoteModel =
    [[MLKAutoMLImageLabelerOptions alloc] initWithRemoteModel:remoteModel];

신규

MLKLocalModel *localModel =
    [[MLKLocalModel alloc] initWithManifestPath:"automl/manifest.json"];
MLKCustomImageLabelerOptions *optionsWithLocalModel =
    [[MLKCustomImageLabelerOptions alloc] initWithLocalModel:localModel];
MLKFirebaseModelSource *firebaseModelSource =
    [[MLKFirebaseModelSource alloc] initWithName:@"automl_remote_model"];
MLKCustomRemoteModel *remoteModel =
    [[MLKCustomRemoteModel alloc] initWithRemoteModelSource:firebaseModelSource];
MLKCustomImageLabelerOptions *optionsWithRemoteModel =
    [[MLKCustomImageLabelerOptions alloc] initWithRemoteModel:remoteModel];