Tesseract.js

AI

OCR in the browser and Node, as a WebAssembly port of Tesseract.

Latest v7.0.0 · by napthaWebsitenaptha/tesseract.js

Changelog

v7.0.0

Latest
Added 1
  • A new relaxedsimd build that takes advantage of the latest WASM and hardware capabilities
Changed 1
  • Significant improvements to recognition speed, with runtimes reduced by approximately 15-35% depending on device and use-case
Removed 1
  • Dropped support for Node.js v14

From Tesseract.js

What's Changed
  • Significant improvements to recognition speed (by @fanchenkong1 in https://github.com/naptha/tesseract.js/pull/1039)
    • A new relaxedsimd build takes advantage of the latest WASM and hardware capabilities.
    • Upgrading from v6 to v7 reduces runtimes by ~15-35% (depending on device and use-case). The highest uplifts are currently seen on the latest Intel processors.
  • Dropped support for Node.js v14.
  • Various minor changes
New Contributors

Full Changelog: https://github.com/naptha/tesseract.js/compare/v6.0.1...v7.0.0

View originalPermalink
How v7.0.0 went

v6.0.1

Changed 1
  • Switched from using node-fetch to using built-in fetch implementation for Node.js v18 and newer
Fixed 1
  • Resolve dependency-related warning message

From Tesseract.js

What's Changed
  • Switched from using node-fetch to using built-in fetch implementation for Node.js v18 and newer.
    • This resolves a nuisance dependency-related warning message reported in #876
  • Various minor updates

Full Changelog: https://github.com/naptha/tesseract.js/compare/v6.0.0...v6.0.1

View originalPermalink
How v6.0.1 went

v6.0.0

Changed 5
  • Reduced runtime and memory usage for most users by updating default formats
  • All output formats other than text are now disabled by default
  • The JavaScript object output format (blocks) now returns only the array of blocks instead of automatically generating lists of words and symbols
  • Only text-based blocks are reported, non-text blocks are no longer automatically reported
  • The shape of some block objects was changed, with main properties text and bbox remaining unchanged
Fixed 3
  • Fixed memory leaks that caused memory to rise over time and eventually lead to crashes
  • Fixed compatibility with Electron main process
  • Fixed bug where user-provided parameters were overwritten by defaults
Removed 1
  • Removed previously deprecated functions including worker.initialize and worker.loadLanguage

From Tesseract.js

What's Changed
  • Fixed memory leaks (#977)
    • This version fixed a long-standing issue where memory would rise over time, eventually leading to a crash.
  • Reduced runtime and memory usage for most users by updating default formats (#916).
  • Fixed compatibility with Electron main process (#925)
  • Fixed bug where user-provided parameters were overwritten by defaults (#975).
Breaking Changes
  1. All outputs formats other than text are now disabled by default.
    • To re-enable the hocr output (for example), set the following: worker.recognize(image, {}, { hocr: true })
      • See here for a list of possible output formats.
  2. The JavaScript object output format (blocks) was tweaked.
    • Only the array of blocks (blocks) is returned.
      • Previous versions would automatically generate lists of every unit of text (words, symbols, etc.).
        • If needed, these should now be generated by the user.
    • Only text-based blocks are reported.
      • Previous versions reported non-text blocks when detected by Tesseract (e.g. line segments).
    • The shape of some objects were changed.
      • See the type declarations for reference on properties.
      • The main properties--text and bbox--are unchanged.
  3. Various functions and options marked as depreciated previously have been removed.
    1. This includes worker.initialize and worker.loadLanguage, along with several depreciated options from v2.

See #993 for additional discussion about this release.

New Contributors

Full Changelog: https://github.com/naptha/tesseract.js/compare/v5.1.1...v6.0.0

View originalPermalink
How v6.0.0 went

v5.1.1

Fixed 2
  • Bug where incorrect language data was loaded when oem is 2
  • Bug where boolean values in blocks output format would always be false

From Tesseract.js

What's Changed
  • Fixed bug where incorrect language data was loaded when oem is 2 (#938)
  • Fixed bug where boolean values in blocks output format would always be false (#907)

Full Changelog: https://github.com/naptha/tesseract.js/compare/v5.1.0...v5.1.1

View originalPermalink
How v5.1.1 went

v5.1.0

Added 1
  • Add line size metrics to blocks output including rowAttributes property with ascenders, descenders, and row_height metrics on line objects

From Tesseract.js

What's Changed
  • Added line size metrics to blocks output (#906)
    • line objects now include a property named rowAttributes, which is an object containing ascenders, descenders, and row_height metrics
    • These metrics allow for manual font size calculations that are more accurate than using the font_size property.
  • Updates to documentation, types, and dependencies
New Contributors

Full Changelog: https://github.com/naptha/tesseract.js/compare/v5.0.5...v5.1.0

View originalPermalink
How v5.1.0 went

v5.0.5

Changed 1
  • Minor fixes to documentation and types
Fixed 2
  • Fixed bug triggered by running worker.recognize while a previous call to worker.recognize is still running
  • Fixed bug with rotateAuto option unnecessarily inflating runtime

From Tesseract.js

What's Changed
  • Fixed bug triggered by running worker.recognize while a previous call to worker.recognize is still running (#875)
    • Sending multiple jobs to the same worker at the same time is still not recommended.
    • Instead, schedulers should be used to coordinate running jobs in parallel (see this example)
  • Fixed bug with rotateAuto option unnecessarily inflating runtime (#892)
  • Minor fixes to documentation and types

Full Changelog: https://github.com/naptha/tesseract.js/compare/v5.0.4...v5.0.5

View originalPermalink
How v5.0.5 went

v5.0.4

Fixed 1
  • Support for setting "init only" parameters using the config option of createWorker, such as load_number_dawg

From Tesseract.js

What's Changed
  • Fixed support for setting "init only" parameters using config option of createWorker (#862)
    • For example, load_number_dawg is an "init only" parameter that cannot be set using either worker.setParameters or the options argument of worker.recognize.
    • However, load_number_dawg can be set by the following createWorker statement.
      • createWorker('eng', "0", {}, {load_number_dawg: "0"});
  • Improvements to documentation
New Contributors

Full Changelog: https://github.com/naptha/tesseract.js/compare/v5.0.3...v5.0.4

View originalPermalink
How v5.0.4 went

v5.0.2

Fixed 1
  • Fixed bugs with wrong lang data being loaded

From Tesseract.js

What's Changed

Version 5.0.1 is nearly identical to 5.0.2 and was the latest version for under a day, so does not have its own release notes.

Full Changelog: https://github.com/naptha/tesseract.js/compare/v5.0.0...v5.0.2

View originalPermalink
How v5.0.2 went

v5.0.0

Added 1
  • worker.reinitialize function to reinitialize workers with different settings
Changed 7
  • File sizes reduced by 54% for English and 73% for Chinese
  • Worker memory utilization reduced from 311 MB to 164 MB (47% reduction)
  • Language and OEM arguments now set in createWorker instead of loadLanguage and initialize
  • worker.initialize and worker.loadLanguage functions now do nothing
  • corePath directory must now contain all 4 core files (tesseract-core.wasm.js, tesseract-core-simd.wasm.js, tesseract-core-lstm.wasm.js, tesseract-core-simd-lstm.wasm.js)
  • worker.detect function disabled by default, requiring legacyCore and legacyLang options to enable
  • Language data loaded from jsdelivr by default instead of GitHub pages
Fixed 1
  • Made compatible with iOS 17
Removed 1
  • Separate development build that produced tesseract.dev.js and worker.dev.js

From Tesseract.js

What's Changed
Major New Features
  1. Significantly smaller file sizes
    1. 54% smaller file sizes for English, 73% smaller for Chinese (see #806 for details)
    2. This results in a ~50% decrease in runtime for first-time users (who do not yet have the data downloaded/cached)
  2. Significantly lower memory usage
    1. Worker memory utilization in the web benchmark is reduced from 311 MB to 164 MB (47% reduction)
    2. The lower memory footprint makes it feasible to use more workers, significantly improving performance for projects that utilize schedulers for parallel processing
  3. Compatible with iOS 17 (using default settings)
    1. iOS 17 broke compatibility with Tesseract.js v4--upgrading to v5 should resolve
      1. See discussion section below for details
Breaking Changes Impacting Many Users
  1. createWorker arguments changed
    1. Setting non-default language and OEM now happens in createWorker
      1. E.g. createWorker("chi_sim", 1)
  2. worker.initialize and worker.loadLanguage functions now do nothing and can be deleted from code
    1. Loading the language and initialization now occurs in createWorker
    2. Workers can be re-initialized with different settings using worker.reinitialize

In other words, code should be modified from this:

const worker = await Tesseract.createWorker();
await worker.loadLanguage('eng');
await worker.initialize('eng');
const ret = await worker.recognize(file);

To this:

const worker = await Tesseract.createWorker("eng");
const ret = await worker.recognize(file);
Breaking Changes Impacting Fewer Users
  1. Users who manually set corePath will need to update the contents of their corePath directory
    1. corePath should point to a directory that contains all 4 of the files below from Tesseract.js-core v5:
      1. tesseract-core.wasm.js
      2. tesseract-core-simd.wasm.js
      3. tesseract-core-lstm.wasm.js
      4. tesseract-core-simd-lstm.wasm.js
    2. Tesseract.js will automatically select the correct version to use
  2. worker.detect function disabled by default
    1. Orientation + script detection is a function of the Legacy model only, which is no longer included by default
    2. To enable, set arguments legacyCore: true and legacyLang: true in createWorker options
      1. E.g. Tesseract.createWorker("eng", 1, {legacyCore: true, legacyLang: true});
  3. Language of progress logs standardized
    1. This should only impact users who parse status logs (e.g. to update a loading bar)
Non-Breaking Changes
  1. Language data loaded from jsdelivr by default (rather than GitHub pages)
    1. This should result in improved performance and uptime
  2. Separate "development" build (that produced tesseract.dev.js and worker.dev.js removed
  3. Documentation and examples were modified to prevent new users from using Tesseract.recognize and Tesseract.detect
    1. Users who already use these functions are encouraged to modify their code to use worker.recognize and worker.detect instead

Considering upgrading from v2 to v5? See #771 for a full guide for updating.

Full Changelog: https://github.com/naptha/tesseract.js/compare/v4.1.3...v5.0.0

View originalPermalink
How v5.0.0 went
View all

Discussion

If you publish Tesseract.js, you can claim this product by proving you administer its repository.