This is an Optical Character Recognition Library with the ability to train and deploy Deep Neural Network models to a Streamlit Web application. The base library in written using PyTorch and PyTorch-Lightning, while the dashboard was developed using the Streamlit library.
First, install dependencies
# clone deepOCR
git clone https://github.com/das-projects/deepOCR
# install deepOCR
cd deepOCR
pip install -e .
sudo apt-get install fonts-freefont-ttf -y
Next, try out the streamlit dashboard for a demonstration
# demo folder
cd deepOCR
# run demo
streamlit run demo/app.py
This project is setup as a package which means you can now easily import any file into any other file:
# Download an example image
wget https://eforms.com/download/2019/01/Cash-Payment-Receipt-Template.pdf
import matplotlib.pyplot as plt
from deepocr.io import DocumentFile
from deepocr.models import ocr_predictor
# Load the pdf file
doc = DocumentFile.from_pdf("Cash-Payment-Receipt-Template.pdf").as_images()
print(f"Number of pages: {len(doc)}")
# Use the predictor object to detect and recognize text
predictor = ocr_predictor(pretrained=True)
# show the predictor output!
result = predictor(doc)
result.show(doc)
# Use synthesize method to regenerate the image in a desired format
synthetic_pages = result.synthesize()
plt.imshow(synthetic_pages[0]); plt.axis('off'); plt.show()
- DBNet: Real-time Scene Text Detection with Differentiable Binarization.
- LinkNet: LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation
- CRNN: An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition.
- SAR: Show, Attend and Read:A Simple and Strong Baseline for Irregular Text Recognition.
- MASTER: MASTER: Multi-Aspect Non-local Network for Scene Text Recognition.
- ViTSTR: MASTER: Scene Text Recognition with Permuted Autoregressive Sequence Models.
@article{Arijit Das, Raphael Kronberg
title={deep OCR: Optical Character Recognition with Deep Learning},
author={Arijit Das, Raphael Kronberg},
journal={https://github.com/das-projects/deepOCR},
year={2022}
}