decode_predictions functionkeras.applications.xception.decode_predictions(preds, top=5)
Decodes the prediction of an ImageNet model.
Arguments
5.Returns
A list of lists of top class prediction tuples
(class_name, class_description, score).
One list of tuples per sample in batch input.
Raises
pred array
(must be 2D).Guides and examples using decode_predictions
preprocess_input functionkeras.applications.xception.preprocess_input(x, data_format=None)
Preprocesses a tensor or Numpy array encoding a batch of images.
Usage example with applications.MobileNet:
i = keras.layers.Input([None, None, 3], dtype="uint8")
x = ops.cast(i, "float32")
x = keras.applications.mobilenet.preprocess_input(x)
core = keras.applications.MobileNet()
x = core(x)
model = keras.Model(inputs=[i], outputs=[x])
result = model(image)
Arguments
numpy.array or a backend-native tensor,
3D or 4D with 3 color
channels, with values in the range [0, 255].
The preprocessed data are written over the input data
if the data types are compatible. To avoid this
behaviour, numpy.copy(x) can be used.keras.backend.image_data_format() is used
(unless you changed it, it uses "channels_last").
Defaults to None.Returns
Preprocessed array with type float32.
The inputs pixel values are scaled between -1 and 1, sample-wise.
Raises
data_format argument.Guides and examples using preprocess_input