Tesseract  3.02
tesseract::ConvNetCharClassifier Class Reference

#include <conv_net_classifier.h>

Inheritance diagram for tesseract::ConvNetCharClassifier:
tesseract::CharClassifier

List of all members.

Public Member Functions

 ConvNetCharClassifier (CharSet *char_set, TuningParams *params, FeatureBase *feat_extract)
virtual ~ConvNetCharClassifier ()
virtual bool Train (CharSamp *char_samp, int ClassID)
virtual bool SetLearnParam (char *var_name, float val)
void SetNet (tesseract::NeuralNet *net)
virtual CharAltListClassify (CharSamp *char_samp)
virtual int CharCost (CharSamp *char_samp)

Detailed Description

Definition at line 48 of file conv_net_classifier.h.


Constructor & Destructor Documentation

tesseract::ConvNetCharClassifier::ConvNetCharClassifier ( CharSet char_set,
TuningParams params,
FeatureBase feat_extract 
)

Definition at line 38 of file conv_net_classifier.cpp.

    : CharClassifier(char_set, params, feat_extract) {
  char_net_ = NULL;
  net_input_ = NULL;
  net_output_ = NULL;
}
tesseract::ConvNetCharClassifier::~ConvNetCharClassifier ( ) [virtual]

Definition at line 47 of file conv_net_classifier.cpp.

                                              {
  if (char_net_ != NULL) {
    delete char_net_;
    char_net_ = NULL;
  }

  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::ConvNetCharClassifier::CharCost ( CharSamp char_samp) [virtual]

Implements tesseract::CharClassifier.

Definition at line 177 of file conv_net_classifier.cpp.

                                                       {
  if (RunNets(char_samp) == false) {
    return 0;
  }
  return CubeUtils::Prob2Cost(1.0f - net_output_[0]);
}
CharAltList * tesseract::ConvNetCharClassifier::Classify ( CharSamp char_samp) [virtual]

Implements tesseract::CharClassifier.

Definition at line 186 of file conv_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) {
    fprintf(stderr, "Cube WARNING (ConvNetCharClassifier::Classify): "
            "returning emtpy CharAltList\n");
    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::ConvNetCharClassifier::SetLearnParam ( char *  var_name,
float  val 
) [virtual]

Implements tesseract::CharClassifier.

Definition at line 74 of file conv_net_classifier.cpp.

                                                                   {
  // TODO(ahmadab): implementation of parameter initializing.
  return false;
}
void tesseract::ConvNetCharClassifier::SetNet ( tesseract::NeuralNet net)

Definition at line 211 of file conv_net_classifier.cpp.

                                                               {
  if (char_net_ != NULL) {
    delete char_net_;
    char_net_ = NULL;
  }
  char_net_ = char_net;
}
bool tesseract::ConvNetCharClassifier::Train ( CharSamp char_samp,
int  ClassID 
) [virtual]

Implements tesseract::CharClassifier.

Definition at line 67 of file conv_net_classifier.cpp.

                                                                  {
  return false;
}

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