Added top_k

This commit is contained in:
Samuel Ortion 2021-03-06 20:06:27 +01:00
parent 25190c64e2
commit 0bed68679a

View File

@ -18,7 +18,7 @@ def set_input_tensor(interpreter, image):
input_tensor = interpreter.tensor(tensor_index)()[0] input_tensor = interpreter.tensor(tensor_index)()[0]
input_tensor[:, :] = image input_tensor[:, :] = image
def classify_image(interpreter, image): def classify_image(interpreter, image, top_k=1):
"""Returns a sorted array of classification results.""" """Returns a sorted array of classification results."""
set_input_tensor(interpreter, image) set_input_tensor(interpreter, image)
interpreter.invoke() interpreter.invoke()