Scene Text Recognition Toolkit across 13 Indian Languages which contains detection, script identification, and text recognition modules
Project description
A Comprehensive Toolkit for Scene Text Recognition in Indian Languages
IndicPhotoOCR is a scene text recognition toolkit designed for detecting, identifying, and recognizing text across Indian languages, including Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu, and English, with support for Urdu and Meitei in the pipeline. It is built to handle the unique scripts and complex structures of Indian languages, offering robust detection and recognition capabilities. The package can be installed with just few lines of code, and a straightforward wrapper function makes it easy to use.
Table of Content
Updates
Installation
How to use
Bharat Scene Text Dataset
Contributors
Acknowledgement
Contact us
Updates
[Feburary 2025]: Added option to choose between tri-lingual and 12 class script identifiction models.
[Feburary 2025]: Added recoginition models for Malayalam and Kannada.
[January 2025]: Added ViT based script identification models.
[January 2025]: Demo available in huggingface space.
Currently demo supports scene images containing bi-lingual Hindi and English text.
[December 2024]: Detection Module: TextBPN++ added.
[November 2024]: Code available at Google Colab.
[November 2024]: Added support for 10 languages in the recognition module.
[September 2024]: Repository created.
Installation
Currently we need to manually create virtual environemnt.
conda create -n indicphotoocr python=3.9 -y
conda activate indicphotoocr
git clone https://github.com/Bhashini-IITJ/IndicPhotoOCR.git
cd IndicPhotoOCR
CPU Installation
python setup.py sdist bdist_wheel
pip install dist/IndicPhotoOCR-1.3.0-py3-none-any.whl[cpu]
CUDA 11.8 Installation
python setup.py sdist bdist_wheel
pip install ./dist/IndicPhotoOCR-1.3.0-py3-none-any.whl[cu118] --extra-index-url https://download.pytorch.org/whl/cu118
CUDA 12.1 Installation
python setup.py sdist bdist_wheel
pip install ./dist/IndicPhotoOCR-1.3.0-py3-none-any.whl[cu121] --extra-index-url https://download.pytorch.org/whl/cu121
If you find any trouble with the above installation use the setup.sh script. Make sure you have miniconda installed.
git clone https://github.com/Bhashini-IITJ/IndicPhotoOCR.git
cd IndicPhotoOCR
chmod +x setup.sh
./setup.sh
Config
Currently this model works for hindi v/s english script identification and thereby hindi and english recognition.
Detection Model: TextBPN++
ScripIndetification Model: Hindi v/s English
Recognition Model: Hindi, English, Assamese, Bengali, Gujarati, Marathi, Odia, Punjabi, Tamil, Telugu, Malayalam, kannada.
How to use
Detection
>>> from IndicPhotoOCR.ocr import OCR
# Create an object of OCR
>>> ocr_system = OCR(verbose=True) # for CPU --> OCR(device="cpu")
# Get detections
>>> detections = ocr_system.detect("test_images/image_141.jpg")
# Running text detection...
# 4334 text boxes before nms
# 1.027989387512207
# Save and visualize the detection results
>>> ocr_system.visualize_detection("test_images/image_141.jpg", detections)
# Image saved at: test.png
Cropped Word Script Identification
>>> from IndicPhotoOCR.ocr import OCR
# Create an object of OCR
>>> ocr_system = OCR(verbose=True, identifier_lang ="auto") # for CPU --> OCR(device="cpu")
# Get script id
>>> ocr_system.identify("test_images/cropped_image/image_141_0.jpg")
# 'hindi'
Cropped Word Recognition
>>> from IndicPhotoOCR.ocr import OCR
# Create an object of OCR
>>> ocr_system = OCR(verbose=True) # for CPU --> OCR(device="cpu")
# Get recognitions
>>> ocr_system.recognise("test_images/cropped_image/image_141_0.jpg", "hindi")
# Recognizing text in detected area...
# 'मण्डी'
End-to-end Scene Text Recognition
>>> from IndicPhotoOCR.ocr import OCR
# Create an object of OCR
>>> ocr_system = OCR(verbose=True, identifier_lang ="auto") # for CPU --> OCR(device="cpu")
# Complete pipeline
>>> ocr_system.ocr("test_images/image_141.jpg")
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Recognized word: रोड
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Recognized word: बाराखम्बा
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Recognized word: राजीव
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Recognized word: चौक
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Recognized word: मण्डी
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Recognized word: हाऊस
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Using cache found in /root/.cache/torch/hub/baudm_parseq_main
# Recognized word: rajiv
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Using cache found in /root/.cache/torch/hub/baudm_parseq_main
# Recognized word: chowk
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Using cache found in /root/.cache/torch/hub/baudm_parseq_main
# Recognized word: mandi
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Using cache found in /root/.cache/torch/hub/baudm_parseq_main
# Recognized word: house
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Using cache found in /root/.cache/torch/hub/baudm_parseq_main
# Recognized word: barakhamba
# Identifying script for the cropped area...
# Recognizing text in detected area...
# Using cache found in /root/.cache/torch/hub/baudm_parseq_main
# Recognized word: road
Related Large-Scale Indian Language Scene Text Dataset
Bharat Scene Text Dataset - BSTD
Contributors
| Anik De |
| Tech Lead and Main Contributor |
| Abhirama | Aditya Rathore | Harshiv Shah |
| Contributor | Contributor | Contributor |
| Sagar Agarwal | Rajeev Yadav | Pravin Kumar |
| Contributor | Contributor | Contributor |
| Anand Mishra |
| Project Investigator |
Citation
@misc{ipo,
author = {Anik De et al.}
title = {{I}ndic{P}hoto{O}CR: A comprehensive toolkit for {I}ndian language scene text understanding},
howpublished = {\url{https://github.com/Bhashini-IITJ/IndicPhotoOCR/}},
year = 2024,
}
Acknowledgement
Text Recognition - PARseq
EAST re-implemenation repository.
TextBPN++ repository.
National Language Translation Mission Bhashini.
Contact us
For any queries, please contact us at:
Changelog
[1.3.1] - 2025-17-25
Added
- Seperate function for script identification
- Added device opts for recognition
[1.3.0] - 2025-17-25
Added
- ViT models for script detection
- Word order based on horizontal and vertical lines
[1.2.0] - 2024-11-24
Added
- Textbpn++ detection model added
[1.1.0] - 2024-11-24
Added
- Updated package naming convention
[1.0.3] - 2024-11-06
Added
- Python package requirements sorted with setup.py
[1.0.2] - 2024-11-01
Added
- Added language support for 10 additional models in the recognition module.
[1.0.1] - 2024-10-28
Added
- Added support for detecting polygonal bounding boxes in
visualize_detection. - Introduced the
showargument invisualize_detectionto control image display.
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file indicphotoocr-1.3.1.tar.gz.
File metadata
- Download URL: indicphotoocr-1.3.1.tar.gz
- Upload date:
- Size: 112.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb834bf684af445a23956200ddc36e0a9caf919a4c4a9b3e1ca8ff50dbcdc58a
|
|
| MD5 |
d822db061954cd38ae60cc8029bca1f2
|
|
| BLAKE2b-256 |
d0d6f0c99f93d4e94fb1db0a009ad800ba990057ae687e42169520f032bfaeb8
|
File details
Details for the file indicphotoocr-1.3.1-py3-none-any.whl.
File metadata
- Download URL: indicphotoocr-1.3.1-py3-none-any.whl
- Upload date:
- Size: 149.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e15a11f350a650104d8b152a5ff03b8bdecf8a194a593831b0db4982d10e0644
|
|
| MD5 |
b762f9bb69bab08c0f51c78607af0b18
|
|
| BLAKE2b-256 |
aa61a1ad009960ce65f2c8563c1419163fc9e79f73b447edba723b5effe8afc4
|
File details
Details for the file IndicPhotoOCR-1.3.1-py3-none-any.whl.
File metadata
- Download URL: IndicPhotoOCR-1.3.1-py3-none-any.whl
- Upload date:
- Size: 149.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbf43a638548d0a8a56b93ae0c7417f812541064378bc91d934c571f9797515b
|
|
| MD5 |
886e1784ffe17a6696f0534eb14c3589
|
|
| BLAKE2b-256 |
904b72c64c8fc0427b9132f138ea87fad00bce804056ac9d1bf40312101cd25c
|