From 16570a9bf390022e78f0d0c04ccf71d50ed892d4 Mon Sep 17 00:00:00 2001 From: Thomas Dhome-Casanova Date: Mon, 27 Jan 2025 22:52:55 -0800 Subject: [PATCH] remove unused function --- utils.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/utils.py b/utils.py index 1da7e68..62278cb 100755 --- a/utils.py +++ b/utils.py @@ -404,7 +404,7 @@ def int_box_area(box, w, h): int_box = [int(x1*w), int(y1*h), int(x2*w), int(y2*h)] area = (int_box[2] - int_box[0]) * (int_box[3] - int_box[1]) return area - + def get_som_labeled_img(image_source: Union[str, Image.Image], model=None, BOX_TRESHOLD=0.01, output_coord_in_ratio=False, ocr_bbox=None, text_scale=0.4, text_padding=5, draw_bbox_config=None, caption_model_processor=None, ocr_text=[], use_local_semantics=True, iou_threshold=0.9,prompt=None, scale_img=False, imgsz=None, batch_size=64): """Process either an image path or Image object @@ -540,17 +540,4 @@ def check_ocr_box(image_source: Union[str, Image.Image], display_img = True, out bb = [get_xyxy(item) for item in coord] return (text, bb), goal_filtering -def get_ocr_bbox(image: Image.Image): - if image.mode == 'RGBA': - # Convert RGBA to RGB to avoid alpha channel issues - image = image.convert('RGB') - image_np = np.array(image) - result = paddle_ocr.ocr(image_np, cls=False)[0] - text_threshold = 0.8 - coord = [item[0] for item in result if item[1][1] > text_threshold] - text = [item[1][0] for item in result if item[1][1] > text_threshold] - bb = [get_xyxy(item) for item in coord] - return text, bb - -