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.

Failed loading TensorFlow.js model with bundleResourceIO for React Native

See original GitHub issue

TensorFlow.js version

"@tensorflow/tfjs": "^1.7.4", "@tensorflow/tfjs-react-native": "^0.3.0",

Describe the problem or feature request

I used Custom Vision to create a model. I exported this to TensorFlow.js for my React Native expo app.

// Get reference to bundled model assets const modelJson = require('../assets/model/model.json'); const modelWeights = require('../assets/model/weights.bin'); // Use the bundleResourceIO IOHandler to load the model const model = await tf.loadLayersModel(bundleResourceIO(modelJson, modelWeights));

I am getting at modelJson this message Argument type {modelTopology: {node: *, library: {}, versions: {}}, weightsManifest: *} is not assignable to parameter type io.ModelJSON

When i catch the error if says layer: Improper config format

Does anybody now how to fix this?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
tafsiricommented, Jun 5, 2020

General help/advice questions are better suited to stack overflow. I’ll also leave a link to our tutorials page, having a good understanding of the concepts covered in the tutorials will be useful. There are also blog posts and other online resources describing how to do image classification in tfjs and using tfjs-react-native. Between those and the docs there should be something helpful.

1reaction
tafsiricommented, Jun 4, 2020

Your model.json looks like a graph model, try using tf.loadGraphModel.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Failed loading custom TensorFlow.js model with ...
I am trying to load a custom model into tensorflow.js in react native but am getting the error below when I try to...
Read more >
Bug help! With tfjs : r/reactnative - Reddit
Hi, I'm new to React Native and trying to load a model using ... bundleResourceIO } from '@tensorflow/tfjs-react-native' import {modelJSON} ...
Read more >
tf.io.RequestDetails - TensorFlow.js React Native API
This IOHandler only supports load . It is designed to support loading models that have been statically bundled (at compile time) with an...
Read more >
tensorflow/tfjs-react-native v0.8.0 - npm.io
Loading local models using bundleResourceIO. You can instead load models from a webserver. Step 1. Create your react native app. You can use...
Read more >
[Solved]-Failed loading custom TensorFlow.js model with ...
Coding example for the question Failed loading custom TensorFlow.js model with bundleResourceIO for React Native-React Native.
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