1

I'm attempting to use a modified version of the google example for image categorization. I've got everything working except for one thing. The CustomImageLabelerOptions class is not found.

I've got

    implementation 'com.google.mlkit:image-labeling-custom:16.3.1'
    //implementation 'com.google.mlkit:image-labeling:17.0.4'

and


    aaptOptions {
        noCompress "tflite"
        // or noCompress "lite"
    }

in the grade file. I've also added maven appropriately.

Here is the code where I'm trying to use CustomImageLabelerOptions.

val cats_dogs_model = LocalModel.Builder().setAssetFilePath("cat_vs_dog.tflite").build()
        val customImageLabelerOptions = CustomImageLabelerOptions.Builder(cats_dogs_model)
                .setConfidenceThreshold(0.5f)
                .setMaxResultCount(5)
                .build()

Any ideas why the class is not found?

Lee
  • 29
  • 3

1 Answers1

1

I've tried this dependency implementation 'com.google.mlkit:image-labeling-custom:16.3.1' locally and it seems working fine for me.

Did you sync the project after adding implementation 'com.google.mlkit:image-labeling-custom:16.3.1' to build.gradle file?

yliu
  • 51
  • 2