Skip to content

Instantly share code, notes, and snippets.

@obeshor
Created July 16, 2019 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obeshor/fd404ca8345380811df3e4babbb3f9e4 to your computer and use it in GitHub Desktop.
Save obeshor/fd404ca8345380811df3e4babbb3f9e4 to your computer and use it in GitHub Desktop.
fun recognizeImage(bitmap: Bitmap): List<Classifier.Recognition> {
val scaledBitmap = Bitmap.createScaledBitmap(bitmap, INPUT_SIZE, INPUT_SIZE, false)
val byteBuffer = convertBitmapToByteBuffer(scaledBitmap)
val result = Array(1) { FloatArray(LABEL_LIST.size) }
INTERPRETER.run(byteBuffer, result)
return getSortedResult(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment