Live data from Hacker News

Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

github.com

41–50 of 62 posts

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#41
post #30

Earlier quoted context omitted.

WASM is a form of FFI.

Wait, how so? WASM isn't an interface or a wrapper, it's a language/format. Having trouble understanding what you mean by this, unless you're arguing that the WASM VM itself is the FFI?

I can kinda see what they mean (albeit it's somewhat of a stretch).

WASM "embeds" modules within the JS runtime, in a similar way that traditional FFI "embeds" native bindings compiled separately & externally. It's still quite different insofar as the VM is a part of the runtime, but there are vague parallels.

For me though, the practical problems related to runtime env that one encounters with traditional ffi bindings calling dynamically linked native libraries are rarely present with a WASM library, as the support within the runtime is explicit (the only real exception here is architecture, which is always an issue regardless).

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#42
I'm surprised that seemingly there are no other major FOSS OCRs than Tesseract and Tesseract is quite frankly horrible. I once tried to use it on a high-resolution screenshot of a Discord message containing only the characters "0" and "1". I cropped it to only have the text, restricted character sets, tried fiddling with the images contrast and what not and the result was still quite poor, with many characters mistaken or straight up ignored.

I have little expertise in ML, but from my limited understanding, OCR is the bread and butter of the field. I've read exactly one "Intro to ML" article and it was about recognising digits. And yet, we have an abundance of high quality proprietary OCRs that can recognise printed or even hand-written text and the single open source one is having trouble with perfectly formatted text with a readable font.

Could anyone with more expertise shine some light on this current state of affairs?

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#43

I made a utility that cleans up your Mac desktop and uses Tesseract to extract text from screenshots. This makes it really easy to find screenshots by searching for a line of text you remember. https://gitlab.com/bearjaws/cluttr#readme

This is awesome, you should post this as its own thing

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#44
post #19

Earlier quoted context omitted.

For “text In the wild” or scene text, the last time I checked, EasyOCR and PaddleOCR were both good.

Just IMHO Apple's Vision framework has been great too, and very easy to get started

Vision's rectangle detection or document scanner has worked well for us but in comparison to what Google's MLKit OCR offers it pales in comparison. MLKit OCR also does language detection + more languages out of the box.

EasyOCR is definitely interesting and something that's worked well for us at a prototyping level.

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#45
It's annoying to find out the actual code that does the OCR is not in this repo after looking through the entire thing. It's just a bunch of scheduling and worker logic and for some reason the JS is written twice once for the browser and once for Node.

The actual code that does the OCR is wraped and included via this package [0] which just wraps the original Tesseract in C++ [1] using wasm. Shameful title.

[0] https://github.com/naptha/tesseract.js-core

[1] https://github.com/jeromewu/tesseract

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#46

Why OCR tools (Tessract and Paddle) are written in Python? Even this one is in JS. Is there any single-binary static OCR tool comparable to these two?

This is not written in JS. It's c++ code compiled into something runnable under JS. If you want to run tesseract from python there is PyTesseract which is a wrapper around the tesseract cli. Also, I'm sure there are python bindings to invoke the tesseract libs without going over the cli but I've never looked it up.

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#47
post #32

Earlier quoted context omitted.

> so "pure" in the title doesn't really make sense. I can see where you're coming from, but I've never used or heard anyone in the web world use "pure" to mean only "written entirely in Javascript without transpilation or other tools." If it hits the parts of "pure JS" that most people care about: - it's running entirely in Javascript. - it has no native dependencies. - it can run entirely clientside. - it can be emb…

“Pure” does definitely connote that you’ll be able to read all the code in the given language. That’s exactly what “pure” means - “pure rust”, “pure go”, etc. IMO you can’t say the heart of all the work is a c++ lib and call it a “pure JS” anything. More accurately / correctly / usefully would be calling it “JS wrapper over a c++ library cross compiled to JS”. Or maybe “All JS at runtime” or some other qualifier. Wan…

I tend to agree. When I see "pure" I don't think about the code being hand written in JS I think more about the potential of browser run OR that there are no native modules for Node required.

That being said perhaps a poll is needed to find out what most people think.

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#48
post #42

I'm surprised that seemingly there are no other major FOSS OCRs than Tesseract and Tesseract is quite frankly horrible. I once tried to use it on a high-resolution screenshot of a Discord message containing only the characters "0" and "1". I cropped it to only have the text, restricted character sets, tried fiddling with the images contrast and what not and the result was still quite poor, with many characters mistak…

As I mentioned in another comment, EasyOCR and PaddleOCR.

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#49
post #30

Earlier quoted context omitted.

WASM is a form of FFI.

Wait, how so? WASM isn't an interface or a wrapper, it's a language/format. Having trouble understanding what you mean by this, unless you're arguing that the WASM VM itself is the FFI?

It is FFI from JavaScript point of view, a way to call multiple native languages from JavaScript, requires import and export definitions, a wasm file is no different than a .o, .a, .obj, .lib, other than not using instructions of a real CPU on the market.

Re: Tesseract.js wraps an Emscripten port of the Tesseract OCR Engine

#50
I tried to use Tesseract for a personal hobby project and found it very lacking. The OCR was not very accurate. I ended up switching to Azure Vision services which gives you 500 free OCR API calls a day (or some similar limit). This was perfect for my needs.
Post reply on HN