Confidence value for textregions and in the case of not light version is set to zero. This is done to let the pipeline go through. It will be updated to return the correct value in upcomming commits

pull/149/head^2
vahidrezanezhad 1 week ago
parent 6b52da227c
commit 38a2d60fa2

@ -4486,6 +4486,7 @@ class Eynollah:
self.get_regions_from_xy_2models(img_res, is_image_enhanced,
num_col_classifier)
self.logger.info("Textregion detection took %.1fs ", time.time() - t1)
confidence_matrix = np.zeros((text_regions_p_1.shape[:2]))
t1 = time.time()
num_col, num_col_classifier, img_only_regions, page_coord, image_page, mask_images, mask_lines, \
@ -4719,8 +4720,8 @@ class Eynollah:
#contours_only_text_parent = self.dilate_textregions_contours(contours_only_text_parent)
else:
txt_con_org = get_textregion_contours_in_org_image(
contours_only_text_parent, self.image, slope_first)
txt_con_org , conf_contours_textregions = get_textregion_contours_in_org_image_light(
contours_only_text_parent, self.image, slope_first, confidence_matrix, map=self.executor.map)
#print("text region early 4 in %.1fs", time.time() - t0)
boxes_text, _ = get_text_region_boxes_by_given_contours(contours_only_text_parent)
boxes_marginals, _ = get_text_region_boxes_by_given_contours(polygons_of_marginals)
@ -4812,7 +4813,6 @@ class Eynollah:
if self.light_version:
fun = check_any_text_region_in_model_one_is_main_or_header_light
else:
conf_contours_textregions = None
fun = check_any_text_region_in_model_one_is_main_or_header
text_regions_p, contours_only_text_parent, contours_only_text_parent_h, all_box_coord, all_box_coord_h, \
all_found_textline_polygons, all_found_textline_polygons_h, slopes, slopes_h, \

@ -884,6 +884,9 @@ def check_any_text_region_in_model_one_is_main_or_header(
contours_only_text_parent_main=[]
contours_only_text_parent_head=[]
conf_contours_main=[]
conf_contours_head=[]
contours_only_text_parent_main_d=[]
contours_only_text_parent_head_d=[]
@ -905,9 +908,11 @@ def check_any_text_region_in_model_one_is_main_or_header(
all_box_coord_head.append(all_box_coord[ii])
slopes_head.append(slopes[ii])
all_found_textline_polygons_head.append(all_found_textline_polygons[ii])
conf_contours_head.append(None)
else:
regions_model_1[:,:][(regions_model_1[:,:]==1) & (img[:,:,0]==255) ]=1
contours_only_text_parent_main.append(con)
conf_contours_main.append(conf_contours[ii])
if contours_only_text_parent_d_ordered is not None:
contours_only_text_parent_main_d.append(contours_only_text_parent_d_ordered[ii])
all_box_coord_main.append(all_box_coord[ii])
@ -927,8 +932,8 @@ def check_any_text_region_in_model_one_is_main_or_header(
slopes_head,
contours_only_text_parent_main_d,
contours_only_text_parent_head_d,
None,
None)
conf_contours_main,
conf_contours_head)
def check_any_text_region_in_model_one_is_main_or_header_light(
regions_model_1, regions_model_full,

Loading…
Cancel
Save