Live data from Hacker News

Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

github.com

11–20 of 178 posts

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#11

It's a very interesting idea, but the potential for hallucinations reminds me of JBIG2, a compression format which would sometimes substitute digits in faxed documents: https://en.wikipedia.org/wiki/JBIG2#Character_substitution_e... > In 2013, various substitutions (including replacing "6" with "8") were reported to happen on many Xerox Workcentre photocopier and printer machines. Numbers printed on scanned (but not…

An OCR will always mix up characters so I don’t really see the issue here?

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#12

Have you tried using other OCR packages? I had to give up on Tesseract after every mode and model I tried read a quite plain image of "77" as "7" (and interestingly the javascript port reads it as "11"). Pic related: https://i.postimg.cc/W3QkkhCK/speed-roi-thresh.png

You know, I’ve really looked hard at what’s out there and haven’t been able to find anything else that’s totally free/open, that runs well on CPU, and which has better quality output than Tesseract. I found a couple Chinese projects but had trouble getting them to work and the documentation wasn’t great. If you have any leads on others to try I’d love to hear about them. One of the benefits of this project is that it…

macOS Live Text is incredible. Mac only though

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#13
post #6

I'm curious if a multimodal model would be better at the OCR step than tesseract? Probably would increase the cost but I wonder if that would be offset by needing less post processing.

I don't want to jump to conclusions, but I don't feel confident using gpt4o/claude for OCR, as I often experience issues mentioned on this page https://github.com/Yuliang-Liu/MultimodalOCR

[edit] But it is not applicable to OCR specialised models like Florence-2

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#14
post #2

Very cool! I have a hotkey to grab a region and pipe a screenshot through tesseract and then pipe that into my clipboard. I'll have to add on to it to pipe it though Ollama too :)

We've built an app like that but for PDF table extraction, https://table2xl.com

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#15

It's a very interesting idea, but the potential for hallucinations reminds me of JBIG2, a compression format which would sometimes substitute digits in faxed documents: https://en.wikipedia.org/wiki/JBIG2#Character_substitution_e... > In 2013, various substitutions (including replacing "6" with "8") were reported to happen on many Xerox Workcentre photocopier and printer machines. Numbers printed on scanned (but not…

An OCR will always mix up characters so I don’t really see the issue here?

Nope. Most compression does not mix up characters the way JBIG2 does (see the article), and most OCR does not substitute plausible text in for text it fails to scan.

Let's say the text is "The laptop costs $1,000 (one thousand dollars)." but the image is blurry.

Normal compression will give you an image where "$1,000" is blurry. JBIG2 can give you an image where "$1,000" has been replaced by a perfectly-clear "$7,000."

Normal OCR will give you some nonsense like "The laptop costs $7,000 (one 1housand dollars)". The LLM can "fix this up" to something more plausible like "The laptop costs $2,000 (two thousand dollars)."

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#16

what are examples of local LLMs that accept images, that are mentioned in the README?

This is the best I've found so far:

https://huggingface.co/xtuner/llava-llama-3-8b-v1_1-gguf

But I see that this new one just came out using Llama 3.1 8B:

https://huggingface.co/aimagelab/LLaVA_MORE-llama_3_1-8B-fin...

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#17

what are examples of local LLMs that accept images, that are mentioned in the README?

LLaVA is one LLM that takes both text and images as inputs - https://llava-vl.github.io/

Although LLaVA specifically it might not be great for OCR; IIRC it scales all input images to 336 x 336 - meaning it'll only spot details that are visible at that scale.

You can also search on HuggingFace for the tag "image-text-to-text" https://huggingface.co/models?pipeline_tag=image-text-to-tex... and find a variety of other models.

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#18
post #6

I'm curious if a multimodal model would be better at the OCR step than tesseract? Probably would increase the cost but I wonder if that would be offset by needing less post processing.

IME GPT-4V is a lot better than Tesseract, including on scanned document PDFs. The thing about frontier models is they aren’t free but they keep getting better too. I’m not using tesseract for anything anymore, for my tasks it’s obsolete.

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#19
Fantastic work is emerging in this field, and with the new release of the schnell model of the flux series we will have the downstream captioning datasets we need to produce a new SOTA vision model, which has been the last straggler in the various open llm augmentations. Most vision models are still based on ancient CLIP/BLIP captioning and even with something like LLAVA or the remarkable phi-llava, we are still held back by the pretained vision components which have been needing love for some months now.

Tessy and LLM is a good pipe, it's likely what produced SCHNELL and will soon be the reverse of this configuration, used for testing and checking while the LLM does the bulk of transcription via vision modality adaption. The fun part of that is that multi lingual models will be able to read and translate, opening up new work for scholars searching through digitized works. Already I have had success in this area with no development at all, after we get our next SOTA vision models I am expecting a massive jump in quality. I expect english vision model adapters to show up using LLAVA architecture first, this may put some other latin script languages into the readable category depending on the adapted model, but we could see a leapfrog of scripts becoming readable all at once. LLAVA-PHI3 already seems to be able to transcribe tiny pieces of hebrew with relative consistency. It also has horrible hallucinations, so there is very much an unknown limiting factor here currently. I was planning some segmentation experiments but schnell knocked that out of my hands like a bar of soap in a prison shower, I will be waiting for a distilled captioning sota to come before I re-evaluate this area.

Exciting times!

Re: Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

#20
post #6

I'm curious if a multimodal model would be better at the OCR step than tesseract? Probably would increase the cost but I wonder if that would be offset by needing less post processing.

I found Claude3 great an reading documents. Plus it can describe figures. The only issue I ran into was giving it a 2-column article, and if reading the first line on each column "kinda made sense" together it would treat the entire thing as 1 column.
Post reply on HN