The input image to construct the tensor from. The
supported image types are all 4-channel. You can also pass in an image
object with following attributes:
{data: Uint8Array; width: number; height: number}
Optional
numChannels: numberThe number of channels of the output tensor. A numChannels value less than 4 allows you to ignore channels. Defaults to 3 (ignores alpha channel of input image).
A Tensor3D with the shape [height, width, numChannels]
.
Note: fromPixels can be lossy in some cases, same image may result in slightly different tensor values, if rendered by different rendering engines. This means that results from different browsers, or even same browser with CPU and GPU rendering engines can be different. See discussion in details: https://github.com/tensorflow/tfjs/issues/5482
Creates a
tf.Tensor
from an image.