I am refactoring my codebase so that I can use MLImage for all the models that I am using (MLKit PoseDetection and a custom detection model TFLite). This was a success, however, I noticed that Google just introduced MlImageAdapter that basically converts an MLimage to TensorImage as the Tflite model requires the image in TensorImage format.
A code snippet from one of their latest commits is below:
public List<Detection> detect(MlImage image, ImageProcessingOptions options) {
image.getInternal().acquire();
TensorImage tensorImage = MlImageAdapter.createTensorImageFrom(image);
List<Detection> result = detect(tensorImage, options);
image.close();
return result;
}
indent preformatted text by 4 spaces
But as I try to use MlImageAdapter in my code base, it is unable to import it. And the dependencies in their BUILD file is puzzling for me and so I cannot add relevant dependencies in gradle file.
Provide us the dependencies you have used for the android project. Take a look here where you can find latest and there if you want to use nightly builds.
Use:
mavenCentral // should be already there
maven { // add this repo to use snapshots
name 'ossrh-snapshot'
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
}
I tried adding implementation("org.tensorflow:tensorflow-lite-task-vision:0.0.0-nightly-SNAPSHOT") , but It didn’t work. Probably it’s caching the 0.2.0 which shadows 0.0.0-nightly. I also tried 0.0.0-nightly-SNAPSHOT!! to make it strict, but this is also won’t do.
I see that MLImageAdapter is currently in snapshot build. So, if you guys have any plans to add this in stable build, then I can wait till then.