OpenCV OCR and text recognition with Tesseract

Hello i have a .pb file which will work fine against new input images, how to get trained model code for the .pb file

Hey Suhas, sorry I’m having trouble following the question. Would you be able to elaborate on the question? Thank you!


Hello Vishal,

Thanks for asking, i gone through following website for image text recognition problem, he sent me the code along with .pb file(model) and its working fine against input images, like its detecting all text in image, but he didn’t send code for training and testing .

Could you help me out in building this model file my own.


Hey Suhas,

Looks like the .pb model file included is a tensorflow trained model. You need to be able to load the model and convert to an mxnet model. I would suggest taking a look at the documentation on this page to understand the .pb model and then looking into to ONNX or mmdnn for conversion.

Alternatively, you can train a model from scratch in mxnet to create bounding boxes around regions of text in an image. See this blogpost/tutorial on how to use ssd network for this use case and this tutorial for training ssd using pretrained ssd model with gluon-cv. You would need a dataset for text recognition though like the COCO dataset and you can find instructions for loading that using gluon-cv here