Merge pull request #2977 from stweil/limit

This commit is contained in:
zdenop 2020-05-12 19:14:09 +02:00 committed by GitHub
commit f9f8da1b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,8 +265,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 = 2560;
// This ensures consistent recognition results.
SetRandomSeed();
int min_width = network_->XScaleFactor();
@ -276,6 +274,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));