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.

Uncaught (in promise) TypeError: Cannot read property 'reduce' of undefined

See original GitHub issue

When 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:closed
  • Created 3 years ago
  • Comments:21

github_iconTop GitHub Comments

2reactions
Vivek1907commented, Dec 2, 2020

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

0reactions
jml1996jsonhostcommented, Dec 22, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

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 Hashnode Post

No results found