-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support training without lstmf files #4215
Conversation
a4a22c0
to
8c1a3bc
Compare
Signed-off-by: Stefan Weil <[email protected]>
@@ -546,6 +547,31 @@ bool DocumentData::ReCachePages() { | |||
delete page; | |||
} | |||
pages_.clear(); | |||
#if !defined(TESSERACT_IMAGEDATA_AS_PIX) | |||
auto name_size = document_name_.size(); | |||
if (name_size > 4 && document_name_.substr(name_size - 4) == ".png") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use to use std::filesystem::path as in
if (filePath.extension() == ".box") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path refactoring should be done as more general procedure. It is ok to keep std::string in very local code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So would you prefer using std::filesystem::path::extension()
here or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok as is. fs::paths can be refactored for 6.0 wit api changes/breakage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@egorpugin: document_name_
is not part of tesseract API - it is the private object used in imagedata.cpp only, So I do not think it will break something or change API.
@stweil: I am fine with the current PR code, just I think we should step by step use c++17 features.
Hi - In my understanding of Tesseract before your merge, |
You still use list.train and list.eval, but they can now include .png files instead of .lstmf files. |
Sorry for the silly question, but may I assume that the corresponding I care about this because I am getting the error of
from time to time. I was wondering if this is due to insufficient LSTM cells to accommodate an entire training image, and I wonder if training without the |
Neither .box nor .lstmf files are used if you provide only .png files in the lists. |
I assume the textline within the png image should not have any padding, is that right? |
Our line images are from real prints and typically have random padding. As tesstrain uses PSM=13 by default, the .lstmf files would also contain line images with the same padding. |
The list of the training or validation files may now contain .png files instead of .lstmf files, so it is no longer necessary to spend time and disc space for creating .box and .lstmf files for a training.