fix: prevent crash when printspace is missing in xmls used for label generation

This commit is contained in:
vahidrezanezhad 2026-01-26 17:30:26 +01:00
parent 6ae244bf9b
commit 33f6a231bc

View file

@ -737,9 +737,12 @@ def get_images_of_ground_truth(gt_list, dir_in, output_dir, output_type, config_
cnt_size = np.array([cv2.contourArea(contours[j]) for j in range(len(contours))]) cnt_size = np.array([cv2.contourArea(contours[j]) for j in range(len(contours))])
cnt = contours[np.argmax(cnt_size)] try:
cnt = contours[np.argmax(cnt_size)]
x, y, w, h = cv2.boundingRect(cnt)
except:
x, y , w, h = 0, 0, x_len, y_len
x, y, w, h = cv2.boundingRect(cnt)
bb_xywh = [x, y, w, h] bb_xywh = [x, y, w, h]