Use tfjs-react-native with posenet and bundleResourceIO
See original GitHub issueI 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:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dabass51 could you tell me where you got the modelJson and modelWeights files? Thanks 😃
@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