mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 20:59:36 +08:00
lstmtraining: Handle missing traineddata with error message (fix issue #1075)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
2a66694754
commit
68017dbf2a
@ -112,7 +112,10 @@ int main(int argc, char **argv) {
|
||||
tesseract::LSTMTrainer trainer(FLAGS_model_output.c_str(), checkpoint_file.c_str(),
|
||||
FLAGS_debug_interval,
|
||||
static_cast<int64_t>(FLAGS_max_image_MB) * 1048576);
|
||||
trainer.InitCharSet(FLAGS_traineddata.c_str());
|
||||
if (!trainer.InitCharSet(FLAGS_traineddata.c_str())) {
|
||||
tprintf("Error, failed to read %s\n", FLAGS_traineddata.c_str());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Reading something from an existing model doesn't require many flags,
|
||||
// so do it now and exit.
|
||||
|
@ -95,9 +95,12 @@ public:
|
||||
// Initializes the character set encode/decode mechanism directly from a
|
||||
// previously setup traineddata containing dawgs, UNICHARSET and
|
||||
// UnicharCompress. Note: Call before InitNetwork!
|
||||
void InitCharSet(const std::string &traineddata_path) {
|
||||
ASSERT_HOST(mgr_.Init(traineddata_path.c_str()));
|
||||
InitCharSet();
|
||||
bool InitCharSet(const std::string &traineddata_path) {
|
||||
bool success = mgr_.Init(traineddata_path.c_str());
|
||||
if (success) {
|
||||
InitCharSet();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
void InitCharSet(const TessdataManager &mgr) {
|
||||
mgr_ = mgr;
|
||||
|
Loading…
Reference in New Issue
Block a user