question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use tfjs-react-native with posenet and bundleResourceIO

See original GitHub issue

I want to build an react native app with the use of posenet. A requirement is, that it works offline.

so the examples work fine. when i do:

import * as posenet from '@tensorflow-models/posenet'
this.model = await posenet.load();

so what i did next is converting the model to one weigth file and load the model locally with:

const modelJson = require('./assets/model/original/model-stride32.json');
const modelWeights = require('./assets/model/original/weigth.bin');
    
this.model = await tf.loadGraphModel(
   bundleResourceIO(modelJson, modelWeights)
);

so what i want to do next is to run something like this:

const predictions = await this.model.estimateSinglePose(imageTensor)

but of course this doesn’t work because the model doesn’t know the function.

i know i can instanciate the model by using something like this:

const checkpointLoader = new posenet.CheckpointLoader(checkpoint.url);
const variables = await checkpointLoader.getAllVariables();
const model =  new posenet.MobileNet(variables, checkpoint.architecture);

but the checkpoint loader needs an url. i want to use the local files.

does anyone has a hint for me how to use posenet without rewriting the whole node-module?

thx in advance

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jc65536commented, Feb 24, 2021

@dabass51 could you tell me where you got the modelJson and modelWeights files? Thanks 😃

1reaction
distroinfinitycommented, Jul 14, 2021

@dabass51 I want to achieve pose estimation in my React Native app can you provide me with link to some docs or instructions on how to add tfjs and poseet into a React Native app for android. I was able to set up tfjs by installing necessary dependencies inside my React Native project. Can you provide something to move forward? Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to save and load tflite version of posenet in react-native?
If you are using React Native why not just use the PoseNet model that ... import { bundleResourceIO } from "@tensorflow/tfjs-react-native"; ...
Read more >
Want to use TensorflowJS, Posenet in a React Native ...
Hey there! I want to achieve human pose estimation inside a react Native App but I can't find any docs or resources on...
Read more >
How to save and load tflite version of posenet in react-native?
[Solved]-How to save and load tflite version of posenet in react-native?-React Native ... import { bundleResourceIO } from "@tensorflow/tfjs-react-native"; ...
Read more >
tensorflow/tfjs-react-native.bundleResourceIO JavaScript and ...
Best JavaScript code snippets using @tensorflow/tfjs-react-native.bundleResourceIO(Showing top 1 results out of 1,395). Tabnine vs. GitHub Copilot.
Read more >
Setup Tensorflow.js to React Native Expo project
https://github.com/tensorflow/tfjs/tree/master/tfjs-react-native ... import { bundleResourceIO } from '@tensorflow/tfjs-react-native' class ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found