ocr-tamil


Nameocr-tamil JSON
Version 0.3.6 PyPI version JSON
download
home_pagehttps://github.com/gnana70/tamil_ocr
SummaryPython Tamil OCR package
upload_time2024-03-22 14:49:24
maintainerNone
docs_urlNone
authorGnana Prasath
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Gnana Prasath Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ocr ocr tamil tamil indian ocr tamil ocr
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center"> OCR Tamil - Easy, Accurate and Simple to use Tamil OCR - (ஒளி எழுத்துணரி)</h1>

<p align="center">❤️️❤️️Please star✨ it if you like❤️️❤️️</p>

<p align="center">
  <a href="LICENSE">
    <img src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/MIT.svg" alt="LICENSE">
  </a>
  <a href="https://huggingface.co/spaces/GnanaPrasath/ocr_tamil">
    <img src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/huggingface.svg" alt="HuggingSpace">
  </a>
   <a href="https://colab.research.google.com/drive/11QPPj3EmpoIqnpuIznKeP1icxvVOjfux?usp=sharing">
    <img src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/colab.svg" alt="colab">
  </a>
</p>


<div align="center">
  <p>
    <a href="https://github.com/gnana70/tamil_ocr">
    <img width="50%" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/logo_1.gif">
    </a>
  </p>
</div>

 OCR Tamil can help you extract text from signboard, nameplates, storefronts etc., from Natural Scenes with high accuracy. This version of OCR is much more robust to tilted text compared to the Tesseract, Paddle OCR and Easy OCR as they are primarily built to work on the documents texts and not on natural scenes. This model is work in progress, feel free to contribute!!!

## Languages Supported 🔛
**➡️ English**

**➡️ Tamil (தமிழ்)**

## Accuracy 🎯
✔️ English > 98%

✔️ Tamil > 95%

## Comparison between Tesseract OCR, EasyOCR and OCR Tamil ⚖️
🏎️ 10-40% faster inference time than EasyOCR and Tesseract

🏎️ *10-40% faster inference time than EasyOCR and Tesseract*

 Input Image                                                                |  OCR TAMIL   🏆         | Tesseract         | EasyOCR |
|:--------------------------------------------------------------------------:|:--------------------:|:-----------------:|:-----------------:|
| <img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/4.jpg">                   | வாழ்கவளமுடன்✅     |    க்‌ க்கஸாரகளள௮ஊகஎளமுடன்‌ ❌  | வாழக வளமுடன்❌|
| <img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/11.jpg">                   | தமிழ்வாழ்க✅      | **NO OUTPUT** ❌           | தமிழ்வாழ்க✅      |
| <img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/2.jpg">                   | கோபி ✅              | **NO OUTPUT** ❌          | ப99❌          |
| <img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/6.jpg">                   | தாம்பரம் ✅           | **NO OUTPUT** ❌ | தாம்பரம❌ |
| <img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/1.jpg">                   | நெடுஞ்சாலைத் ✅      | **NO OUTPUT** ❌             |நெடுஞ்சாலைத் ✅      |
| <img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/5.jpg">                   | அண்ணாசாலை ✅     | **NO OUTPUT** ❌            |  ல@I9❌            |
| <img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/10.jpg">                  | ரெடிமேட்ஸ் ✅         |**NO OUTPUT** ❌     | ரெடிமேடஸ் ❌         |

**Obtained Tesseract and EasyOCR results using the [Colab notebook](https://colab.research.google.com/drive/1ylZm6afur85Pe6I10N2_tzuBFl2VIxkW?usp=sharing) with Tamil and english as language**

## Handwritten Text (Experimental)🧪
<img width="500" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/develop/test_images/tamil_handwritten.jpg">


```
MODEL OUTPUT: நிமிர்ந்த நன்னடை மேற்கொண்ட பார்வையும் 
நிலத்தில் யார்க் கும் அஞ்சாத நெறிகளும் 
திமிர்ந்த ஞானச் செருக்கும் இருப்பதால் 
செம்மை மாதர் திறம்புவ தில்லையாம் 
அமிழ்ந்து பேரிரு ளாமறி யாமையில் 
அவல மெய்திக் கலையின்  வாழ்வதை 
உமிழ்ந்து தள்ளுதல் பெண்ணற மாகுமாம் 
உதய கன்ன உரைப்பது கேட்டிரோ 
பாரதியார் 
ஹேமந்த் ம 
```


## How to Install and Use OCR Tamil 👨🏼‍💻

### Quick links🌐
📔 Detailed explanation on [Medium article](https://gnana70.medium.com/ocr-tamil-easy-accurate-and-simple-to-use-tamil-ocr-b03b98697f7b). 

✍️ Experiment in [Colab notebook](https://colab.research.google.com/drive/11QPPj3EmpoIqnpuIznKeP1icxvVOjfux?usp=sharing)

🤗 Test it in [Huggingface spaces](https://huggingface.co/spaces/GnanaPrasath/ocr_tamil)


### Pip install instructions🐍
In your command line, run the following command ```pip install ocr_tamil```

If you are using jupyter notebook , install like ```!pip install ocr_tamil```

### Python Usage - Single image inference

**Text Recognition only**

```python
from ocr_tamil.ocr import OCR

image_path = r"test_images\1.jpg" # insert your own path here
ocr = OCR()
text_list = ocr.predict(image_path)
print(text_list[0])

## OUTPUT : நெடுஞ்சாலைத்
```
<img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/1_180.jpg">


**Text Detect + Recognition**

```python
from ocr_tamil.ocr import OCR

image_path = r"test_images\0.jpg" # insert your own image path here
ocr = OCR(detect=True)
texts = ocr.predict(image_path)
print(" ".join(text_list[0]))

## OUTPUT : கொடைக்கானல் Kodaikanal 

```
<img width="400" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/0.jpg">


### Batch inference mode 💻

**Text Recognition only**

```python
from ocr_tamil.ocr import OCR

image_path = [r"test_images\1.jpg",r"test_images\2.jpg"] # insert your own image paths here
ocr = OCR()
text_list = ocr.predict(image_path)

for text in text_list:
    print(text)

## OUTPUT : நெடுஞ்சாலைத்
## OUTPUT : கோபி

```

**Text Detect + Recognition**

```python
from ocr_tamil.ocr import OCR

image_path = [r"test_images\0.jpg",r"test_images\tamil_sentence.jpg"] # insert your own image paths here
ocr = OCR(detect=True)
text_list = ocr.predict(image_path)

for item in text_list:
  print(" ".join(item))
    

## OUTPUT : கொடைக்கானல் Kodaikanal 
## OUTPUT : செரியர் யற்கை மூலிகைகளில் இருந்து ஈர்த்தெடுக்க்கப்பட்ட வீரிய உட்பொருட்களை உள்ளடக்கி எந்த இரசாயன சேர்க்கைகளும் இல்லாமல் உருவாக்கப்பட்ட இந்தியாவின் முதல் சித்த தயாரிப்பு 

```

### Advanced usage🚀

OCR module can be initialized by setting following parameters as per your requirements

```
1. Confidence of word ->  OCR(details=1)
2. Bounding Box and Confidence of word -> OCR(detect=True,details=2)
3. To change the CRAFT Text detection settings -> OCR(detect=True,text_threshold=0.5,
                                               link_threshold=0.1,
                                               low_text=0.30)
4. To increase the Batch size of text recognition -> OCR(batch_size=16) # set as per available memory
5. To configure the language to be extracted -> OCR(lang=["tamil"]) # list can take "english" or "tamil" or both. Defaults to both language
```

**Tested using Python 3.10 on Windows & Linux (Ubuntu 22.04) Machines**

## Applications⚡
1. ADAS system navigation based on the signboards + maps (hybrid approach) 🚁
2. License plate recognition 🚘

## Limitations⛔

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

<p align="left">
<img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/9.jpg"> 
<img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/8.jpg">
</p>

2. Currently supports Only English and Tamil Language

3. Document Text reading capability is limited. Auto identification of Paragraph, reading order are not supported along with Text detection model inability to detect and crop the Tamil text leads to accuracy decrease (**WORKAROUND** Can use your own text detection model along with OCR tamil text recognition model)
<p align="center">
<img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/tamil_sentence.jpg">
</p>
<p align="center">
<span>Cropped Text from Text detection Model</span>
</p>
<p align="center">
<img width="200" alt="teaser" src="https://github.com/gnana70/tamil_ocr/raw/main/test_images/tamil_sentence_crop.jpg">
</p>
<p align="center">
Character **இ** missing due to text detection model error 
</p>

**?**யற்கை மூலிகைகளில் இருந்து ஈர்த்தெடுக்கக்கப்பட்ட வீரிய உட்பொருட்களை உள்ளடக்கி எந்த இரசாயன சேர்க்கைகளும் இல்லாமல் உருவாக்கப்பட்ட இந்தியாவின் முதல் சித்த தயாரிப்பு 


## Acknowledgements 👏

**Text detection** - [CRAFT TEXT DECTECTION](https://github.com/clovaai/CRAFT-pytorch)

**Text recognition** - [PARSEQ](https://github.com/baudm/parseq)


```bibtex
@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}
}
```

```bibtex
@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

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


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/gnana70/tamil_ocr",
    "name": "ocr-tamil",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "ocr, ocr tamil, tamil, indian ocr, tamil ocr",
    "author": "Gnana Prasath",
    "author_email": "Gnana Prasath <gnana70@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a9/4c/289c7b4b7dadaaf028df3f666ac11ac9faaccb340702674dbb9149fd311e/ocr_tamil-0.3.6.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\"> OCR Tamil - Easy, Accurate and Simple to use Tamil OCR - (\u0b92\u0bb3\u0bbf \u0b8e\u0bb4\u0bc1\u0ba4\u0bcd\u0ba4\u0bc1\u0ba3\u0bb0\u0bbf)</h1>\r\n\r\n<p align=\"center\">\u2764\ufe0f\ufe0f\u2764\ufe0f\ufe0fPlease star\u2728 it if you like\u2764\ufe0f\ufe0f\u2764\ufe0f\ufe0f</p>\r\n\r\n<p align=\"center\">\r\n  <a href=\"LICENSE\">\r\n    <img src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/MIT.svg\" alt=\"LICENSE\">\r\n  </a>\r\n  <a href=\"https://huggingface.co/spaces/GnanaPrasath/ocr_tamil\">\r\n    <img src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/huggingface.svg\" alt=\"HuggingSpace\">\r\n  </a>\r\n   <a href=\"https://colab.research.google.com/drive/11QPPj3EmpoIqnpuIznKeP1icxvVOjfux?usp=sharing\">\r\n    <img src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/colab.svg\" alt=\"colab\">\r\n  </a>\r\n</p>\r\n\r\n\r\n<div align=\"center\">\r\n  <p>\r\n    <a href=\"https://github.com/gnana70/tamil_ocr\">\r\n    <img width=\"50%\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/logo_1.gif\">\r\n    </a>\r\n  </p>\r\n</div>\r\n\r\n OCR Tamil can help you extract text from signboard, nameplates, storefronts etc., from Natural Scenes with high accuracy. This version of OCR is much more robust to tilted text compared to the Tesseract, Paddle OCR and Easy OCR as they are primarily built to work on the documents texts and not on natural scenes. This model is work in progress, feel free to contribute!!!\r\n\r\n## Languages Supported \ud83d\udd1b\r\n**\u27a1\ufe0f English**\r\n\r\n**\u27a1\ufe0f Tamil (\u0ba4\u0bae\u0bbf\u0bb4\u0bcd)**\r\n\r\n## Accuracy \ud83c\udfaf\r\n\u2714\ufe0f English > 98%\r\n\r\n\u2714\ufe0f Tamil > 95%\r\n\r\n## Comparison between Tesseract OCR, EasyOCR and OCR Tamil \u2696\ufe0f\r\n\ud83c\udfce\ufe0f 10-40% faster inference time than EasyOCR and Tesseract\r\n\r\n\ud83c\udfce\ufe0f *10-40% faster inference time than EasyOCR and Tesseract*\r\n\r\n Input Image                                                                |  OCR TAMIL   \ud83c\udfc6         | Tesseract         | EasyOCR |\r\n|:--------------------------------------------------------------------------:|:--------------------:|:-----------------:|:-----------------:|\r\n| <img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/4.jpg\">                   | \u0bb5\u0bbe\u0bb4\u0bcd\u0b95\u0bb5\u0bb3\u0bae\u0bc1\u0b9f\u0ba9\u0bcd\u2705     |    \u0b95\u0bcd\u200c \u0b95\u0bcd\u0b95\u0bb8\u0bbe\u0bb0\u0b95\u0bb3\u0bb3\u0bee\u0b8a\u0b95\u0b8e\u0bb3\u0bae\u0bc1\u0b9f\u0ba9\u0bcd\u200c \u274c  | \u0bb5\u0bbe\u0bb4\u0b95 \u0bb5\u0bb3\u0bae\u0bc1\u0b9f\u0ba9\u0bcd\u274c|\r\n| <img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/11.jpg\">                   | \u0ba4\u0bae\u0bbf\u0bb4\u0bcd\u0bb5\u0bbe\u0bb4\u0bcd\u0b95\u2705      | **NO OUTPUT** \u274c           | \u0ba4\u0bae\u0bbf\u0bb4\u0bcd\u0bb5\u0bbe\u0bb4\u0bcd\u0b95\u2705      |\r\n| <img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/2.jpg\">                   | \u0b95\u0bcb\u0baa\u0bbf \u2705              | **NO OUTPUT** \u274c          | \u0baa99\u274c          |\r\n| <img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/6.jpg\">                   | \u0ba4\u0bbe\u0bae\u0bcd\u0baa\u0bb0\u0bae\u0bcd \u2705           | **NO OUTPUT** \u274c | \u0ba4\u0bbe\u0bae\u0bcd\u0baa\u0bb0\u0bae\u274c |\r\n| <img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/1.jpg\">                   | \u0ba8\u0bc6\u0b9f\u0bc1\u0b9e\u0bcd\u0b9a\u0bbe\u0bb2\u0bc8\u0ba4\u0bcd \u2705      | **NO OUTPUT** \u274c             |\u0ba8\u0bc6\u0b9f\u0bc1\u0b9e\u0bcd\u0b9a\u0bbe\u0bb2\u0bc8\u0ba4\u0bcd \u2705      |\r\n| <img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/5.jpg\">                   | \u0b85\u0ba3\u0bcd\u0ba3\u0bbe\u0b9a\u0bbe\u0bb2\u0bc8 \u2705     | **NO OUTPUT** \u274c            |  \u0bb2@I9\u274c            |\r\n| <img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/10.jpg\">                  | \u0bb0\u0bc6\u0b9f\u0bbf\u0bae\u0bc7\u0b9f\u0bcd\u0bb8\u0bcd \u2705         |**NO OUTPUT** \u274c     | \u0bb0\u0bc6\u0b9f\u0bbf\u0bae\u0bc7\u0b9f\u0bb8\u0bcd \u274c         |\r\n\r\n**Obtained Tesseract and EasyOCR results using the [Colab notebook](https://colab.research.google.com/drive/1ylZm6afur85Pe6I10N2_tzuBFl2VIxkW?usp=sharing) with Tamil and english as language**\r\n\r\n## Handwritten Text (Experimental)\ud83e\uddea\r\n<img width=\"500\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/develop/test_images/tamil_handwritten.jpg\">\r\n\r\n\r\n```\r\nMODEL OUTPUT: \u0ba8\u0bbf\u0bae\u0bbf\u0bb0\u0bcd\u0ba8\u0bcd\u0ba4 \u0ba8\u0ba9\u0bcd\u0ba9\u0b9f\u0bc8 \u0bae\u0bc7\u0bb1\u0bcd\u0b95\u0bca\u0ba3\u0bcd\u0b9f \u0baa\u0bbe\u0bb0\u0bcd\u0bb5\u0bc8\u0baf\u0bc1\u0bae\u0bcd \r\n\u0ba8\u0bbf\u0bb2\u0ba4\u0bcd\u0ba4\u0bbf\u0bb2\u0bcd \u0baf\u0bbe\u0bb0\u0bcd\u0b95\u0bcd \u0b95\u0bc1\u0bae\u0bcd \u0b85\u0b9e\u0bcd\u0b9a\u0bbe\u0ba4 \u0ba8\u0bc6\u0bb1\u0bbf\u0b95\u0bb3\u0bc1\u0bae\u0bcd \r\n\u0ba4\u0bbf\u0bae\u0bbf\u0bb0\u0bcd\u0ba8\u0bcd\u0ba4 \u0b9e\u0bbe\u0ba9\u0b9a\u0bcd \u0b9a\u0bc6\u0bb0\u0bc1\u0b95\u0bcd\u0b95\u0bc1\u0bae\u0bcd \u0b87\u0bb0\u0bc1\u0baa\u0bcd\u0baa\u0ba4\u0bbe\u0bb2\u0bcd \r\n\u0b9a\u0bc6\u0bae\u0bcd\u0bae\u0bc8 \u0bae\u0bbe\u0ba4\u0bb0\u0bcd \u0ba4\u0bbf\u0bb1\u0bae\u0bcd\u0baa\u0bc1\u0bb5 \u0ba4\u0bbf\u0bb2\u0bcd\u0bb2\u0bc8\u0baf\u0bbe\u0bae\u0bcd \r\n\u0b85\u0bae\u0bbf\u0bb4\u0bcd\u0ba8\u0bcd\u0ba4\u0bc1 \u0baa\u0bc7\u0bb0\u0bbf\u0bb0\u0bc1 \u0bb3\u0bbe\u0bae\u0bb1\u0bbf \u0baf\u0bbe\u0bae\u0bc8\u0baf\u0bbf\u0bb2\u0bcd \r\n\u0b85\u0bb5\u0bb2 \u0bae\u0bc6\u0baf\u0bcd\u0ba4\u0bbf\u0b95\u0bcd \u0b95\u0bb2\u0bc8\u0baf\u0bbf\u0ba9\u0bcd  \u0bb5\u0bbe\u0bb4\u0bcd\u0bb5\u0ba4\u0bc8 \r\n\u0b89\u0bae\u0bbf\u0bb4\u0bcd\u0ba8\u0bcd\u0ba4\u0bc1 \u0ba4\u0bb3\u0bcd\u0bb3\u0bc1\u0ba4\u0bb2\u0bcd \u0baa\u0bc6\u0ba3\u0bcd\u0ba3\u0bb1 \u0bae\u0bbe\u0b95\u0bc1\u0bae\u0bbe\u0bae\u0bcd \r\n\u0b89\u0ba4\u0baf \u0b95\u0ba9\u0bcd\u0ba9 \u0b89\u0bb0\u0bc8\u0baa\u0bcd\u0baa\u0ba4\u0bc1 \u0b95\u0bc7\u0b9f\u0bcd\u0b9f\u0bbf\u0bb0\u0bcb \r\n\u0baa\u0bbe\u0bb0\u0ba4\u0bbf\u0baf\u0bbe\u0bb0\u0bcd \r\n\u0bb9\u0bc7\u0bae\u0ba8\u0bcd\u0ba4\u0bcd \u0bae \r\n```\r\n\r\n\r\n## How to Install and Use OCR Tamil \ud83d\udc68\ud83c\udffc\u200d\ud83d\udcbb\r\n\r\n### Quick links\ud83c\udf10\r\n\ud83d\udcd4 Detailed explanation on [Medium article](https://gnana70.medium.com/ocr-tamil-easy-accurate-and-simple-to-use-tamil-ocr-b03b98697f7b). \r\n\r\n\u270d\ufe0f Experiment in [Colab notebook](https://colab.research.google.com/drive/11QPPj3EmpoIqnpuIznKeP1icxvVOjfux?usp=sharing)\r\n\r\n\ud83e\udd17 Test it in [Huggingface spaces](https://huggingface.co/spaces/GnanaPrasath/ocr_tamil)\r\n\r\n\r\n### Pip install instructions\ud83d\udc0d\r\nIn your command line, run the following command ```pip install ocr_tamil```\r\n\r\nIf you are using jupyter notebook , install like ```!pip install ocr_tamil```\r\n\r\n### Python Usage - Single image inference\r\n\r\n**Text Recognition only**\r\n\r\n```python\r\nfrom ocr_tamil.ocr import OCR\r\n\r\nimage_path = r\"test_images\\1.jpg\" # insert your own path here\r\nocr = OCR()\r\ntext_list = ocr.predict(image_path)\r\nprint(text_list[0])\r\n\r\n## OUTPUT : \u0ba8\u0bc6\u0b9f\u0bc1\u0b9e\u0bcd\u0b9a\u0bbe\u0bb2\u0bc8\u0ba4\u0bcd\r\n```\r\n<img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/1_180.jpg\">\r\n\r\n\r\n**Text Detect + Recognition**\r\n\r\n```python\r\nfrom ocr_tamil.ocr import OCR\r\n\r\nimage_path = r\"test_images\\0.jpg\" # insert your own image path here\r\nocr = OCR(detect=True)\r\ntexts = ocr.predict(image_path)\r\nprint(\" \".join(text_list[0]))\r\n\r\n## OUTPUT : \u0b95\u0bca\u0b9f\u0bc8\u0b95\u0bcd\u0b95\u0bbe\u0ba9\u0bb2\u0bcd Kodaikanal \r\n\r\n```\r\n<img width=\"400\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/0.jpg\">\r\n\r\n\r\n### Batch inference mode \ud83d\udcbb\r\n\r\n**Text Recognition only**\r\n\r\n```python\r\nfrom ocr_tamil.ocr import OCR\r\n\r\nimage_path = [r\"test_images\\1.jpg\",r\"test_images\\2.jpg\"] # insert your own image paths here\r\nocr = OCR()\r\ntext_list = ocr.predict(image_path)\r\n\r\nfor text in text_list:\r\n    print(text)\r\n\r\n## OUTPUT : \u0ba8\u0bc6\u0b9f\u0bc1\u0b9e\u0bcd\u0b9a\u0bbe\u0bb2\u0bc8\u0ba4\u0bcd\r\n## OUTPUT : \u0b95\u0bcb\u0baa\u0bbf\r\n\r\n```\r\n\r\n**Text Detect + Recognition**\r\n\r\n```python\r\nfrom ocr_tamil.ocr import OCR\r\n\r\nimage_path = [r\"test_images\\0.jpg\",r\"test_images\\tamil_sentence.jpg\"] # insert your own image paths here\r\nocr = OCR(detect=True)\r\ntext_list = ocr.predict(image_path)\r\n\r\nfor item in text_list:\r\n  print(\" \".join(item))\r\n    \r\n\r\n## OUTPUT : \u0b95\u0bca\u0b9f\u0bc8\u0b95\u0bcd\u0b95\u0bbe\u0ba9\u0bb2\u0bcd Kodaikanal \r\n## OUTPUT : \u0b9a\u0bc6\u0bb0\u0bbf\u0baf\u0bb0\u0bcd \u0baf\u0bb1\u0bcd\u0b95\u0bc8 \u0bae\u0bc2\u0bb2\u0bbf\u0b95\u0bc8\u0b95\u0bb3\u0bbf\u0bb2\u0bcd \u0b87\u0bb0\u0bc1\u0ba8\u0bcd\u0ba4\u0bc1 \u0b88\u0bb0\u0bcd\u0ba4\u0bcd\u0ba4\u0bc6\u0b9f\u0bc1\u0b95\u0bcd\u0b95\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0b9f\u0bcd\u0b9f \u0bb5\u0bc0\u0bb0\u0bbf\u0baf \u0b89\u0b9f\u0bcd\u0baa\u0bca\u0bb0\u0bc1\u0b9f\u0bcd\u0b95\u0bb3\u0bc8 \u0b89\u0bb3\u0bcd\u0bb3\u0b9f\u0b95\u0bcd\u0b95\u0bbf \u0b8e\u0ba8\u0bcd\u0ba4 \u0b87\u0bb0\u0b9a\u0bbe\u0baf\u0ba9 \u0b9a\u0bc7\u0bb0\u0bcd\u0b95\u0bcd\u0b95\u0bc8\u0b95\u0bb3\u0bc1\u0bae\u0bcd \u0b87\u0bb2\u0bcd\u0bb2\u0bbe\u0bae\u0bb2\u0bcd \u0b89\u0bb0\u0bc1\u0bb5\u0bbe\u0b95\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0b9f\u0bcd\u0b9f \u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe\u0bb5\u0bbf\u0ba9\u0bcd \u0bae\u0bc1\u0ba4\u0bb2\u0bcd \u0b9a\u0bbf\u0ba4\u0bcd\u0ba4 \u0ba4\u0baf\u0bbe\u0bb0\u0bbf\u0baa\u0bcd\u0baa\u0bc1 \r\n\r\n```\r\n\r\n### Advanced usage\ud83d\ude80\r\n\r\nOCR module can be initialized by setting following parameters as per your requirements\r\n\r\n```\r\n1. Confidence of word ->  OCR(details=1)\r\n2. Bounding Box and Confidence of word -> OCR(detect=True,details=2)\r\n3. To change the CRAFT Text detection settings -> OCR(detect=True,text_threshold=0.5,\r\n                                               link_threshold=0.1,\r\n                                               low_text=0.30)\r\n4. To increase the Batch size of text recognition -> OCR(batch_size=16) # set as per available memory\r\n5. To configure the language to be extracted -> OCR(lang=[\"tamil\"]) # list can take \"english\" or \"tamil\" or both. Defaults to both language\r\n```\r\n\r\n**Tested using Python 3.10 on Windows & Linux (Ubuntu 22.04) Machines**\r\n\r\n## Applications\u26a1\r\n1. ADAS system navigation based on the signboards + maps (hybrid approach) \ud83d\ude81\r\n2. License plate recognition \ud83d\ude98\r\n\r\n## Limitations\u26d4\r\n\r\n1. Unable to read the text if they are present in rotated forms\r\n\r\n<p align=\"left\">\r\n<img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/9.jpg\"> \r\n<img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/8.jpg\">\r\n</p>\r\n\r\n2. Currently supports Only English and Tamil Language\r\n\r\n3. Document Text reading capability is limited. Auto identification of Paragraph, reading order are not supported along with Text detection model inability to detect and crop the Tamil text leads to accuracy decrease (**WORKAROUND** Can use your own text detection model along with OCR tamil text recognition model)\r\n<p align=\"center\">\r\n<img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/tamil_sentence.jpg\">\r\n</p>\r\n<p align=\"center\">\r\n<span>Cropped Text from Text detection Model</span>\r\n</p>\r\n<p align=\"center\">\r\n<img width=\"200\" alt=\"teaser\" src=\"https://github.com/gnana70/tamil_ocr/raw/main/test_images/tamil_sentence_crop.jpg\">\r\n</p>\r\n<p align=\"center\">\r\nCharacter **\u0b87** missing due to text detection model error \r\n</p>\r\n\r\n**?**\u0baf\u0bb1\u0bcd\u0b95\u0bc8 \u0bae\u0bc2\u0bb2\u0bbf\u0b95\u0bc8\u0b95\u0bb3\u0bbf\u0bb2\u0bcd \u0b87\u0bb0\u0bc1\u0ba8\u0bcd\u0ba4\u0bc1 \u0b88\u0bb0\u0bcd\u0ba4\u0bcd\u0ba4\u0bc6\u0b9f\u0bc1\u0b95\u0bcd\u0b95\u0b95\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0b9f\u0bcd\u0b9f \u0bb5\u0bc0\u0bb0\u0bbf\u0baf \u0b89\u0b9f\u0bcd\u0baa\u0bca\u0bb0\u0bc1\u0b9f\u0bcd\u0b95\u0bb3\u0bc8 \u0b89\u0bb3\u0bcd\u0bb3\u0b9f\u0b95\u0bcd\u0b95\u0bbf \u0b8e\u0ba8\u0bcd\u0ba4 \u0b87\u0bb0\u0b9a\u0bbe\u0baf\u0ba9 \u0b9a\u0bc7\u0bb0\u0bcd\u0b95\u0bcd\u0b95\u0bc8\u0b95\u0bb3\u0bc1\u0bae\u0bcd \u0b87\u0bb2\u0bcd\u0bb2\u0bbe\u0bae\u0bb2\u0bcd \u0b89\u0bb0\u0bc1\u0bb5\u0bbe\u0b95\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0b9f\u0bcd\u0b9f \u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe\u0bb5\u0bbf\u0ba9\u0bcd \u0bae\u0bc1\u0ba4\u0bb2\u0bcd \u0b9a\u0bbf\u0ba4\u0bcd\u0ba4 \u0ba4\u0baf\u0bbe\u0bb0\u0bbf\u0baa\u0bcd\u0baa\u0bc1 \r\n\r\n\r\n## Acknowledgements \ud83d\udc4f\r\n\r\n**Text detection** - [CRAFT TEXT DECTECTION](https://github.com/clovaai/CRAFT-pytorch)\r\n\r\n**Text recognition** - [PARSEQ](https://github.com/baudm/parseq)\r\n\r\n\r\n```bibtex\r\n@InProceedings{bautista2022parseq,\r\n  title={Scene Text Recognition with Permuted Autoregressive Sequence Models},\r\n  author={Bautista, Darwin and Atienza, Rowel},\r\n  booktitle={European Conference on Computer Vision},\r\n  pages={178--196},\r\n  month={10},\r\n  year={2022},\r\n  publisher={Springer Nature Switzerland},\r\n  address={Cham},\r\n  doi={10.1007/978-3-031-19815-1_11},\r\n  url={https://doi.org/10.1007/978-3-031-19815-1_11}\r\n}\r\n```\r\n\r\n```bibtex\r\n@inproceedings{baek2019character,\r\n  title={Character Region Awareness for Text Detection},\r\n  author={Baek, Youngmin and Lee, Bado and Han, Dongyoon and Yun, Sangdoo and Lee, Hwalsuk},\r\n  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},\r\n  pages={9365--9374},\r\n  year={2019}\r\n}\r\n```\r\n\r\n## Citation\r\n\r\n```bibtex\r\n@InProceedings{GnanaPrasath,\r\n  title={Tamil OCR},\r\n  author={Gnana Prasath D},\r\n  month={01},\r\n  year={2024},\r\n  url={https://github.com/gnana70/tamil_ocr}\r\n}\r\n```\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Gnana Prasath  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Python Tamil OCR package",
    "version": "0.3.6",
    "project_urls": {
        "Homepage": "https://github.com/gnana70/tamil_ocr"
    },
    "split_keywords": [
        "ocr",
        " ocr tamil",
        " tamil",
        " indian ocr",
        " tamil ocr"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "182d76933d8fa66e947a7287b23812bd2f3a309ae592329f4283d9f227d9de08",
                "md5": "d7ae0546605511fb91c527ef34fc78a8",
                "sha256": "466f285e2f6a4cac77ea0f8694394815e385a676a72f8f5c56a7267af7042e5e"
            },
            "downloads": -1,
            "filename": "ocr_tamil-0.3.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d7ae0546605511fb91c527ef34fc78a8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 49278,
            "upload_time": "2024-03-22T14:49:21",
            "upload_time_iso_8601": "2024-03-22T14:49:21.825194Z",
            "url": "https://files.pythonhosted.org/packages/18/2d/76933d8fa66e947a7287b23812bd2f3a309ae592329f4283d9f227d9de08/ocr_tamil-0.3.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a94c289c7b4b7dadaaf028df3f666ac11ac9faaccb340702674dbb9149fd311e",
                "md5": "3f7eb04777a811ad1618b782d691f3a1",
                "sha256": "7c65a68f1ca6bfa7a020bf0c8911130f24781fa95570f4ab805d1fc06b061f65"
            },
            "downloads": -1,
            "filename": "ocr_tamil-0.3.6.tar.gz",
            "has_sig": false,
            "md5_digest": "3f7eb04777a811ad1618b782d691f3a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 42795,
            "upload_time": "2024-03-22T14:49:24",
            "upload_time_iso_8601": "2024-03-22T14:49:24.160538Z",
            "url": "https://files.pythonhosted.org/packages/a9/4c/289c7b4b7dadaaf028df3f666ac11ac9faaccb340702674dbb9149fd311e/ocr_tamil-0.3.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-22 14:49:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gnana70",
    "github_project": "tamil_ocr",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "ocr-tamil"
}
        
Elapsed time: 0.21883s