From ad6bb809004acc737755d354b60293c797e9d397 Mon Sep 17 00:00:00 2001 From: Matthias Bisping Date: Wed, 30 Mar 2022 01:14:03 +0200 Subject: [PATCH] fixed sorting predictions by probabilities in wrong order --- image_prediction/classifier/classifier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image_prediction/classifier/classifier.py b/image_prediction/classifier/classifier.py index d7dd316..a9164c5 100644 --- a/image_prediction/classifier/classifier.py +++ b/image_prediction/classifier/classifier.py @@ -36,7 +36,7 @@ class Classifier: ) def __format_array_prediction_format(self, prediction): - cls2prob = dict(sorted(zip(self._classes, prediction), key=itemgetter(1))) + cls2prob = dict(sorted(zip(self._classes, prediction), key=itemgetter(1), reverse=True)) most_likely = [*cls2prob][0] return {"label": most_likely, "probabilities": cls2prob}