Live data from Hacker News

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

github.com

161–170 of 178 posts

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

#161
post #131

This is how you end up with "Xerox scanners/photocopiers randomly alter numbers in scanned documents" https://www.dkriesel.com/en/blog/2013/0802_xerox-workcentres... I dont want hallucinations in places where OCR loses plot. I want either better OCR or error message telling me to repeat the scan.

After thinking about it some more this is exactly what tom7 implemented in 'Badness 0' http://tom7.org/bovex/ You get a pretty, but not entirely correct output.

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

#162

Earlier quoted context omitted.

They're just a new Swift-only interface to the same underlying behaviors, no apparent improvement. I was hoping for more given the visionOS launch but alas What I'm trying now is combining ML Kit v2 with Live Text - Apple's for the accurate paragraphs of text, and then custom indexing that against the ML Kit v2 output to add bounding rects and guessing corrections for missing/misidentified parts from ML Kit (using it…

I feel like text detection is much better covered by the various ML models discussed elsewhere in the comments. Maybe you can combine those with Live Text. I found Tesseract pretty ok for text detection as well but I don’t know if any of the models are good for vertical text.

ML Kit v2 works with vertical text better than Tessy

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

#164
post #98

Earlier quoted context omitted.

I agree that vision models that actually have access to the image are a more sound approach than using OCR and trying to fix it up. It may be more expensive though, and depending on what you're trying to do it may be good enough. What I want to do is reading handwritten documents from the 18th century, and I feel like the multistep approach hits a hard ceiling there. Transkribus is multistep, but the line detecion mo…

I also think it’s probably more effective. Every time hand-crafted tools are better than AI but then the model becomes bigger and AI wins. Think hand crafted image classification to full model or hand crafted language translation to full model. In this case, the model can already do the OCR and becomes an order of magnitude cheaper per year.

The Bitter Lesson -> http://www.incompleteideas.net/IncIdeas/BitterLesson.html

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

#166

Earlier quoted context omitted.

Have you tried uploading image of your handwriting to ChatGPT interface with ChatGPT 4o? And what the results were? And if not could you try and let us know what the results are.

Not with 4o, but I tried it with 4 (through Copilot) a while ago and the results were abysmal, even with very neatly printed handwriting.

Try again with 4o through the ChatGPT interface. Since I am getting very good results. I don't think gpt 4 was multimodal like gpt4o so must have used some other methodology?

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

#167
post #124
post #38

Earlier quoted context omitted.

> I convert each pdf page to an image and send one request per page to Flash Why convert? Flash 1.5 accepts whole PDFs just fine. It will also increase the models response accuracy. Context: I have found Flash 1.5 is excellent and stable for this kind of use-case. Even at a non-EA price-point it's incredibly cheap, especially when utilizing Batch Prediction Jobs (50% discount!).

> Flash 1.5 accepts whole PDFs just fine. Sometimes models cannot extract the text from the pdf in that case you need to use give the image of the page.

Ah, yes, I've found pre-processing the PDFs to sanitize against things like that has been helpful. That's a whole other process though.

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

#168
post #38

Earlier quoted context omitted.

> I convert each pdf page to an image and send one request per page to Flash Why convert? Flash 1.5 accepts whole PDFs just fine. It will also increase the models response accuracy. Context: I have found Flash 1.5 is excellent and stable for this kind of use-case. Even at a non-EA price-point it's incredibly cheap, especially when utilizing Batch Prediction Jobs (50% discount!).

Curious how you test accuracy across different models, and how much is cost per page?

In my experience at this point all the flagship multi-modal LLM provide for the same accuracy. I see very little, if any, drift in output between them, especially if you have your prompts dialed.

For the Gemini Flash 1.5 model GCP pricing[0] treats each PDF page an image, so you're looking at pricing per image ($0.00002) + the token count ($0.00001875 / 1k characters) from the base64 string encoding of the entire PDF and the context you provide.

10 page PDF ($0.0002) + ~3,000 tokens of context/base64 ($0.00005625) = $0.00025625

Cut that in half if you utilize Batch Prediction jobs[1] and even at scale you're looking at a rounding error in costs.

For on-going accuracy tracking I take a static proportion of the generations (say 1%, or 10 PDFs for every 1,000) and run them through an evaluation[2] workflow. Depending on how/what you're extracting from the PDFs the eval method is going to change, but I find for "unstructured to structured" use-cases the fulfillment evaluation is a fair test.

0. https://cloud.google.com/vertex-ai/generative-ai/pricing 1. https://cloud.google.com/vertex-ai/generative-ai/docs/model-... 2. https://cloud.google.com/vertex-ai/generative-ai/docs/models...

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

#169
post #167
post #124

Earlier quoted context omitted.

> Flash 1.5 accepts whole PDFs just fine. Sometimes models cannot extract the text from the pdf in that case you need to use give the image of the page.

Ah, yes, I've found pre-processing the PDFs to sanitize against things like that has been helpful. That's a whole other process though.

What steps does that involve?

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

#170
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.

My experience is that at least the models which are price-competitive (~= open weight and small enough to run on a 3/4090 - MiniCPM-V, Phi-3-V, Kosmos-2.5) are not as good as Tesseract or EasyOCR. They're often more accurate on plain text where their language knowledge is useful but on symbols, numbers, and weird formatting they're at best even. Sometimes they go completely off the rails when they see a dashed line o…

Did you test the MiniCPM (v2.6) released last week ? It was able to extract (and label) most complex examples I gave it on their huggingface space:

https://huggingface.co/spaces/openbmb/MiniCPM-V-2_6

Post reply on HN