Skip to content

Instantly share code, notes, and snippets.

@silphire
Last active May 22, 2021 02:08
Show Gist options
  • Save silphire/8ba556ff70d4830d65e882c69e2086bd to your computer and use it in GitHub Desktop.
Save silphire/8ba556ff70d4830d65e882c69e2086bd to your computer and use it in GitHub Desktop.
test code of tensorflow.js with BlazePose
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/pose-detection"></script>
</head>
<body>
<img id="image" src="./image.jpg">
<script>
window.onload = async () => {
const detector = await poseDetection.createDetector(
poseDetection.SupportedModels.BlazePose,
{runtime: 'tfjs', modelType:'lite'}
);
const image = document.getElementById('image');
poses = await detector.estimatePoses(image);
console.log(poses[0]);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment