tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
tesseract::NetworkIO Class Reference

#include <networkio.h>

Collaboration diagram for tesseract::NetworkIO:

Public Member Functions

 NetworkIO ()
 
void Resize (const NetworkIO &src, int num_features)
 
void Resize2d (bool int_mode, int width, int num_features)
 
void ResizeFloat (const NetworkIO &src, int num_features)
 
void ResizeToMap (bool int_mode, const StrideMap &stride_map, int num_features)
 
void ResizeScaled (const NetworkIO &src, int x_scale, int y_scale, int num_features)
 
void ResizeXTo1 (const NetworkIO &src, int num_features)
 
void Zero ()
 
void ZeroInvalidElements ()
 
void FromPix (const StaticShape &shape, const Pix *pix, TRand *randomizer)
 
void FromPixes (const StaticShape &shape, const std::vector< const Pix *> &pixes, TRand *randomizer)
 
void Copy2DImage (int batch, Pix *pix, float black, float contrast, TRand *randomizer)
 
void Copy1DGreyImage (int batch, Pix *pix, float black, float contrast, TRand *randomizer)
 
void SetPixel (int t, int f, int pixel, float black, float contrast)
 
Pix * ToPix () const
 
void Print (int num) const
 
int Width () const
 
int NumFeatures () const
 
float * f (int t)
 
const float * f (int t) const
 
const int8_t * i (int t) const
 
bool int_mode () const
 
void set_int_mode (bool is_quantized)
 
const StrideMapstride_map () const
 
void set_stride_map (const StrideMap &map)
 
const GENERIC_2D_ARRAY< float > & float_array () const
 
GENERIC_2D_ARRAY< float > * mutable_float_array ()
 
void CopyTimeStepFrom (int dest_t, const NetworkIO &src, int src_t)
 
void CopyTimeStepGeneral (int dest_t, int dest_offset, int num_features, const NetworkIO &src, int src_t, int src_offset)
 
void ZeroTimeStep (int t)
 
void ZeroTimeStepGeneral (int t, int offset, int num_features)
 
void Randomize (int t, int offset, int num_features, TRand *randomizer)
 
int BestChoiceOverRange (int t_start, int t_end, int not_this, int null_ch, float *rating, float *certainty) const
 
void ScoresOverRange (int t_start, int t_end, int choice, int null_ch, float *rating, float *certainty) const
 
int BestLabel (int t, float *score) const
 
int BestLabel (int t, int not_this, int not_that, float *score) const
 
int PositionOfBestMatch (const GenericVector< int > &labels, int start, int end) const
 
double ScoreOfLabels (const GenericVector< int > &labels, int start) const
 
void SetActivations (int t, int label, float ok_score)
 
void EnsureBestLabel (int t, int label)
 
bool AnySuspiciousTruth (float confidence_thr) const
 
void ReadTimeStep (int t, double *output) const
 
void AddTimeStep (int t, double *inout) const
 
void AddTimeStepPart (int t, int offset, int num_features, float *inout) const
 
void WriteTimeStep (int t, const double *input)
 
void WriteTimeStepPart (int t, int offset, int num_features, const double *input)
 
void MaxpoolTimeStep (int dest_t, const NetworkIO &src, int src_t, int *max_line)
 
void MaxpoolBackward (const NetworkIO &fwd, const GENERIC_2D_ARRAY< int > &maxes)
 
float MinOfMaxes () const
 
float Max () const
 
void CombineOutputs (const NetworkIO &base_output, const NetworkIO &combiner_output)
 
void ComputeCombinerDeltas (const NetworkIO &fwd_deltas, const NetworkIO &base_output)
 
void CopyAll (const NetworkIO &src)
 
void AddAllToFloat (const NetworkIO &src)
 
void SubtractAllFromFloat (const NetworkIO &src)
 
void CopyWithNormalization (const NetworkIO &src, const NetworkIO &scale)
 
void ScaleFloatBy (float factor)
 
void CopyWithYReversal (const NetworkIO &src)
 
void CopyWithXReversal (const NetworkIO &src)
 
void CopyWithXYTranspose (const NetworkIO &src)
 
int CopyPacking (const NetworkIO &src, int feature_offset)
 
void CopyUnpacking (const NetworkIO &src, int feature_offset, int num_features)
 
void Transpose (TransposedArray *dest) const
 
void ClipVector (int t, float range)
 
template<class Func >
void FuncMultiply (const NetworkIO &v_io, int t, double *product)
 
template<class Func >
void FuncMultiply3 (int u_t, const NetworkIO &v_io, int v_t, const double *w, double *product) const
 
template<class Func >
void FuncMultiply3Add (const NetworkIO &v_io, int t, const double *w, double *product) const
 
template<class Func1 , class Func2 >
void Func2Multiply3 (const NetworkIO &v_io, int t, const double *w, double *product) const
 

Static Public Member Functions

static float ProbToCertainty (float prob)
 

Static Private Member Functions

static int GetPadding (int num_features)
 

Private Attributes

GENERIC_2D_ARRAY< float > f_
 
GENERIC_2D_ARRAY< int8_t > i_
 
bool int_mode_
 
StrideMap stride_map_
 

Static Private Attributes

static IntSimdMatrixmultiplier_ = nullptr
 

Constructor & Destructor Documentation

◆ NetworkIO()

tesseract::NetworkIO::NetworkIO ( )
inline

Member Function Documentation

◆ AddAllToFloat()

void tesseract::NetworkIO::AddAllToFloat ( const NetworkIO src)

◆ AddTimeStep()

void tesseract::NetworkIO::AddTimeStep ( int  t,
double *  inout 
) const

◆ AddTimeStepPart()

void tesseract::NetworkIO::AddTimeStepPart ( int  t,
int  offset,
int  num_features,
float *  inout 
) const

◆ AnySuspiciousTruth()

bool tesseract::NetworkIO::AnySuspiciousTruth ( float  confidence_thr) const

◆ BestChoiceOverRange()

int tesseract::NetworkIO::BestChoiceOverRange ( int  t_start,
int  t_end,
int  not_this,
int  null_ch,
float *  rating,
float *  certainty 
) const

◆ BestLabel() [1/2]

int tesseract::NetworkIO::BestLabel ( int  t,
float *  score 
) const
inline

◆ BestLabel() [2/2]

int tesseract::NetworkIO::BestLabel ( int  t,
int  not_this,
int  not_that,
float *  score 
) const

◆ ClipVector()

void tesseract::NetworkIO::ClipVector ( int  t,
float  range 
)

◆ CombineOutputs()

void tesseract::NetworkIO::CombineOutputs ( const NetworkIO base_output,
const NetworkIO combiner_output 
)

◆ ComputeCombinerDeltas()

void tesseract::NetworkIO::ComputeCombinerDeltas ( const NetworkIO fwd_deltas,
const NetworkIO base_output 
)

◆ Copy1DGreyImage()

void tesseract::NetworkIO::Copy1DGreyImage ( int  batch,
Pix *  pix,
float  black,
float  contrast,
TRand randomizer 
)

◆ Copy2DImage()

void tesseract::NetworkIO::Copy2DImage ( int  batch,
Pix *  pix,
float  black,
float  contrast,
TRand randomizer 
)

◆ CopyAll()

void tesseract::NetworkIO::CopyAll ( const NetworkIO src)

◆ CopyPacking()

int tesseract::NetworkIO::CopyPacking ( const NetworkIO src,
int  feature_offset 
)

◆ CopyTimeStepFrom()

void tesseract::NetworkIO::CopyTimeStepFrom ( int  dest_t,
const NetworkIO src,
int  src_t 
)

◆ CopyTimeStepGeneral()

void tesseract::NetworkIO::CopyTimeStepGeneral ( int  dest_t,
int  dest_offset,
int  num_features,
const NetworkIO src,
int  src_t,
int  src_offset 
)

◆ CopyUnpacking()

void tesseract::NetworkIO::CopyUnpacking ( const NetworkIO src,
int  feature_offset,
int  num_features 
)

◆ CopyWithNormalization()

void tesseract::NetworkIO::CopyWithNormalization ( const NetworkIO src,
const NetworkIO scale 
)

◆ CopyWithXReversal()

void tesseract::NetworkIO::CopyWithXReversal ( const NetworkIO src)

◆ CopyWithXYTranspose()

void tesseract::NetworkIO::CopyWithXYTranspose ( const NetworkIO src)

◆ CopyWithYReversal()

void tesseract::NetworkIO::CopyWithYReversal ( const NetworkIO src)

◆ EnsureBestLabel()

void tesseract::NetworkIO::EnsureBestLabel ( int  t,
int  label 
)

◆ f() [1/2]

float* tesseract::NetworkIO::f ( int  t)
inline

◆ f() [2/2]

const float* tesseract::NetworkIO::f ( int  t) const
inline

◆ float_array()

const GENERIC_2D_ARRAY<float>& tesseract::NetworkIO::float_array ( ) const
inline

◆ FromPix()

void tesseract::NetworkIO::FromPix ( const StaticShape shape,
const Pix *  pix,
TRand randomizer 
)

◆ FromPixes()

void tesseract::NetworkIO::FromPixes ( const StaticShape shape,
const std::vector< const Pix *> &  pixes,
TRand randomizer 
)

◆ Func2Multiply3()

template<class Func1 , class Func2 >
void tesseract::NetworkIO::Func2Multiply3 ( const NetworkIO v_io,
int  t,
const double *  w,
double *  product 
) const
inline

◆ FuncMultiply()

template<class Func >
void tesseract::NetworkIO::FuncMultiply ( const NetworkIO v_io,
int  t,
double *  product 
)
inline

◆ FuncMultiply3()

template<class Func >
void tesseract::NetworkIO::FuncMultiply3 ( int  u_t,
const NetworkIO v_io,
int  v_t,
const double *  w,
double *  product 
) const
inline

◆ FuncMultiply3Add()

template<class Func >
void tesseract::NetworkIO::FuncMultiply3Add ( const NetworkIO v_io,
int  t,
const double *  w,
double *  product 
) const
inline

◆ GetPadding()

int tesseract::NetworkIO::GetPadding ( int  num_features)
staticprivate

◆ i()

const int8_t* tesseract::NetworkIO::i ( int  t) const
inline

◆ int_mode()

bool tesseract::NetworkIO::int_mode ( ) const
inline

◆ Max()

float tesseract::NetworkIO::Max ( ) const
inline

◆ MaxpoolBackward()

void tesseract::NetworkIO::MaxpoolBackward ( const NetworkIO fwd,
const GENERIC_2D_ARRAY< int > &  maxes 
)

◆ MaxpoolTimeStep()

void tesseract::NetworkIO::MaxpoolTimeStep ( int  dest_t,
const NetworkIO src,
int  src_t,
int *  max_line 
)

◆ MinOfMaxes()

float tesseract::NetworkIO::MinOfMaxes ( ) const

◆ mutable_float_array()

GENERIC_2D_ARRAY<float>* tesseract::NetworkIO::mutable_float_array ( )
inline

◆ NumFeatures()

int tesseract::NetworkIO::NumFeatures ( ) const
inline

◆ PositionOfBestMatch()

int tesseract::NetworkIO::PositionOfBestMatch ( const GenericVector< int > &  labels,
int  start,
int  end 
) const

◆ Print()

void tesseract::NetworkIO::Print ( int  num) const

◆ ProbToCertainty()

float tesseract::NetworkIO::ProbToCertainty ( float  prob)
static

◆ Randomize()

void tesseract::NetworkIO::Randomize ( int  t,
int  offset,
int  num_features,
TRand randomizer 
)

◆ ReadTimeStep()

void tesseract::NetworkIO::ReadTimeStep ( int  t,
double *  output 
) const

◆ Resize()

void tesseract::NetworkIO::Resize ( const NetworkIO src,
int  num_features 
)
inline

◆ Resize2d()

void tesseract::NetworkIO::Resize2d ( bool  int_mode,
int  width,
int  num_features 
)

◆ ResizeFloat()

void tesseract::NetworkIO::ResizeFloat ( const NetworkIO src,
int  num_features 
)
inline

◆ ResizeScaled()

void tesseract::NetworkIO::ResizeScaled ( const NetworkIO src,
int  x_scale,
int  y_scale,
int  num_features 
)

◆ ResizeToMap()

void tesseract::NetworkIO::ResizeToMap ( bool  int_mode,
const StrideMap stride_map,
int  num_features 
)

◆ ResizeXTo1()

void tesseract::NetworkIO::ResizeXTo1 ( const NetworkIO src,
int  num_features 
)

◆ ScaleFloatBy()

void tesseract::NetworkIO::ScaleFloatBy ( float  factor)
inline

◆ ScoreOfLabels()

double tesseract::NetworkIO::ScoreOfLabels ( const GenericVector< int > &  labels,
int  start 
) const

◆ ScoresOverRange()

void tesseract::NetworkIO::ScoresOverRange ( int  t_start,
int  t_end,
int  choice,
int  null_ch,
float *  rating,
float *  certainty 
) const

◆ set_int_mode()

void tesseract::NetworkIO::set_int_mode ( bool  is_quantized)
inline

◆ set_stride_map()

void tesseract::NetworkIO::set_stride_map ( const StrideMap map)
inline

◆ SetActivations()

void tesseract::NetworkIO::SetActivations ( int  t,
int  label,
float  ok_score 
)

◆ SetPixel()

void tesseract::NetworkIO::SetPixel ( int  t,
int  f,
int  pixel,
float  black,
float  contrast 
)

◆ stride_map()

const StrideMap& tesseract::NetworkIO::stride_map ( ) const
inline

◆ SubtractAllFromFloat()

void tesseract::NetworkIO::SubtractAllFromFloat ( const NetworkIO src)

◆ ToPix()

Pix * tesseract::NetworkIO::ToPix ( ) const

◆ Transpose()

void tesseract::NetworkIO::Transpose ( TransposedArray dest) const

◆ Width()

int tesseract::NetworkIO::Width ( ) const
inline

◆ WriteTimeStep()

void tesseract::NetworkIO::WriteTimeStep ( int  t,
const double *  input 
)

◆ WriteTimeStepPart()

void tesseract::NetworkIO::WriteTimeStepPart ( int  t,
int  offset,
int  num_features,
const double *  input 
)

◆ Zero()

void tesseract::NetworkIO::Zero ( )

◆ ZeroInvalidElements()

void tesseract::NetworkIO::ZeroInvalidElements ( )

◆ ZeroTimeStep()

void tesseract::NetworkIO::ZeroTimeStep ( int  t)
inline

◆ ZeroTimeStepGeneral()

void tesseract::NetworkIO::ZeroTimeStepGeneral ( int  t,
int  offset,
int  num_features 
)

Member Data Documentation

◆ f_

GENERIC_2D_ARRAY<float> tesseract::NetworkIO::f_
private

◆ i_

GENERIC_2D_ARRAY<int8_t> tesseract::NetworkIO::i_
private

◆ int_mode_

bool tesseract::NetworkIO::int_mode_
private

◆ multiplier_

IntSimdMatrix * tesseract::NetworkIO::multiplier_ = nullptr
staticprivate

◆ stride_map_

StrideMap tesseract::NetworkIO::stride_map_
private

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