(box, w, h)
| 399 | return boxes, conf, phrases |
| 400 | |
| 401 | def int_box_area(box, w, h): |
| 402 | x1, y1, x2, y2 = box |
| 403 | int_box = [int(x1*w), int(y1*h), int(x2*w), int(y2*h)] |
| 404 | area = (int_box[2] - int_box[0]) * (int_box[3] - int_box[1]) |
| 405 | return area |
| 406 | |
| 407 | 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): |
| 408 | """Process either an image path or Image object |
no outgoing calls
no test coverage detected