Skip to content

Instantly share code, notes, and snippets.

@zaleslaw
Created June 9, 2022 09:50
Show Gist options
  • Save zaleslaw/ccff494a2b86d4db64fff529efb43d03 to your computer and use it in GitHub Desktop.
Save zaleslaw/ccff494a2b86d4db64fff529efb43d03 to your computer and use it in GitHub Desktop.
Detects multiple poses
model.use { poseDetectionModel ->
val imageFile = …
val detectedPoses = poseDetectionModel.detectPoses(imageFile = imageFile, confidence = 0.0f)
detectedPoses.multiplePoses.forEach { detectedPose ->
println("Found ${detectedPose.first.classLabel} with probability ${detectedPose.first.probability}")
detectedPose.second.poseLandmarks.forEach {
println("Found ${it.poseLandmarkLabel} with probability ${it.probability}")
}
detectedPose.second.edges.forEach {
println("The ${it.poseEdgeLabel} starts at ${it.start.poseLandmarkLabel} and ends with ${it.end.poseLandmarkLabel}")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment