Pose Detection in the Browser: PoseNet Model Using TensorFlow.js

Pose Detection in the Browser: PoseNet Model Using TensorFlow.js

TensorFlow.js, an open-source library you can use to define, train, and run machine learning models entirely in the browser, using Javascript and a high-level layers API. If you're a Javascript developer who's new to ML, TensorFlow.js is a great way to begin learning.

PoseNet can be used to estimate either a single pose or multiple poses, meaning there is a version of the algorithm that can detect only one person in an image/video and one version that can detect multiple persons in an image/video.


Here are the Docs for PoseNet; https://github.com/tensorflow/tfjs-models/tree/master/posenet

Installation

You can use CDN for TensorFlow.js and PoseNet.js:

    <!-- Load TensorFlow.js -->
    <script src="https://unpkg.com/@tensorflow/[email protected]/dist/tf.min.js"></script>
    
<!-- Load Posenet -->
    <script src="https://unpkg.com/@tensorflow-models/[email protected]/dist/posenet.min.js"></script>
 
  

Simple Code for Demo

<html>
  <head>
    <!-- Load TensorFlow.js -->
    <script src="https://unpkg.com/@tensorflow/tfjs"></script>
    <!-- Load Posenet -->
    <script src="https://unpkg.com/@tensorflow-models/posenet"></script>
 </head>

  <body>
    <img id='cat' src='dog.jpg '/>
  </body>
  <!-- Place your code in the script tag below. You can also use an external .js file -->
  <script>
    var imageScaleFactor = 0.5;
    var outputStride = 16;
    var flipHorizontal = false;

    var imageElement = document.getElementById('cat');

    posenet.load().then(function(net){
      return net.estimateSinglePose(imageElement, imageScaleFactor, flipHorizontal, outputStride)
    }).then(function(pose){
      console.log(pose);
    })
  </script>
</html>
 
  




要查看或添加评论,请登录

Vrijraj Singh的更多文章

  • Getting Started with TensorFlow.js

    Getting Started with TensorFlow.js

    TensorFlow.js is an open source WebGL-accelerated JavaScript library for machine intelligence.

  • Google’s Women Techmakers Empowers Women Globally

    Google’s Women Techmakers Empowers Women Globally

    Driven by the belief that a diversity of perspectives leads to better decision-making and more relevant products…

  • Image classification using TensorFlow.js

    Image classification using TensorFlow.js

    For Image Classification like label detection we're going to use MobileNet Model which is define in TensorFlow.js.

  • How to Become an Excellent Interaction Designer?

    How to Become an Excellent Interaction Designer?

    In recent years, with the rise of the Internet industry, designer quickly became a popular profession. The thriving…

  • IoT: The Internet of (Every)thing?

    IoT: The Internet of (Every)thing?

    Gone are the days when I had to get up out of my bed to turn the lights on. Now every morning my lights slowly turn on…

  • What is Udacity Nanodegrees Program?

    What is Udacity Nanodegrees Program?

    Udacity offers some great courses in their Nanodegree programs. If you don’t have the money, and/or just don’t want to…

    1 条评论
  • What is AMP and Who Actually Needs It?

    What is AMP and Who Actually Needs It?

    Accelerated Mobile Pages (AMP) is set to roll out within Google’s mobile search results in February 2016. Here we…

  • What is Microsoft Azure & Why Use It?

    What is Microsoft Azure & Why Use It?

    An In-Depth Look at the Cloud Services Platform from Microsoft Today plenty of businesses still have real concerns…

  • Google Developers :: Solve For India

    Google Developers :: Solve For India

    Google Developers :: Solve for India initiative aims to nurture developers, tech entrepreneurs and reach, support…

  • Google IO Extended 2017, GDG-Jalandhar

    Google IO Extended 2017, GDG-Jalandhar

    Google I/O is an annual developer festival held at the outdoor Shoreline Amphitheatre. This year's festival built lots…

社区洞察

其他会员也浏览了