Uncaught (in promise) TypeError: Cannot read property 'reduce' of undefined
See original GitHub issueWhen creating a model using AutoML with Multi Classification.
Getting this error from tensorflowjs when running
const model = await tf.automl.loadImageClassification('/model/model.json');
tfjs:17 Uncaught (in promise) TypeError: Cannot read property 'reduce' of undefined
at e.t.transformGraph (tfjs:17)
at e.t.loadSync (tfjs:17)
at e.<anonymous> (tfjs:17)
at u (tfjs:17)
at Generator._invoke (tfjs:17)
at Generator.forEach.e.<computed> [as next] (tfjs:17)
at Um (tfjs:17)
at o (tfjs:17)
html code:
<script src="https://unpkg.com/@tensorflow/tfjs"></script>
<script src="https://unpkg.com/@tensorflow/tfjs-automl"></script>
<img id="daisy" src="test2.jpg">
<script>
async function run() {
const model = await tf.automl.loadImageClassification('/model/model.json');
const image = document.getElementById('daisy');
const predictions = await model.classify(image);
console.log(predictions);
// Show the resulting object on the page.
const pre = document.createElement('pre');
pre.textContent = JSON.stringify(predictions, null, 2);
document.body.append(pre);
}
run();
</script>
Model Multi-Classification, Edge, Exported for Tensorflowjs
Nothing crazy here just a simple export and run from browser. The model works fine when deployed in GCP with “Test&Use”.
Issue Analytics
- State:
- Created 3 years ago
- Comments:21
Top Results From Across the Web
TypeError: Cannot read property 'reduce' of undefined in react
I have a form in which I am asking the user to input field values for a couple of fields, storing the field...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Js-error "TypeError: Cannot read property 'reduce ... - YouTrack
Js-error "TypeError: Cannot read property 'reduce' of undefined" on code rewiews tab ; Released in build, 6.5 ; Assignee, Maksim Ryzhikov ; Priority,...
Read more >Uncaught TypeError: Cannot read property of undefined In
This error occurs in Chrome Browser when you read a property or call a method on an undefined object . There are a...
Read more >How to Prevent the TypeError: Cannot Read Property Map of ...
As a result, the TypeError Cannot read property 'map' of undefined is very common and one of the first errors that developers will...
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
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I found a solution
In your model.json file just remove this line:-
"modelInitializer": {"versions": {}},
.@ghafran so here is the modified model.json
model_json.zip
Replace your model.json with the above file
So, this should work even with the latest tfjs version
Does anyone here have any insight about the problem described at the bottom of this stackoverflow post: https://stackoverflow.com/questions/65402617/tensorflow-automl-model-in-react