ML Kit AutoML Vision Edge taşıma kılavuzu

AutoML ile eğitilmiş bir görüntü sınıflandırma modelini özel model API'lerine iletebilirsiniz. Modeli uygulamanızın içine paketlemeye veya Firebase Konsolu'nda özel model olarak barındırmaya devam edebilirsiniz. AutoML görüntü etiketleme API'si, Custom Model Image Labeling API ile tamamen değiştirildiği için ML Kit'ten kaldırıldı.

APINeler değişiyor?
AutoML Vision Edge görüntü etiketleme API'si Bu API'nin yerini tamamen Custom Model Image Labeling API almıştır. Mevcut AutoML Vision Edge görüntü etiketleme API'si kaldırıldı.

Şu anda AutoML Vision Edge API'yi kullanan bir ML Kit kullanıcısıysanız lütfen Android ve iOS için taşıma talimatlarını uygulayın.

Sık Sorulan Sorular

Bu değişiklik neden yapıldı?

Bu değişiklik, ML Kit API'lerini basitleştirmenize ve ML Kit'i uygulamanıza entegre etmenizi kolaylaştırır. Bu değişiklikle, AutoML ile eğitilmiş bir modeli özel bir modelle aynı şekilde kullanabilirsiniz. Ayrıca, şu anda desteklediğimiz Görüntü Etiketleme'ye ek olarak Nesne Algılama ve İzleme için AutoML ile eğitilmiş modelleri kullanmanıza da olanak tanır. Ayrıca, özel model API'si hem meta verilerine yerleştirilmiş etiket haritası olan modelleri hem de ayrı manifest ve etiket dosyaları olan modelleri destekler.

Yeni SDK'ya geçiş yapmanın avantajları nelerdir?

  • Yeni özellikler: Hem görüntü etiketleme hem de nesne algılama ve izleme için AutoML ile eğitilmiş modelleri kullanma ve meta verilerine etiket haritası yerleştirilmiş modelleri kullanma olanağı.

Android için Taşıma Rehberi

1. adım: Gradle içe aktarma işlemlerini güncelleyin

Modülünüzdeki (uygulama düzeyinde) Gradle dosyanızda (genellikle app/build.gradle) ML Kit Android kitaplıklarının bağımlılıklarını aşağıdaki tabloya göre güncelleyin:

ÖzellikEski YapılarYeni Yapı
Uzaktan model indirme olmadan görüntü etiketleme AutoML com.google.mlkit:image-labeling-automl:16.2.1 com.google.mlkit:image-labeling-custom:16.0.0-beta5
Uzaktan model indirme özelliğiyle görüntü etiketleme için 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. adım: Sınıf adlarını güncelleyin

Sınıfınız bu tabloda görünüyorsa belirtilen değişikliği yapın:

Eski sınıfYeni sınıf
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. adım: Yöntem adlarını güncelleyin

Kodda çok az değişiklik yapılması gerekir:

  • LocalModel artık bir model dosya yoluyla (modelde etiket haritasını içeren meta veriler varsa) veya bir model manifest dosya yoluyla (manifest, model ve etiketler ayrı dosyalardaysa) başlatılabilir.
  • Firebase konsolu aracılığıyla özel bir modeli uzaktan barındırabilir ve CustomRemoteModel ile FirebaseModelSource başlatabilirsiniz.

Eski ve yeni Kotlin yöntemlerine ilişkin bazı örnekleri aşağıda bulabilirsiniz:

Önceki

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()

Yeni

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()

Eski ve yeni Java yöntemlerine ilişkin bazı örnekleri aşağıda bulabilirsiniz:

Önceki

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();

Yeni

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 için Taşıma Rehberi

Ön koşullar

  • Xcode 13.2.1 veya daha yeni bir sürüm gereklidir.

1. adım: Cocoapods'u güncelleyin

Uygulamanızın Podfile'ında ML Kit iOS cocoapods'larının bağımlılıklarını güncelleyin:

ÖzellikEski kapsül adlarıYeni pod adı
Uzaktan model indirme olmadan görüntü etiketleme AutoML GoogleMLKit/ImageLabelingAutoML GoogleMLKit/ImageLabelingCustom
Uzaktan model indirme özelliğiyle görüntü etiketleme için AutoML GoogleMLKit/ImageLabelingAutoML
GoogleMLKit/LinkFirebase
GoogleMLKit/ImageLabelingCustom
GoogleMLKit/LinkFirebase

2. adım: Sınıf adlarını güncelleyin

Sınıfınız bu tabloda görünüyorsa belirtilen değişikliği yapın:

Swift

Eski sınıfYeni sınıf
AutoMLImageLabelerLocalModel LocalModel
AutoMLImageLabelerRemoteModel CustomRemoteModel
AutoMLImageLabelerOptions CustomImageLabelerOptions

Objective-C

Eski sınıfYeni sınıf
MLKAutoMLImageLabelerLocalModel MLKLocalModel
MLKAutoMLImageLabelerRemoteModel MLKCustomRemoteModel
MLKAutoMLImageLabelerOptions MLKCustomImageLabelerOptions

Objective-C

3. adım: Yöntem adlarını güncelleyin

Kodda çok az değişiklik yapılması gerekir:

  • LocalModel artık bir model dosya yoluyla (modelde etiket haritasını içeren meta veriler varsa) veya bir model manifest dosya yoluyla (manifest, model ve etiketler ayrı dosyalardaysa) başlatılabilir.
  • Firebase konsolu aracılığıyla özel bir modeli uzaktan barındırabilir ve CustomRemoteModel ile FirebaseModelSource başlatabilirsiniz.

Eski ve yeni Swift yöntemlerine ilişkin bazı örnekleri aşağıda bulabilirsiniz:

Önceki

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

Yeni

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)

Eski ve yeni Objective-C yöntemlerine dair bazı örnekleri aşağıda bulabilirsiniz:

Önceki

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];

Yeni

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];