Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added doc corresponding to decode_prediction() and preprocess_input() #36951

Merged
merged 2 commits into from
Feb 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 22 additions & 2 deletions tensorflow/python/keras/applications/mobilenet_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,31 @@ def _make_divisible(v, divisor, min_value=None):

@keras_export('keras.applications.mobilenet_v2.preprocess_input')
def preprocess_input(x, data_format=None):
"""Preprocesses the input (encoding a batch of images) for the model."""
"""Preprocesses a numpy array encoding a batch of images.

Arguments
x: A 4D numpy array consists of RGB values within [0, 255].

Returns
Preprocessed array.
"""
return imagenet_utils.preprocess_input(x, data_format=data_format, mode='tf')


@keras_export('keras.applications.mobilenet_v2.decode_predictions')
def decode_predictions(preds, top=5):
"""Decodes the prediction result from the model."""
"""Decodes the prediction result from the model.

Arguments
preds: Numpy tensor encoding a batch of predictions.
top: Integer, how many top-guesses to return.

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
ValueError: In case of invalid shape of the `pred` array (must be 2D).
"""
return imagenet_utils.decode_predictions(preds, top=top)