TinyOCR: The Most Lightweight OCR, Ever. banner

TinyOCR: The Most Lightweight OCR, Ever.

1 devlog
8h 22m 42s

TinyOCR: A prototype of an OCR that I built for JAI hackathon that happened in Feb. It had the following conditions that it fulfills:

  1. Fully offline, lightweight and fast
  2. The model.bin file is under 2 MB! (Without any quantization or prun…

TinyOCR: A prototype of an OCR that I built for JAI hackathon that happened in Feb. It had the following conditions that it fulfills:

  1. Fully offline, lightweight and fast
  2. The model.bin file is under 2 MB! (Without any quantization or pruning)

It doesn’t have the greatest accuracy right now because of the way it works but it’s more of a proof-of-concept

(Not marked as an update since it was not started before Dec 15 2026 and is not submitted to a Hack Club program, it was a local Hackathon near my home)

This project uses AI

Only used Gemini for one small part of the code (Mentioned in the notes), otherwise coded everything myself.

Demo Repository

Loading README...

Yusuf

I did not add Devlogs here for this project.
I am really sorry for that, though I did take some screenshots throughout building this and documented the process. (Which I will publish in a blog post, hopefully in a few days.)

To reiterate, this is a very basic proof-of-concept MVP. Here are more details on how I built it:

First of all, I tried creating my own CNN model by watching a bunch of tutorials, but failed (It’s easy to put in one sentence but it took me a LONG TIME and also a bunch of unlogged hours since most of it was on Google Colab)

Then, I realised I could use something called ‘Transfer Learning’ and researched for the best models, and I found ShuffleNetV2, which was just around 6 MB and had a lot of classes (Objects that it could detect), but I only needed 47 classes (Numbers + Capital Letters + Some Small letters, provided by the EMNIST dataset)

So I imported the model, ‘unfroze’ it and then re-trained it using Google Colab’s free GPU to create the model.

The next step was to build an OpenCV pipeline to preprocess the image. I already had some experience with OpenCV, so it was easy to start. On top of that, I watched a bunch of other implementations and tutorials on this to do this.

The accuracy is still poor, and I have many potential improvements, but I was able to get the model under 2 MB using the methods described above.

Attachment
Attachment
Attachment
0