MCPcopy Create free account
hub / github.com/BIT-DataLab/Edit-Banana / __init__

Method __init__

modules/text/ocr/pix2text.py:72–93  ·  view source on GitHub ↗

初始化 Pix2Text Args: device: 计算设备(cuda 使用 GPU3) languages: 文字语言(影响非公式部分的识别)

(self, device: str = 'cuda', languages: tuple = ('en',))

Source from the content-addressed store, hash-verified

70 """
71
72 def __init__(self, device: str = 'cuda', languages: tuple = ('en',)):
73 """
74 初始化 Pix2Text
75
76 Args:
77 device: 计算设备(cuda 使用 GPU3)
78 languages: 文字语言(影响非公式部分的识别)
79 """
80 print(f" Pix2Text 使用设备: {device}")
81
82 # 降低 MFD 检测阈值,提高公式检测率
83 self.p2t = Pix2Text.from_config(
84 device=device,
85 text_config={'device': device, 'languages': languages},
86 formula_config={'device': device},
87 # MFD 配置:降低置信度阈值
88 mfd_config={
89 'device': device,
90 'conf_threshold': 0.15, # 默认 0.25,降低以检测更多公式
91 'iou_threshold': 0.45, # 默认 0.45
92 },
93 )
94
95 def analyze_image(self, image_path: str) -> Pix2TextResult:
96 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected