Skip to content

Commit

Permalink
Allow line images with larger width (depending on height)
Browse files Browse the repository at this point in the history
Training with normalized line images higher than 36 px also results in larger widths.
The limit should therefore depend on the height used for the normalization.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jun 14, 2020
1 parent 6c29f9c commit 97079fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lstm/lstmrecognizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ bool LSTMRecognizer::RecognizeLine(const ImageData& image_data, bool invert,
bool debug, bool re_invert, bool upside_down,
float* scale_factor, NetworkIO* inputs,
NetworkIO* outputs) {
// Maximum width of image to train on.
const int kMaxImageWidth = 4096;
// This ensures consistent recognition results.
SetRandomSeed();
int min_width = network_->XScaleFactor();
Expand All @@ -244,6 +242,8 @@ bool LSTMRecognizer::RecognizeLine(const ImageData& image_data, bool invert,
tprintf("Line cannot be recognized!!\n");
return false;
}
// Maximum width of image to train on.
const int kMaxImageWidth = 128 * pixGetHeight(pix);
if (network_->IsTraining() && pixGetWidth(pix) > kMaxImageWidth) {
tprintf("Image too large to learn!! Size = %dx%d\n", pixGetWidth(pix),
pixGetHeight(pix));
Expand Down

0 comments on commit 97079fa

Please sign in to comment.