Skip to main content

Python Tamil OCR package

Project description

Tamil OCR

Finetuned version of PARSEQ model on Tamil text. This version of OCR is much more robust to tilted text compared to the Tesseract, Paddle OCR and Easy OCR. Works best for text present in everday's life (scene texts). This model is work in progress, feel free to contribute!!!

Currently supports two languages (English + Tamil). Accuracy of the model can be improved by adjusting the Text detection model as per your requirements. Achieved the accuracy of around >95% (98% NED) in validation set

OUTPUT

Input Image TAMIL OCR Tesseract
teaser வாழ்கவளமுடன் க்‌ க்கஸாரகளள௮ஊகஎளமுடன்‌
teaser ரெடிமேட்ஸ் NO OUTPUT
teaser கோபி NO OUTPUT
teaser தாம்பரம் NO OUTPUT
teaser நெடுஞ்சாலைத் NO OUTPUT

Tesseract results are tested using the huggingface space with Tamil as language

How to USE this repo

Tested using Python 3.10 on Windows Machine

  1. Clone the repository

  2. Pip install the required modules using

  3. Download the models weights from the GDRIVE and keep it under model_weights

     |___model_weights
         |_____craft_mlt_25k.pth
         |_____parseq_tamil.ckpt
    
  4. Run the below code by providing the path

Text Recognition

from tamil_ocr import OCR

image_path = r"test_images\1.jpg" # insert your own path here
ocr = OCR()
texts = ocr.predict(image_path)
with open("output.txt","w",encoding="utf-8") as f:
    f.write(texts)

>>>> நெடுஞ்சாலைத்

Text Detect + Recognition

from tamil_ocr import OCR

image_path = r"test_images\0.jpg" # insert your own path here
ocr = OCR(detect=True)
texts = ocr.predict(image_path)
with open("output.txt","w",encoding="utf-8") as f:
    f.write(texts)

>>>> கொடைக்கானல் Kodaikanal 

LIMITATIONS

Unable to read the text if they are present in rotated forms

teaser teaser

Thanks to the below contibuters for making awesome Text detection and text recognition models

Text detection - CRAFT TEXT DECTECTION

Text recognition - PARSEQ

@InProceedings{bautista2022parseq,
  title={Scene Text Recognition with Permuted Autoregressive Sequence Models},
  author={Bautista, Darwin and Atienza, Rowel},
  booktitle={European Conference on Computer Vision},
  pages={178--196},
  month={10},
  year={2022},
  publisher={Springer Nature Switzerland},
  address={Cham},
  doi={10.1007/978-3-031-19815-1_11},
  url={https://doi.org/10.1007/978-3-031-19815-1_11}
}
@inproceedings{baek2019character,
  title={Character Region Awareness for Text Detection},
  author={Baek, Youngmin and Lee, Bado and Han, Dongyoon and Yun, Sangdoo and Lee, Hwalsuk},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  pages={9365--9374},
  year={2019}
}

CITATION

@InProceedings{GnanaPrasath,
  title={Tamil OCR},
  author={Gnana Prasath D},
  month={01},
  year={2024},
  url={https://github.com/gnana70/tamil_ocr}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocr_tamil-0.0.2.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ocr_tamil-0.0.2-py3-none-any.whl (48.4 kB view details)

Uploaded Python 3

File details

Details for the file ocr_tamil-0.0.2.tar.gz.

File metadata

  • Download URL: ocr_tamil-0.0.2.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for ocr_tamil-0.0.2.tar.gz
Algorithm Hash digest
SHA256 509ee82b60a15066dc2654c0b37c2aabe158e5f93259fa6bfaf347eecd523ef8
MD5 472f99675e85e153bc5a07eaaf6e9865
BLAKE2b-256 7b2f1600c7c9c0095c8293a4f1d9fc398917c1bfee5fd52ccd2c80375c745645

See more details on using hashes here.

File details

Details for the file ocr_tamil-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: ocr_tamil-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 48.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for ocr_tamil-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7dbc57edbc24c7152fc7a5dd953633683058084da83248cfac76c872ff1974be
MD5 7c102c6946882407183c14b44d1bd3e4
BLAKE2b-256 86e4389977dd27de82bb6fe5e7b845c782388fe5268725b2029f8af200d48550

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page