From ec87dd4d49855161e0d53bb00295edf219725635 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 6 Sep 2021 08:17:18 +0200 Subject: [PATCH] Abort LSTM training with integer model (fixes issue #1573) Tesseract currently cannot continue LSTM training from an integer (fast) model. Report this to users who try it nevertheless instead of crashing with an assertion. Signed-off-by: Stefan Weil --- src/training/unicharset/lstmtrainer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/training/unicharset/lstmtrainer.cpp b/src/training/unicharset/lstmtrainer.cpp index a774b5f7..b608942e 100644 --- a/src/training/unicharset/lstmtrainer.cpp +++ b/src/training/unicharset/lstmtrainer.cpp @@ -105,6 +105,10 @@ bool LSTMTrainer::TryLoadingCheckpoint(const char *filename, const char *old_tra if (!ReadTrainingDump(data, *this)) { return false; } + if (IsIntMode()) { + tprintf("Error, %s is an integer (fast) model, cannot continue training\n", filename); + return false; + } if (((old_traineddata == nullptr || *old_traineddata == '\0') && network_->NumOutputs() == recoder_.code_range()) || filename == old_traineddata) { -- GitLab