From 830638e63bd51ccf9b051655281c8fa5a92080d4 Mon Sep 17 00:00:00 2001 From: fatih <34196005+fcakyon@users.noreply.github.com> Date: Mon, 6 Dec 2021 20:06:47 +0300 Subject: [PATCH] fix yolov5 category names (#297) --- sahi/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sahi/model.py b/sahi/model.py index 465d5c65..95338810 100644 --- a/sahi/model.py +++ b/sahi/model.py @@ -483,7 +483,7 @@ def _create_object_prediction_list_from_original_predictions( bbox = [x1, y1, x2, y2] score = prediction[4] category_id = int(prediction[5]) - category_name = original_predictions.names[category_id] + category_name = self.category_mapping[str(category_id)] # ignore invalid predictions if bbox[0] > bbox[2] or bbox[1] > bbox[3] or bbox[0] < 0 or bbox[1] < 0 or bbox[2] < 0 or bbox[3] < 0: