Skip to content

Instantly share code, notes, and snippets.

@muhwyndhamhp
Created July 13, 2022 08:01
Show Gist options
  • Save muhwyndhamhp/10210299f86cef1e9030f483dfed7cf3 to your computer and use it in GitHub Desktop.
Save muhwyndhamhp/10210299f86cef1e9030f483dfed7cf3 to your computer and use it in GitHub Desktop.
val interpreterOptions = Interpreter.Options().apply {
setNumThreads(4)
}
val interpreter = Interpreter(FileUtil.loadMappedFile(context, "model.tflite"), interpreterOptions)
private fun runFaceNet(inputs: Any): Array<FloatArray> {
val faceNetModelOutputs: MutableMap<Int, Any> = HashMap()
faceNetModelOutputs[0] = Array(1) { FloatArray(embeddingDim) }
interpreter.runForMultipleInputsOutputs(arrayOf(inputs), faceNetModelOutputs)
return faceNetModelOutputs[0] as Array<FloatArray>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment