Wrapper class for the Image object.
tflite_support
.
task
.
vision
.
TensorImage
(
image_data
:
image_utils
.
ImageData
,
is_from_numpy_array
:
bool
=
True
)
->
None
Args
Methods
create_from_array
@classmethodcreate_from_array ( array : np . ndarray ) -> 'TensorImage'
Creates TensorImage
object from the numpy array.
Args
array
numpy array with dtype=uint8. Its shape should be either (h, w, 3)
or (1, h, w, 3) for RGB images, either (h, w) or (1, h, w) for GRAYSCALE
images and either (h, w, 4) or (1, h, w, 4) for RGBA images.
Returns
TensorImage
object.
Raises
ValueError if the dytype of the numpy array is not
uint8
or the
dimention is not the valid dimention. create_from_buffer
@classmethodcreate_from_buffer ( buffer : str ) -> 'TensorImage'
Creates TensorImage
object from the binary buffer.
Args
buffer
Binary memory buffer.
Returns
TensorImage
object.
Raises
RuntimeError if the binary buffer can't be decoded into
TensorImage
object. create_from_file
@classmethodcreate_from_file ( file_name : str ) -> 'TensorImage'
Creates TensorImage
object from the image file.
Args
file_name
Image file name.
Returns
TensorImage
object.
Raises
RuntimeError if the image file can't be decoded.


