Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teachable machine pose model work with Tfjs React Native #134

Open
danielchung928 opened this issue Sep 7, 2020 · 4 comments
Open

Teachable machine pose model work with Tfjs React Native #134

danielchung928 opened this issue Sep 7, 2020 · 4 comments
Labels
question Further information is requested

Comments

@danielchung928
Copy link

danielchung928 commented Sep 7, 2020

May I know is it possible to use the Teachable machine exported pose model to integrate with the Tensorflow React Native module?

From the example code of Teachable machine pose model predict method:

async function predict() {
// Prediction 1: run input through posenet
// estimatePose can take in an image, video or canvas html element
const { pose, posenetOutput } = await model.estimatePose(webcam.canvas);
// Prediction 2: run input through teachable machine classification model
const prediction = await model.predict(posenetOutput);

...
}

In the React Native world, any idea how to get the "posenetOutput" from the TensorCamera and fit into the Teachable machine pose model predict method?

@irealva
Copy link
Contributor

irealva commented Oct 29, 2020

Hi,

Thanks so much for writing in.Are you trying to replicate our training code but using tfjs-react-native? If so, the pose itself is not the input to the training model, but another activation we're using which is here:

https://github.com/googlecreativelab/teachablemachine-community/blob/master/libraries/pose/src/custom-posenet.ts#L231

You would need to replicate the function we have there to generate the posenetOutput which is a concatenated tensor with the heatmap and offset vectors of posenet (they are the intermediate outputs of posenet before decoding the pose keypoints).

@irealva
Copy link
Contributor

irealva commented Oct 29, 2020

Duplicate of #145

@irealva irealva marked this as a duplicate of #145 Oct 29, 2020
@irealva irealva added the question Further information is requested label Oct 29, 2020
@jdnichollsc
Copy link

jdnichollsc commented Mar 16, 2021

Hello folks, can we use the camera from React Native with these libraries?

@evanjmg
Copy link

evanjmg commented Jan 1, 2023

Any update on this? Using tf.loadLayersModel(bundleResourceIO(modelJson, modelWeights)); is the best I've seen but can't use teachable machine automatic metadata etc. Btw, it isn't accurate with this technique

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants