Skip to content

Instantly share code, notes, and snippets.

@neonankiti
Last active December 3, 2019 15:00
Show Gist options
  • Save neonankiti/153b5a94a14dc87ad024f63f52de278c to your computer and use it in GitHub Desktop.
Save neonankiti/153b5a94a14dc87ad024f63f52de278c to your computer and use it in GitHub Desktop.
Pose Estimation with TensorFlow Lite in Android Sample
@Throws(IOException::class)
private fun loadModelFile(activity: Activity): MappedByteBuffer {
// modelPath would be something like "image_classifier.tflite"
val fileDescriptor = activity.assets.openFd(modelPath)
val inputStream = FileInputStream(fileDescriptor.fileDescriptor)
val fileChannel = inputStream.channel
val startOffset = fileDescriptor.startOffset
val declaredLength = fileDescriptor.declaredLength
return fileChannel.map(MapMode.READ_ONLY, startOffset, declaredLength)
}
@neonankiti
Copy link
Author

This is copy of https://github.com/edvardHua/PoseEstimationForMobile/ projects.
This software includes the work that is distributed in the Apache License 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment