From 871d7bfc5a76d8a81b4aec0b4b7c701eeeb883f9 Mon Sep 17 00:00:00 2001 From: vahidrezanezhad Date: Wed, 4 Dec 2024 16:41:00 +0100 Subject: [PATCH] fixed: machine based reading order cause tuple index out of range error if number of textregion is one. --- src/eynollah/eynollah.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/eynollah/eynollah.py b/src/eynollah/eynollah.py index c28c441..e802e29 100644 --- a/src/eynollah/eynollah.py +++ b/src/eynollah/eynollah.py @@ -4013,7 +4013,10 @@ class Eynollah: inference_bs = 3 input_1= np.zeros( (inference_bs, height1, width1,3)) starting_list_of_regions = [] - starting_list_of_regions.append( list(range(labels_con.shape[2])) ) + if len(co_text_all)<=1: + starting_list_of_regions.append( list(range(1)) ) + else: + starting_list_of_regions.append( list(range(labels_con.shape[2])) ) index_update = 0 index_selected = starting_list_of_regions[0] #print(labels_con.shape[2],"number of regions for reading order")