Git Product home page Git Product logo

Comments (6)

yehonatanyosefi avatar yehonatanyosefi commented on June 18, 2024

from ml5-library.

lindapaiste avatar lindapaiste commented on June 18, 2024

React stack traces are the worst. All I can tell is that somewhere inside classifyInternal (or any of the functions that it calls) there is an Object.keys(something) on a something which is not an object.

The only top-level Object.keys are on meta.inputs and meta.outputs. I don't know how those could be undefined but humor me and add some extra logging. The line we're looking for might be something else really deep in the tree and hard to find.

const classifyPose = async () => {
	try {
		if (pose && skeleton.length) {
			let inputs = []
			for (let i = 0; i < pose.keypoints.length; i++) {
				let x = pose.keypoints[i].position.x
				let y = pose.keypoints[i].position.y
				inputs.push(x)
				inputs.push(y)
			}
			console.log('Inputs', inputs);
			const meta = brainRef.current.neuralNetworkData.meta;
			console.log('Meta', meta);
			console.log('meta.inputs', meta.inputs);
			console.log('meta.outputs', meta.outputs);
			const results = await brainRef.current.classify(inputs);
			gotResults(undefined, results);
		} else {
			// console.log('Pose not found')
			setCurrPose('Not found')
			posesArray.current = [...posesArray.current, null]
		}
		handleGameTik()
	} catch(e) {
		console.log('Caught error', e);
		console.trace();
	}
}

from ml5-library.

yehonatanyosefi avatar yehonatanyosefi commented on June 18, 2024

from ml5-library.

lindapaiste avatar lindapaiste commented on June 18, 2024

Okay we are getting somewhere! You’ve confirmed that meta.inputs and meta.outputs are both undefined and that’s what triggers the TypeError.

In looking at your meta object I can see that the info which we need is there but it’s not in the right place. It looks like it’s meta.meta.inputs instead of meta.inputs.

I haven’t got to the root problem yet. That is, why the meta is structured incorrectly. I’ll need to play around more and run your code. It’s either a problem with reading your metadata.json file or it’s a problem with exporting the model which led to an incorrect metadata.json. There probably exists a quick fix where I tell you what to change in the metadata.json file to make it work but that’s a poor solution that doesn’t address why it’s wrong. Did you use ml5 to generate the saved model that you are loading?

from ml5-library.

yehonatanyosefi avatar yehonatanyosefi commented on June 18, 2024

from ml5-library.

yehonatanyosefi avatar yehonatanyosefi commented on June 18, 2024

from ml5-library.

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.