Merge pull request #2 from 0xCarbon/feat/disable_image_labeling

Force Image Content OCR
This commit is contained in:
Fabio 2024-12-13 22:52:52 -03:00 committed by GitHub
commit 162e89e013
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,7 @@ class LayoutModel(BasePageModel):
FIGURE_LABEL = DocItemLabel.PICTURE
FORMULA_LABEL = DocItemLabel.FORMULA
def __init__(self, artifacts_path: Path, accelerator_options: AcceleratorOptions):
device = decide_device(accelerator_options.device)
@ -56,7 +57,7 @@ class LayoutModel(BasePageModel):
device=device,
num_threads=accelerator_options.num_threads,
base_threshold=0.6,
blacklist_classes={"Form", "Key-Value Region"},
blacklist_classes={"Form", "Key-Value Region", "Picture"}, # Use this to disable picture recognition (trying to force to identify only text)
)
def postprocess(self, clusters_in: List[Cluster], cells: List[Cell], page_height):