19 #ifndef TESSERACT_LSTM_LSTMRECOGNIZER_H_ 20 #define TESSERACT_LSTM_LSTMRECOGNIZER_H_ 24 #include "imagedata.h" 27 #include "networkscratch.h" 28 #include "recodebeam.h" 31 #include "unicharcompress.h" 90 series->EnumerateLayers(
nullptr, &layers);
96 ASSERT_HOST(
id.length() > 1 &&
id[0] ==
':');
104 ASSERT_HOST(
id.length() > 1 &&
id[0] ==
':');
117 for (
int i = 0; i < layers.
size(); ++i) {
125 ASSERT_HOST(
id.length() > 1 &&
id[0] ==
':');
186 double worst_dict_cert,
const TBOX& line_box,
191 float* min_output,
float* mean_output,
float* sd);
202 bool re_invert,
bool upside_down,
float* scale_factor,
214 const char* window_name,
246 int best_choice,
int x_start,
int x_end);
312 #endif // TESSERACT_LSTM_LSTMRECOGNIZER_H_ bool SimpleTextOutput() const
Definition: lstmrecognizer.h:76
ScrollView * debug_win_
Definition: lstmrecognizer.h:307
void LabelsFromOutputs(const NetworkIO &outputs, GenericVector< int > *labels, GenericVector< int > *xcoords)
Definition: lstmrecognizer.cpp:417
void ScaleLayerLearningRate(const STRING &id, double factor)
Definition: lstmrecognizer.h:123
LossType
Definition: static_shape.h:29
int null_char() const
Definition: lstmrecognizer.h:154
TRand randomizer_
Definition: lstmrecognizer.h:298
bool LoadRecoder(TFile *fp)
Definition: lstmrecognizer.cpp:134
void DisplayLSTMOutput(const GenericVector< int > &labels, const GenericVector< int > &xcoords, int height, ScrollView *window)
Definition: lstmrecognizer.cpp:320
void LabelsViaSimpleText(const NetworkIO &output, GenericVector< int > *labels, GenericVector< int > *xcoords)
Definition: lstmrecognizer.cpp:443
bool IsRecoding() const
Definition: lstmrecognizer.h:79
void ScaleLayerLearningRate(const char *id, double factor)
Definition: plumbing.h:111
bool LoadCharsets(const TessdataManager *mgr)
Definition: lstmrecognizer.cpp:124
int32_t training_flags_
Definition: lstmrecognizer.h:283
virtual void ConvertToInt()
Definition: network.h:191
STRING DecodeLabels(const GenericVector< int > &labels)
Definition: lstmrecognizer.cpp:289
float learning_rate_
Definition: lstmrecognizer.h:292
bool Load(const char *lang, TessdataManager *mgr)
Definition: lstmrecognizer.cpp:69
LSTMRecognizer()
Definition: lstmrecognizer.cpp:49
const char * DecodeSingleLabel(int label)
Definition: lstmrecognizer.cpp:504
Definition: static_shape.h:38
RecodeBeamSearch * search_
Definition: lstmrecognizer.h:303
int NumOutputs() const
Definition: network.h:123
void LabelsViaReEncode(const NetworkIO &output, GenericVector< int > *labels, GenericVector< int > *xcoords)
Definition: lstmrecognizer.cpp:429
Definition: lstmrecognizer.h:47
Definition: imagedata.h:105
void set_seed(uint64_t seed)
Definition: helpers.h:46
int training_iteration() const
Definition: lstmrecognizer.h:61
LossType OutputLossType() const
Definition: lstmrecognizer.h:70
const UnicharCompress & GetRecoder() const
Definition: lstmrecognizer.h:141
Definition: networkscratch.h:36
Definition: unicharset.h:146
virtual StaticShape OutputShape(const StaticShape &input_shape) const
Definition: network.h:133
int32_t training_iteration_
Definition: lstmrecognizer.h:285
Definition: static_shape.h:30
Definition: recodebeam.h:179
bool LoadDictionary(const char *lang, TessdataManager *mgr)
Definition: lstmrecognizer.cpp:157
LossType loss_type() const
Definition: static_shape.h:50
Definition: serialis.h:77
CCUtil ccutil_
Definition: lstmrecognizer.h:273
Definition: baseapi.cpp:94
GenericVector< STRING > EnumerateLayers() const
Definition: lstmrecognizer.h:86
bool DeSerialize(const TessdataManager *mgr, TFile *fp)
Definition: lstmrecognizer.cpp:99
Dict * dict_
Definition: lstmrecognizer.h:301
float momentum_
Definition: lstmrecognizer.h:293
void DebugActivationRange(const NetworkIO &outputs, const char *label, int best_choice, int x_start, int x_end)
Definition: lstmrecognizer.cpp:374
bool TestFlag(NetworkFlags flag) const
Definition: network.h:144
double learning_rate() const
Definition: lstmrecognizer.h:67
float GetLayerLearningRate(const STRING &id) const
Definition: lstmrecognizer.h:101
int32_t null_char_
Definition: lstmrecognizer.h:290
float adam_beta_
Definition: lstmrecognizer.h:295
Definition: unicharcompress.h:128
Network * GetLayer(const char *id) const
Definition: plumbing.cpp:155
int sample_iteration() const
Definition: lstmrecognizer.h:64
void DisplayForward(const NetworkIO &inputs, const GenericVector< int > &labels, const GenericVector< int > &label_coords, const char *window_name, ScrollView **window)
Definition: lstmrecognizer.cpp:304
bool IsIntMode() const
Definition: lstmrecognizer.h:77
int32_t IntRand()
Definition: helpers.h:56
void ScaleLearningRate(double factor)
Definition: lstmrecognizer.h:112
TrainingFlags
Definition: lstmrecognizer.h:46
void DebugActivationPath(const NetworkIO &outputs, const GenericVector< int > &labels, const GenericVector< int > &xcoords)
Definition: lstmrecognizer.cpp:347
Definition: network.h:105
NetworkType type() const
Definition: network.h:112
Definition: tessdatamanager.h:126
const Dict * GetDict() const
Definition: lstmrecognizer.h:143
Definition: static_shape.h:32
float LayerLearningRate(const char *id) const
Definition: plumbing.h:105
bool IsTensorFlow() const
Definition: lstmrecognizer.h:83
~LSTMRecognizer()
Definition: lstmrecognizer.cpp:62
const UNICHARSET & GetUnicharset() const
Definition: lstmrecognizer.h:139
bool Serialize(const TessdataManager *mgr, TFile *fp) const
Definition: lstmrecognizer.cpp:80
Definition: pageres.h:169
int size() const
Definition: genericvector.h:71
void OutputStats(const NetworkIO &outputs, float *min_output, float *mean_output, float *sd)
Definition: lstmrecognizer.cpp:194
Network * network_
Definition: lstmrecognizer.h:270
UnicharCompress recoder_
Definition: lstmrecognizer.h:277
void RecognizeLine(const ImageData &image_data, bool invert, bool debug, double worst_dict_cert, const TBOX &line_box, PointerVector< WERD_RES > *words, int lstm_choice_mode=0)
Definition: lstmrecognizer.cpp:172
int NumInputs() const
Definition: lstmrecognizer.h:151
void ConvertToInt()
Definition: lstmrecognizer.h:131
int32_t sample_iteration_
Definition: lstmrecognizer.h:287
Definition: lstmrecognizer.h:48
Definition: lstmrecognizer.h:53
NetworkScratch scratch_space_
Definition: lstmrecognizer.h:299
Definition: networkio.h:39
int NumInputs() const
Definition: network.h:120
STRING network_str_
Definition: lstmrecognizer.h:280
int NumOutputs() const
Definition: lstmrecognizer.h:58
UNICHARSET unicharset
Definition: ccutil.h:68
void SetIteration(int iteration)
Definition: lstmrecognizer.h:147
Network * GetLayer(const STRING &id) const
Definition: lstmrecognizer.h:94
void SetRandomSeed()
Definition: lstmrecognizer.h:225
const char * DecodeLabel(const GenericVector< int > &labels, int start, int *end, int *decoded)
Definition: lstmrecognizer.cpp:462
Definition: pageres.h:141