Skip to content Skip to sidebar Skip to footer

Requested Texture Size [0x0] Is Invalid. Error When I Am Loading Image In Browser

Tensorflow.js error in browser while calling predict function I'm using Node.js to run the webapp. This is my scripts I have included and I'm running Node.js in Chrome and not able

Solution 1:

Problem

When Tensorflow.js tries to transform your image into a tensor via tf.browser.fromPixels, it reads the width and height from the DOM element. As these values are not set in your case, you receive an error.

Solution

You have to give the img tag a width and height attribute, so that Tensorflow.js knows the size of your image:

<imgid="selected-image"src=""width="..."height="...">

There is currently an open issue in the repository describing this problem. This might be fixed in the future by providing a better error message.

Post a Comment for "Requested Texture Size [0x0] Is Invalid. Error When I Am Loading Image In Browser"