Code Monkey home page Code Monkey logo

3d-posenet's People

Contributors

mishig25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3d-posenet's Issues

How do I use it?

A javascript error will occur when opening index.html.
Please tell me how to do it.

PoseNet is not accurate and unstable whatever people pose

Great Job! Thanks for sharing it!
I am running PoseNet on PC and saw that whatever people pose, the model can't detect the legs of the person, does this is something that is happening only to me, or is it a general problem. If so is there any way I can improve the accuracy of PoseNet?
Running on PC: Micro-Star (Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz 2.20 GHz)
Also why it's so unstable, I mean I stay in one place and points keep changing places
Can it work better on black and white frames?
Should I have a dark background image?

Model's head is the only thing that is updating

The only thing that is being updated on the model is the rotation of the head, the shoulders and arms are not moving as they are in the example video. It looks as if that part of the code might have been left out. Any way to get that added back or updated?

Not updating arm positions

Hi,

Thanks for the awesome code! I found a few small problems.

On https://github.com/mishig25/3d-posenet/blob/master/posenet.js, line 132 (ish) I think you should be including something like:
`
// hip, shoulder, elbow

// Replace keypoint indices with joint names if needed

const angleRight = self.transform.rotateJoint(24, 12, 14);

const angleLeft = self.transform.rotateJoint(23, 11, 13);
`

In my own implementation I actually rewrote much of your rotateJoint function. It turns out you really only need two keypoints per joint. If you want to rotate the shoulder, you can simply pass in the shoulder and elbow joint. The BabylonJS skeleton model can be thought of actually acting on joints, even though the data structure is called skeleton.bones (to be more precise, the "bone" directly maps to the "parent joint", which, for the forearm for example, maps to the elbow).

Finally, I found using bone.setYawPitchRoll to be the most effective way to move the skeleton. This function rotates the skeleton in absolute coordinates, which more closely follows the data you receive from the pose detector. Some trigonometry can be used to convert the direction vector of the bone to pitch, roll, and yaw.

For reference, here is my implementation:
`
// Within the Transform Class
rotateJoint(jointA, jointB){
if (this.keypoints[jointA] && this.keypoints[jointB])
{
let a = this.keypoints[jointA]
let b = this.keypoints[jointB]

	if (isNaN(a.x + a.y + a.z + b.x + b.y + b.z))
	{
		this.joints.update({ "x": 0, "y": 0, "z": 0 })
		return
	}

	let dir = { "x": (b.x - a.x), "y": (b.y - a.y), "z": -(b.z - a.z) * this.zFactor}
	
	// Divide all values by the "size" of the vector (so that all values lie between 0-1)
	dir = this.normalize(dir)
	
	// Note that this is no longer returning angles
	// Rather it is returning a 3D vector of the direction the bone faces
	// A little bit of re-orientation might be needed when rendering to the model (described below)
	this.joints.update(jointA, dir);
}

}

// Within the Babylon Scene. Called from this.scene.registerBeforeRender
rotate(joint, data, mesh, flipAxis, isLeg)
{
let x = data.x
let y = data.y
let z = data.z

if (isNaN(x + y + z))
	return

// We use triginometry to convert the normalized direction vector into a pitch, roll, and yaw
// ... Well technically it only gives you pitch and yaw, the roll is another problem to solve

// How far to move the part forward and backward (along z axis)
let yaw = Math.asin(z) * Math.abs(x)
if (yaw > Math.PI / 2)
	yaw = Math.PI / 2
if (yaw < -Math.PI / 2)
	yaw = Math.PI / 2


if (isLeg)
{
	// How far to move the part up and down (along y axis)
	let pitch = Math.PI / 2 - Math.atan2(y, x)

	let roll = -Math.PI / 2
	yaw = -(yaw + Math.PI / 2)

	// Order of the rotations is flipped because of the default world orientation compared to the orientation of the bone
	joint.setYawPitchRoll(roll, pitch, yaw, BABYLON.Space.WORLD, mesh)
}
else
{
	let pitch = Math.atan2(y, x)
	let roll = Math.PI

	// Order of the rotations is flipped because of the default world orientation
	joint.setYawPitchRoll(yaw, roll, pitch, BABYLON.Space.WORLD, mesh)
}

}
`

Thanks!

The demo is broken

Only the head position is getting mapped to model and the rest of model stays in the Tpose.

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.