Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sartaj0/textrecognition-pytorch
Text recognition with Pytorch(CRNN). Provided Onnx model.
https://github.com/sartaj0/textrecognition-pytorch
crnn dnn ocr onnx opencv opencv-dnn pytorch text-recognition
Last synced: about 6 hours ago
JSON representation
Text recognition with Pytorch(CRNN). Provided Onnx model.
- Host: GitHub
- URL: https://github.com/sartaj0/textrecognition-pytorch
- Owner: sartaj0
- Created: 2021-11-02T12:22:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-01T10:14:32.000Z (almost 3 years ago)
- Last Synced: 2024-08-28T09:46:26.663Z (3 months ago)
- Topics: crnn, dnn, ocr, onnx, opencv, opencv-dnn, pytorch, text-recognition
- Language: Python
- Homepage: https://cv-project-deployed.herokuapp.com/
- Size: 27.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TextRecognition-Pytorch
## Onnx Model
From [here](https://drive.google.com/drive/folders/12S3AVgnK-hnjQvKHNyTiTIEIm_5MA7G3?usp=sharing) you can download onnx converted model and use this [file](https://github.com/sartaj0/TextRecognition-Pytorch/blob/main/inferenceWithOnnx.py) for inferencing with opencv.## Dependency
- pytorch 1.8.1, CUDA 10.2
`pip3 install torch==1.8.1+cu102 torchvision==0.9.1+cu102`
- Requirements: Pillow, opencv-python, tqdm, matplotlib, nltk
`pip3 install Pillow opencv-python tqdm matplotlib nltk`## Dataset
Download dataset from from [here](https://drive.google.com/drive/folders/1SGNmiD6FvZFS3Qjk5DILIQFTFi_vSx0g?usp=sharing)
data.zip contain below data.
[IIIT5k](http://cvit.iiit.ac.in/projects/SceneTextUnderstanding/IIIT5K.html)[1] [ic17](https://rrc.cvc.uab.es/?ch=8)[2] [ic03](http://www.iapr-tc11.org/mediawiki/index.php/ICDAR_2003_Robust_Reading_Competitions)[3] [IAM Handwriting Database](https://fki.tic.heia-fr.ch/databases/iam-handwriting-database)[4]## Training and Inference
#### Dataset Format
```
folder
├── data.json
└── data
├── word_1.png
├── word_2.png
├── word_3.png
```At this time, `data.json` should be `{imagename: label, }`
For example `{word_1: label, ...}`
#### 1. TrainSet The Paramters
```
from train import *
data_path = "E:/dataset/TextRecognition/MixedAll/data"
jsonFilePath = data_path+".json"model_save_directory = "check_points"
batch_size = 32
rnn_hidden_size = 256
cnn_output_channel = 512
num_epochs = 50
model_backbone = "resnet18"
imgSize = (50, 200)
# imgSize = (32, 100)
imgChannel = 1
lr = 0.000087
train(imgSize, imgChannel, data_path, jsonFilePath, model_backbone, model_save_directory, num_epochs, cnn_output_channel, rnn_hidden_size, batch_size, lr)
```#### 2. Validation
From training data it will use 20% images for validation#### 3. Inference
Once the training is completed it will use the best model for onnx conversion
you can use [inferenceWithOnnx.py](https://github.com/sartaj0/TextRecognition-Pytorch/blob/main/inferenceWithOnnx.py) for inferencing with opencv.![](https://github.com/sartaj0/GIfs/blob/main/2.jpg)
output: `develop`
output***
dassmate date page the water cucle is thie palith that al watey follows as at moves asound eanth in dpfestent ptat liouid water hound in oceans o rivers akee and even under raround solid iee ie found is alaciers onow and at the nortr and south sboles water vadoy a aas do found in farlhs atmos here the sun heat causce alaceers and snow se te melt into liouid water this watey sanpe intt oceans lakes and streams watey foom ce melbino snow and pe rlkd aoes iito e tthe 50ic tiere at suddlie water st tos folants and the around waa ter that ce we drink worrmi uaterr na bouy siscs up throuan easltis atmuss ene as the watey vaour viscs hiaher and hiahea the cool air ot the itmos causes the waler vapoly to ttuyn back snte lrauid water creatina clouds this brocess i5 called condenstin uhen a cloud be fuu a lrouid usater it falle toom the skn as rain
***
```
@InProceedings{MishraBMVC12,
author = "Mishra, A. and Alahari, K. and Jawahar, C.~V.",
title = "Scene Text Recognition using Higher Order Language Priors",
booktitle = "BMVC",
year = "2012",
}
```
## References- [zihaomu](https://github.com/zihaomu/deep-text-recognition-benchmark)
- [gokul karthik](https://www.kaggle.com/gokulkarthik/captcha-text-recognition-using-crnn-in-pytorch)
- [nanonets](https://nanonets.com/blog/deep-learning-ocr/)