Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
tesseract::HybridNeuralNetCharClassifier Class Reference

`#include <hybrid_neural_net_classifier.h>`

Inheritance diagram for tesseract::HybridNeuralNetCharClassifier:

List of all members.

## Public Member Functions

| HybridNeuralNetCharClassifier (CharSet *char_set, TuningParams *params, FeatureBase *feat_extract)
virtual | ~HybridNeuralNetCharClassifier ()
virtual bool | Train (CharSamp *char_samp, int ClassID)
virtual bool | SetLearnParam (char *var_name, float val)
void | SetNet (tesseract::NeuralNet *net)
virtual CharAltList * | Classify (CharSamp *char_samp)
virtual int | CharCost (CharSamp *char_samp)
Public Member Functions inherited from tesseract::CharClassifier
| CharClassifier (CharSet *char_set, TuningParams *params, FeatureBase *feat_extract)
virtual | ~CharClassifier ()
FeatureBase * | FeatureExtractor ()
bool | CaseSensitive () const
void | SetCaseSensitive (bool case_sensitive)

## Additional Inherited Members

Protected Attributes inherited from tesseract::CharClassifier
FeatureBase * | feat_extract_
CharSet * | char_set_
TuningParams * | params_
int ** | fold_sets_
int * | fold_set_len_
int | fold_set_cnt_
bool | init_
bool | case_sensitive_

## Detailed Description

Definition at line 41 of file hybrid_neural_net_classifier.h.

## Constructor & Destructor Documentation

tesseract::HybridNeuralNetCharClassifier::HybridNeuralNetCharClassifier | ( | CharSet * | char_set,
|  | TuningParams * | params,
|  | FeatureBase * | feat_extract
| ) |  |

Definition at line 39 of file hybrid_neural_net_classifier.cpp.

: CharClassifier(char_set, params, feat_extract) {
net_input_ = NULL;
net_output_ = NULL;
}

tesseract::HybridNeuralNetCharClassifier::~HybridNeuralNetCharClassifier | ( |  | ) |

virtual

Definition at line 48 of file hybrid_neural_net_classifier.cpp.

{
for (int net_idx = 0; net_idx < nets_.size(); net_idx++) {
if (nets_[net_idx] != NULL) {
delete nets_[net_idx];
}
}
nets_.clear();
if (net_input_ != NULL) {
delete []net_input_;
net_input_ = NULL;
}
if (net_output_ != NULL) {
delete []net_output_;
net_output_ = NULL;
}
}

## Member Function Documentation

int tesseract::HybridNeuralNetCharClassifier::CharCost | ( | CharSamp * | char_samp | ) |

virtual

Implements tesseract::CharClassifier.

Definition at line 177 of file hybrid_neural_net_classifier.cpp.

{
// it is by design that a character cost is equal to zero
// when no nets are present. This is the case during training.
if (RunNets(char_samp) == false) {
return 0;
}
return CubeUtils::Prob2Cost(1.0f - net_output_[0]);
}

CharAltList * tesseract::HybridNeuralNetCharClassifier::Classify | ( | CharSamp * | char_samp | ) |

virtual

Implements tesseract::CharClassifier.

Definition at line 189 of file hybrid_neural_net_classifier.cpp.

{
// run the needed nets
if (RunNets(char_samp) == false) {
return NULL;
}
int class_cnt = char_set_->ClassCount();
// create an altlist
CharAltList *alt_list = new CharAltList(char_set_, class_cnt);
if (alt_list == NULL) {
return NULL;
}
for (int out = 1; out < class_cnt; out++) {
int cost = CubeUtils::Prob2Cost(net_output_[out]);
alt_list->Insert(out, cost);
}
return alt_list;
}

bool tesseract::HybridNeuralNetCharClassifier::SetLearnParam | ( | char * | var_name,
|  | float | val
| ) |  |

virtual

Implements tesseract::CharClassifier.

Definition at line 77 of file hybrid_neural_net_classifier.cpp.

{
// TODO(ahmadab): implementation of parameter initializing.
return false;
}

void tesseract::HybridNeuralNetCharClassifier::SetNet | ( | tesseract::NeuralNet * | net | ) |

Definition at line 212 of file hybrid_neural_net_classifier.cpp.

{
}

bool tesseract::HybridNeuralNetCharClassifier::Train | ( | CharSamp * | char_samp,
|  | int | ClassID
| ) |  |

virtual

Implements tesseract::CharClassifier.

Definition at line 70 of file hybrid_neural_net_classifier.cpp.

{
return false;
}

The documentation for this class was generated from the following files:

- /mnt/data/src/tesseract-ocr/cube/hybrid_neural_net_classifier.h
- /mnt/data/src/tesseract-ocr/cube/hybrid_neural_net_classifier.cpp