tf.keras.preprocessing.image.img_to_array
View source on GitHub |
Converts a PIL Image instance to a Numpy array.
tf.keras.preprocessing.image.img_to_array( img, data_format=None, dtype=None )
Arguments | |
---|---|
img | PIL Image instance. |
data_format | Image data format, either "channels_first" or "channels_last". |
dtype | Dtype to use for the returned array. |
Returns | |
---|---|
A 3D Numpy array. |
Raises | |
---|---|
ValueError | if invalid img or data_format is passed. |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/preprocessing/image/img_to_array