19#ifndef TESSERACT_LSTM_CTC_H_
20#define TESSERACT_LSTM_CTC_H_
30class TESS_COMMON_TRAINING_API
CTC {
52 static bool ComputeCTCTargets(
const std::vector<int> &truth_labels,
int null_char,
62 bool ComputeLabelLimits();
68 void ComputeWidthsAndMeans(std::vector<float> *half_widths, std::vector<int> *means)
const;
71 float CalculateBiasFraction();
88 bool NeededNull(
int index)
const;
91 static double ClippedExp(
double x) {
92 if (
x < -kMaxExpArg_) {
93 return exp(-kMaxExpArg_);
95 if (
x > kMaxExpArg_) {
96 return exp(kMaxExpArg_);
102 static const float kMinProb_;
104 static const double kMaxExpArg_;
106 static const double kMinTotalTimeProb_;
108 static const double kMinTotalFinalProb_;
111 const std::vector<int> &labels_;
113 GENERIC_2D_ARRAY<float> outputs_;
123 std::vector<int> min_labels_;
124 std::vector<int> max_labels_;
GENERIC_2D_ARRAY< float > * mutable_float_array()
static void NormalizeProbs(NetworkIO *probs)