How to get a tensor from an image
问题 I have an image and I would like to get the tensor from it. Some of the images are already on the frontend server be whereas others will be served by the server 回答1: To do that, one needs to use fromPixels In case the image is already displayed in an html page You can consider doing a querySelector to get the image first and then you can use fromPixels html <img id="my-image" src="mydata.jpg"> js const image = document.querySelector("#my-image") const t = tf.fromPixels(image) If the image is