Git Product home page Git Product logo

Comments (4)

shiffman avatar shiffman commented on June 18, 2024 1

Ah yes, I think we decided not to include this since it wasn't part of what the native model anymore. I can see how it could be nice to bring back! From my own experience, I very rarely had students use the skeleton connections, the actual points are almost always what they focused on. @MOQN I know you taught quite a bit with PoseNet, what do you think? Is it worth the extra effort and maintenance required to add this data into the model output?

@ziyuan-linn also, if you recall anything different from our conversations, let us know!

from ml5-next-gen.

ziyuan-linn avatar ziyuan-linn commented on June 18, 2024 1

Yes, I also remember that we decided to not include it. If I recall correctly we were also planning on making an example p5 sketch that draws the skeleton connections manually.

from ml5-next-gen.

lindapaiste avatar lindapaiste commented on June 18, 2024

I'm looking at the @tfjs-model now and I'm not seeing any equivalent to the getAdjacentKeyPoints method. If we wanted to implement this ourselves, we can look at the source from the old PoseNet. It's pretty simple. We would need to:

  1. Define the pairings of connected points (names or indices) for each model
const connectedPartNames: StringTuple[] = [
  ['leftHip', 'leftShoulder'], ['leftElbow', 'leftShoulder'],
  ['leftElbow', 'leftWrist'], ['leftHip', 'leftKnee'],
  ['leftKnee', 'leftAnkle'], ['rightHip', 'rightShoulder'],
  ['rightElbow', 'rightShoulder'], ['rightElbow', 'rightWrist'],
  ['rightHip', 'rightKnee'], ['rightKnee', 'rightAnkle'],
  ['leftShoulder', 'rightShoulder'], ['leftHip', 'rightHip']
];
export const connectedPartIndices = connectedPartNames.map(
    ([jointNameA, jointNameB]) => ([partIds[jointNameA], partIds[jointNameB]]));

https://github.com/tensorflow/tfjs-models/blob/facabba571b36ad63e172649c2420cc002cb8a71/posenet/src/keypoints.ts

  1. Map these pairings to the detected points

  2. Remove any connections where one or both points was not found, or was low-confidence.

function eitherPointDoesntMeetConfidence(
    a: number, b: number, minConfidence: number): boolean {
  return (a < minConfidence || b < minConfidence);
}

export function getAdjacentKeyPoints(
    keypoints: Keypoint[], minConfidence: number): Keypoint[][] {
  return connectedPartIndices.reduce(
      (result: Keypoint[][], [leftJoint, rightJoint]): Keypoint[][] => {
        if (eitherPointDoesntMeetConfidence(
                keypoints[leftJoint].score, keypoints[rightJoint].score,
                minConfidence)) {
          return result;
        }


        result.push([keypoints[leftJoint], keypoints[rightJoint]]);


        return result;
      }, []);
}

https://github.com/tensorflow/tfjs-models/blob/facabba571b36ad63e172649c2420cc002cb8a71/posenet/src/util.ts#L23-L42

from ml5-next-gen.

MOQN avatar MOQN commented on June 18, 2024

I agree with the approach! Since many students tend to visualize the skeleton using their own aesthetics, providing an example of manually drawing individual skeletal parts could be helpful for our students.

from ml5-next-gen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.