A simple LaTeX OCR package
Project description
Simple-LaTeX-OCR
The encoder is resnetv2+simplevit, the decoder is transformer, the attention mechanism uses flashattention2.0 from pytorch2.0, and the dataset size is 112 million
Install the package simple_latex_ocr
:
pip install simple_latex_ocr
Use from within Python
from simple_latex_ocr.models import Latex_OCR
model = Latex_OCR()
img_path = "tests/test_files/5.png"
result = model.predict(img_path)
print(result['formula'])
print(result['confidence'])
print(result['elapse'])
Used by command line
$ simple_latex_ocr tests/test_files/2.png
#detect img time: : 0.8883707523345947
#x^{2}+y^{2}=1
#99.28%
#1,360ms
Used by api
$ python -m simple_latex_ocr.api.run
#You can use test.py to initiate a request for verification
Contribution
Contributions of any kind are welcome.
Acknowledgment
Code taken and modified from lukas-blecher, RapidAI,ultralytics
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
simple_latex_ocr-0.0.1.tar.gz
(16.1 kB
view hashes)
Built Distribution
Close
Hashes for simple_latex_ocr-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66e1244b79715ba21ce8403226cca6bd8daae6c2d49cb7128b592ace6b4ca59e |
|
MD5 | abdbe93f4647e0bda7f5c6971de894fa |
|
BLAKE2b-256 | 0c188e80b6f5778e6e251b4a9177e33f07c18626fadebb79ebcfa18709b64f22 |