tf.loadModel not working in react native
See original GitHub issueTensorFlow.js version
0.10.3
Browser version
react-native 0.55.3
Problem:
tf.loadModel not working for local folder and remo url in react native, load local model not working for React
Feature request:
tf.loadModel react-native support
Code to reproduce the bug / link to feature request
const path = 'https://storage.googleapis.com/tfjs-models/tfjs/mobilenet_v1_0.25_224/model.json';
const localPath = './tfjsmodel/model.json';
async loadmodel(p) {
const model = await this.loadHostedPretrainedModel(p);
console.log(model);
}
async loadHostedPretrainedModel(p) {
try {
const model = await tf.loadModel(p);
return model;
} catch (err) {
console.error(err);
}
}
this is the demo app i created for running tfjs in react-native, it can train and predict model locally, if you are interested this is the repo: https://github.com/tangtai/tfjsdemo
error i get when try to load model from url, i tried the code on react as well it returns the model successfully:
error i get when try to load model from local folder, for React it returns pending Promise :
the model i got from tensorflowjs file convertor:
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (2 by maintainers)
Top Results From Across the Web
load model.json for tensorflowjs in reactjs not working
I'm trying to load a model.json file with it's weights.bin from the root directory in my react app. When I call an example...
Read more >Loading models into tensorflow.js via react.js | by Manfye Goh
If you get the console log of “Load model success” means your model is successfully loaded into TF.js. BONUS: What if you just...
Read more >Save and load models | TensorFlow.js
This tutorial will focus on saving and loading TensorFlow.js models ... tf.Model and tf.Sequential both provide a function model.save that ...
Read more >Bug help! With tfjs : r/reactnative - Reddit
Hi, I'm new to React Native and trying to load a model using @tensorflow/tfjs-react-native and I've narrowed down the problem to the ...
Read more >Tf.Loadmodel Is Not A Function - ADocLib
I overlooked the fact that you are not in Node.js but in ionic. tf.loadModel ... loadModel not working it fails to load model...
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
We just released a package for this! https://www.npmjs.com/package/@tensorflow/tfjs-react-native try it out and feel free to re-open this issues if you have trouble with it.
you can try webpack to import the cdn of tensorflowjs in Reactnative