You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from pix2text import Pix2Text
img_fp = r'C:\formula.jpg'
p2t = Pix2Text()
out_text = p2t(img_fp) # 也可以使用 p2t.recognize(img_fp) 获得相同的结果
print(out_text)
上述代码执行后,在控制台显示如下:
C:\Users\zz\PycharmProjects\pythonProject6.venv\Scripts\python.exe C:\Users\zz\PycharmProjects\pythonProject6\pix2text_pdf2mdTest.py
Fix size testing.
training chunk_sizes: [32]
The output will be saved to C:\Users\zz\PycharmProjects\pythonProject6.venv\Lib\site-packages\pix2text\doc_xl_layout....\exp\ctdet_subfield\default
heads {'hm': 11, 'cls': 4, 'ftype': 3, 'wh': 8, 'hm_sub': 2, 'wh_sub': 8, 'reg': 2, 'reg_sub': 2}
Loading C:\Users\zz\AppData\Roaming\pix2text\1.1\mfd-onnx\mfd-v20240618.onnx for ONNX Runtime inference...
WARNING ⚠️ imgsz=[194, 768] must be multiple of max stride 32, updating to [224, 768]
0: 224x768 1 isolated, 218.7ms
Speed: 10.1ms preprocess, 218.7ms inference, 45.1ms postprocess per image at shape (1, 3, 224, 768)
100%|██████████| 1/1 [00:01<00:00, 1.81s/it]
Page(id=0, number=0, elements=[Element({'id': '0-0-remaining', 'box': [11, 10, 749, 153], 'text': '{\cal L}{\mathrm{e y e l i d}} \;=\sum{t=1}^{T} \sum_{v=1}^{V} {\cal M}{v}^{( \mathrm{e y e l i d} \, )} \left( \left\| \hat{h}{t, v}-x_{t, v} \right\|^{2} \right)', 'meta': None, 'type': FORMULA, 'total_img': <PIL.Image.Image image mode=RGB size=752x190 at 0x1622D202F90>, 'isolated': False, 'col_number': 0, 'score': 0.9585866332054138, 'kwargs': {'embed_sep': (' $', '$ '), 'isolated_sep': ('$$\n', '\n$$'), 'line_sep': '\n', 'auto_line_break': True, 'title_contain_formula': False, 'text_contain_formula': True, 'resized_shape': 768}})])
进程已结束,退出代码为 0
下边的存储路径在哪里呢,没找到....\exp\ctdet_subfield\default这段;
The output will be saved to C:\Users\zz\PycharmProjects\pythonProject6.venv\Lib\site-packages\pix2text\doc_xl_layout....\exp\ctdet_subfield\default
The text was updated successfully, but these errors were encountered:
from pix2text import Pix2Text⚠️ imgsz=[194, 768] must be multiple of max stride 32, updating to [224, 768]$', '$ '), 'isolated_sep': ('$$\n', '\n$$'), 'line_sep': '\n', 'auto_line_break': True, 'title_contain_formula': False, 'text_contain_formula': True, 'resized_shape': 768}})])
img_fp = r'C:\formula.jpg'
p2t = Pix2Text()
out_text = p2t(img_fp) # 也可以使用
p2t.recognize(img_fp)
获得相同的结果print(out_text)
上述代码执行后,在控制台显示如下:
C:\Users\zz\PycharmProjects\pythonProject6.venv\Scripts\python.exe C:\Users\zz\PycharmProjects\pythonProject6\pix2text_pdf2mdTest.py
Fix size testing.
training chunk_sizes: [32]
The output will be saved to C:\Users\zz\PycharmProjects\pythonProject6.venv\Lib\site-packages\pix2text\doc_xl_layout....\exp\ctdet_subfield\default
heads {'hm': 11, 'cls': 4, 'ftype': 3, 'wh': 8, 'hm_sub': 2, 'wh_sub': 8, 'reg': 2, 'reg_sub': 2}
Loading C:\Users\zz\AppData\Roaming\pix2text\1.1\mfd-onnx\mfd-v20240618.onnx for ONNX Runtime inference...
WARNING
0: 224x768 1 isolated, 218.7ms
Speed: 10.1ms preprocess, 218.7ms inference, 45.1ms postprocess per image at shape (1, 3, 224, 768)
100%|██████████| 1/1 [00:01<00:00, 1.81s/it]
Page(id=0, number=0, elements=[Element({'id': '0-0-remaining', 'box': [11, 10, 749, 153], 'text': '{\cal L}{\mathrm{e y e l i d}} \;=\sum{t=1}^{T} \sum_{v=1}^{V} {\cal M}{v}^{( \mathrm{e y e l i d} \, )} \left( \left\| \hat{h}{t, v}-x_{t, v} \right\|^{2} \right)', 'meta': None, 'type': FORMULA, 'total_img': <PIL.Image.Image image mode=RGB size=752x190 at 0x1622D202F90>, 'isolated': False, 'col_number': 0, 'score': 0.9585866332054138, 'kwargs': {'embed_sep': ('
进程已结束,退出代码为 0
下边的存储路径在哪里呢,没找到....\exp\ctdet_subfield\default这段;
The output will be saved to C:\Users\zz\PycharmProjects\pythonProject6.venv\Lib\site-packages\pix2text\doc_xl_layout....\exp\ctdet_subfield\default
The text was updated successfully, but these errors were encountered: