From 7f7472d17b351ebe38a61985970f840ae4fabed4 Mon Sep 17 00:00:00 2001 From: Emmanuel Benazera Date: Tue, 24 Oct 2023 12:23:52 +0000 Subject: [PATCH] chore: raise on missing semantic class --- data/online_creation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/online_creation.py b/data/online_creation.py index f0f969495..0f629b0e6 100644 --- a/data/online_creation.py +++ b/data/online_creation.py @@ -59,7 +59,6 @@ def crop_image( # Bbox file f = open(bbox_path, "r") else: - # bbox_img = np.array(Image.open(img_path)) import cv2 @@ -95,7 +94,6 @@ def crop_image( print("%s does not describe a bbox" % line) else: - cat = str(int(np.max(bbox_img))) # Find the indices of non-zero elements in the image @@ -169,6 +167,8 @@ def crop_image( else: raise ValueError("mask_delta value is incorrect.") else: + if len(mask_delta) <= cat - 1: + raise ValueError("too few classes, can't find mask_delta value") mask_delta_cat = mask_delta[cat - 1] if isinstance(mask_delta[0][0], float): if len(mask_delta_cat) == 1: