AutoML 학습 이미지 분류 모델을 커스텀 모델 API에 전달할 수 있습니다. 앱 내부에 모델을 번들로 묶거나 Firebase Console에서 커스텀 모델로 호스팅할 수 있습니다. AutoML 이미지 라벨 지정 API는 커스텀 모델 이미지 라벨 지정 API로 완전히 대체되었으므로 ML Kit에서 삭제되었습니다.
| API | 어떤 점이 달라지나요? |
|---|---|
| AutoML Vision Edge 이미지 라벨 지정 API | 커스텀 모델 이미지 라벨 지정 API로 완전히 대체되었습니다. 기존 AutoML Vision Edge 이미지 라벨 지정 API가 삭제되었습니다. |
AutoML Vision Edge API를 사용하는 경우 Android 및 iOS의 마이그레이션 안내를 따르세요.
자주 묻는 질문(FAQ)
변경되는 이유는 무엇인가요?
ML Kit API를 간소화하고 ML Kit를 앱에 더 쉽게 통합할 수 있도록 지원합니다. 이 변경사항을 통해 커스텀 모델과 동일한 방식으로 AutoML 학습 모델을 사용할 수 있습니다. 또한 지원하는 이미지 라벨 지정 외에도 객체 감지 및 추적에 AutoML 학습 모델을 사용할 수 있습니다. 또한 커스텀 모델 API는 메타데이터에 라벨 맵이 삽입된 모델과 별도의 매니페스트 및 라벨 파일이 있는 모델을 모두 지원합니다.
새 SDK로 마이그레이션하면 어떤 이점이 있나요?
- 새로운 기능: 이미지 라벨 지정과 객체 감지 및 추적 모두에 AutoML 학습 모델을 사용할 수 있으며 메타데이터에 라벨 맵이 삽입된 모델을 사용할 수 있습니다.
Android 마이그레이션 가이드
1단계: Gradle 가져오기 업데이트
다음 표에 따라 모듈(앱 수준) Gradle 파일 (일반적으로 app/build.gradle.kts)에서 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 커스텀 모델을 호스팅하고 다운로드하려면 모델을 Cloud Storage로 이동하고 앱에 다운로드 로직을 추가하여 LocalModel을 사용하여 로드합니다. 자세한 내용은 [Firebase ML에서 Cloud Storage로의 마이그레이션 가이드][migrate-storage]를 참고하세요. |
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.LocalModel 앱에는 원격 호스팅 모델을 다운로드하고 LocalModel을 사용하여 초기화하는 로직이 포함되어야 합니다. |
| com.google.mlkit.vision.label.automl.AutoMLImageLabelerOptions | com.google.mlkit.vision.label.custom.CustomImageLabelerOptions |
3단계: 메서드 이름 업데이트
약간의 코드 수정이 필요합니다.
- 이제 모델 경로 (모델에 라벨 맵이 포함된 메타데이터가 있는 경우) 또는 모델 매니페스트 경로 (매니페스트, 모델, 라벨이 별도의 파일에 있는 경우)로
LocalModel을 초기화할 수 있습니다. - 원격 호스팅 모델을 로컬 스토리지에 다운로드하고
LocalModel을 사용하여 로드하는 로직을 앱에 추가합니다.
다음은 이전 및 새로운 Kotlin 메서드의 몇 가지 예입니다.
이전
val localModel = AutoMLImageLabelerLocalModel.Builder() .setAssetFilePath("automl/manifest.json") // or .setAbsoluteFilePath(absolute 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()
신규
// Similar process for both local and remotely-hosted models (that have been downloaded) val localModel = LocalModel.Builder() .setAssetManifestFilePath("automl/manifest.json") // or .setAbsoluteManifestFilePath(absolute path to manifest file) .build() val optionsWithLocalModel = CustomImageLabelerOptions.Builder(localModel) .setConfidenceThreshold(0.5f) .build()
다음은 이전 및 새로운 Java 메서드의 몇 가지 예입니다.
이전
AutoMLImageLabelerLocalModel localModel = new AutoMLImageLabelerLocalModel.Builder() .setAssetFilePath("automl/manifest.json") // or .setAbsoluteFilePath(absolute 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();
신규
// Similar process for local models and remotely-hosted models (that have been downloaded) LocalModel localModel = new LocalModel.Builder() .setAssetManifestFilePath("automl/manifest.json") // or .setAbsoluteManifestFilePath(absolute path to manifest file) .build(); CustomImageLabelerOptions optionsWithLocalModel = new CustomImageLabelerOptions.Builder(localModel) .setConfidenceThreshold(0.5f) .build();
iOS 마이그레이션 가이드
기본 요건
- Xcode 13.2.1 이상이 필요합니다.
1단계: Cocoapods 업데이트
앱의 Podfile에서 ML Kit iOS cocoapods의 종속 항목을 업데이트합니다.
| 기능 | 이전 pod 이름 | 새로운 pod 이름 |
|---|---|---|
| 원격 모델 다운로드 없이 이미지 라벨 지정 AutoML | GoogleMLKit/ImageLabelingAutoML | GoogleMLKit/ImageLabelingCustom |
| 원격 모델 다운로드로 이미지 라벨 지정 AutoML |
GoogleMLKit/ImageLabelingAutoML GoogleMLKit/LinkFirebase |
GoogleMLKit/ImageLabelingCustom 커스텀 모델을 호스팅하고 다운로드하려면 모델을 Cloud Storage로 이동하고 앱에 다운로드 로직을 추가하여 로컬 모델로 로드합니다. 자세한 내용은 [Firebase ML에서 Cloud Storage로의 마이그레이션 가이드][migrate-storage]를 참고하세요. |
2단계: 클래스 이름 업데이트
클래스가 이 표에 표시되면 표시된 변경사항을 적용합니다.
Swift
| 이전 클래스 | 새로운 클래스 |
|---|---|
| AutoMLImageLabelerLocalModel | LocalModel |
| AutoMLImageLabelerRemoteModel |
LocalModel 커스텀 모델을 호스팅하고 다운로드하려면 모델을 Cloud Storage로 이동하고 앱에 다운로드 로직을 추가하여 로컬 모델로 로드합니다. 자세한 내용은 [Firebase ML에서 Cloud Storage로의 마이그레이션 가이드][migrate-storage]를 참고하세요. |
| AutoMLImageLabelerOptions | CustomImageLabelerOptions |
Objective-C
| 이전 클래스 | 새로운 클래스 |
|---|---|
| MLKAutoMLImageLabelerLocalModel | MLKLocalModel |
| MLKAutoMLImageLabelerRemoteModel |
MLKLocalModel 커스텀 모델을 호스팅하고 다운로드하려면 모델을 Cloud Storage로 이동하고 앱에 다운로드 로직을 추가하여 로컬 모델로 로드합니다. 자세한 내용은 [Firebase ML에서 Cloud Storage로의 마이그레이션 가이드][migrate-storage]를 참고하세요. |
| MLKAutoMLImageLabelerOptions | MLKCustomImageLabelerOptions |
3단계: 메서드 이름 업데이트
약간의 코드 수정이 필요합니다.
- 이제 모델 경로 (모델에 라벨 맵이 포함된 메타데이터가 있는 경우) 또는 모델 매니페스트 경로 (매니페스트, 모델, 라벨이 별도의 파일에 있는 경우)로
LocalModel을 초기화할 수 있습니다. - 원격 호스팅 모델을 로컬 스토리지에 다운로드하고
LocalModel을 사용하여 로드하는 로직을 앱에 추가합니다.
다음은 이전 및 새로운 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)신규
// Similar process for local models and remotely-hosted models (that have been downloaded) guard let localModel = LocalModel(manifestPath: "automl/manifest.json") else { return } let optionsWithLocalModel = CustomImageLabelerOptions(localModel: localModel)
다음은 이전 및 새로운 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];
신규
// Similar process for local models and remotely-hosted models (that have been downloaded) MLKLocalModel *localModel = [[MLKLocalModel alloc] initWithManifestPath:"automl/manifest.json"]; MLKCustomImageLabelerOptions *optionsWithLocalModel = [[MLKCustomImageLabelerOptions alloc] initWithLocalModel:localModel];