tesseract.js icon indicating copy to clipboard operation
tesseract.js copied to clipboard

Failed loading language from *.traineddata

Open JackWittmayer opened this issue 4 years ago • 1 comments

I am running nearly the exact example shown in this tesseract.js example. The only difference is that I have replaced the "LCDDot_FT_500.traineddata" file with my own "Fallout.traineddata" file that I generated using the tess tutorial. When I run Node index on this code:

const { createWorker, PSM } = require('tesseract.js');
const worker = createWorker({
  langPath: '..',
  gzip: false,
  logger: m => console.log(m)
});

(async () => {
  await worker.load();
  await worker.loadLanguage('Fallout');
  await worker.initialize('Fallout');
  const { data: { text } } = await worker.recognize('../lcddot.png');
  console.log(text);
  await worker.terminate();
})();

this is my output:

{ status: 'loading tesseract core', progress: 0 }
{ status: 'loaded tesseract core', progress: 1 }
{
  workerId: 'Worker-0-4526d',
  status: 'initializing tesseract',
  progress: 0
}
{
  workerId: 'Worker-0-4526d',
  status: 'initialized tesseract',
  progress: 1
}
{
  workerId: 'Worker-0-4526d',
  status: 'loading language traineddata',
  progress: 0
}
{
  workerId: 'Worker-0-4526d',
  status: 'loaded language traineddata',
  progress: 1
}
{ workerId: 'Worker-0-4526d', status: 'initializing api', progress: 0 }
Failed loading language 'Fallout'
Tesseract couldn't load any languages!
{ workerId: 'Worker-0-4526d', status: 'initialized api', progress: 1 }
{
  workerId: 'Worker-0-4526d',
  jobId: 'Job-0-b25ee',
  status: 'recognizing text',
  progress: 0
}
AdaptedTemplates != nullptr:Error:Assert failed:in file /src/src/classify/adaptmatch.cpp, line 196
trap!
trap!
/home/Explosion7/WebstormProjects/tesseract.js-custom-traineddata/node_modules/tesseract.js/src/createWorker.js:135
      throw Error(data);
      ^

Error: abort(trap!). Build with -s ASSERTIONS=1 for more info.
    at ChildProcess.<anonymous> (/home/Explosion7/WebstormProjects/tesseract.js-custom-traineddata/node_modules/tesseract.js/src/createWorker.js:135:13)
    at ChildProcess.emit (events.js:321:20)
    at emit (internal/child_process.js:881:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)

The provided example seems to work fine with the .traineddata it provides, but not with my own. This leads me to believe that there is something wrong with my file, but I have no idea how to fix it. I have attached the entire project as well as just my .traineddata file. I will provide any additional information, just ask. Thank you. tesseract.js-custom-traineddata (copy).zip Fallout.traineddata

JackWittmayer avatar May 08 '20 15:05 JackWittmayer

Try deleting the Keyval database. I find that it can store incorrect data that is then cached. It looks like this is a cache issue.

UserJHansen avatar Dec 21 '21 01:12 UserJHansen

The link to your traineddata is dead. If this issue is still active, please provide a new link and/or confirm your traineddata file works using the desktop version of Tesseract.

Balearica avatar Aug 28 '22 23:08 Balearica

Closing issue as stale. I am aware that other users are experiencing similar error messages (and there are several open issues regarding this already), however this issue appears to be specific to a custom .traineddata file we can no longer access. Feel free to reopen if you want to re-upload the .traineddata file at issue.

Balearica avatar Sep 18 '22 05:09 Balearica