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

#include <network.h>

Inheritance diagram for tesseract::Network:
Collaboration diagram for tesseract::Network:

Public Member Functions

 Network ()
 
 Network (NetworkType type, const STRING &name, int ni, int no)
 
virtual ~Network ()=default
 
NetworkType type () const
 
bool IsTraining () const
 
bool needs_to_backprop () const
 
int num_weights () const
 
int NumInputs () const
 
int NumOutputs () const
 
virtual StaticShape InputShape () const
 
virtual StaticShape OutputShape (const StaticShape &input_shape) const
 
const STRINGname () const
 
virtual STRING spec () const
 
bool TestFlag (NetworkFlags flag) const
 
virtual bool IsPlumbingType () const
 
virtual void SetEnableTraining (TrainingState state)
 
virtual void SetNetworkFlags (uint32_t flags)
 
virtual int InitWeights (float range, TRand *randomizer)
 
virtual int RemapOutputs (int old_no, const std::vector< int > &code_map)
 
virtual void ConvertToInt ()
 
virtual void SetRandomizer (TRand *randomizer)
 
virtual bool SetupNeedsBackprop (bool needs_backprop)
 
virtual int XScaleFactor () const
 
virtual void CacheXScaleFactor (int factor)
 
virtual void DebugWeights ()
 
virtual bool Serialize (TFile *fp) const
 
virtual bool DeSerialize (TFile *fp)
 
virtual void Update (float learning_rate, float momentum, float adam_beta, int num_samples)
 
virtual void CountAlternators (const Network &other, double *same, double *changed) const
 
virtual void Forward (bool debug, const NetworkIO &input, const TransposedArray *input_transpose, NetworkScratch *scratch, NetworkIO *output)
 
virtual bool Backward (bool debug, const NetworkIO &fwd_deltas, NetworkScratch *scratch, NetworkIO *back_deltas)
 
void DisplayForward (const NetworkIO &matrix)
 
void DisplayBackward (const NetworkIO &matrix)
 

Static Public Member Functions

static NetworkCreateFromFile (TFile *fp)
 
static void ClearWindow (bool tess_coords, const char *window_name, int width, int height, ScrollView **window)
 
static int DisplayImage (Pix *pix, ScrollView *window)
 

Protected Member Functions

double Random (double range)
 

Protected Attributes

NetworkType type_
 
TrainingState training_
 
bool needs_to_backprop_
 
int32_t network_flags_
 
int32_t ni_
 
int32_t no_
 
int32_t num_weights_
 
STRING name_
 
ScrollViewforward_win_
 
ScrollViewbackward_win_
 
TRandrandomizer_
 

Static Protected Attributes

static char const *const kTypeNames [NT_COUNT]
 

Constructor & Destructor Documentation

◆ Network() [1/2]

tesseract::Network::Network ( )

◆ Network() [2/2]

tesseract::Network::Network ( NetworkType  type,
const STRING name,
int  ni,
int  no 
)

◆ ~Network()

virtual tesseract::Network::~Network ( )
virtualdefault

Member Function Documentation

◆ Backward()

virtual bool tesseract::Network::Backward ( bool  debug,
const NetworkIO fwd_deltas,
NetworkScratch scratch,
NetworkIO back_deltas 
)
inlinevirtual

◆ CacheXScaleFactor()

virtual void tesseract::Network::CacheXScaleFactor ( int  factor)
inlinevirtual

◆ ClearWindow()

void tesseract::Network::ClearWindow ( bool  tess_coords,
const char *  window_name,
int  width,
int  height,
ScrollView **  window 
)
static

◆ ConvertToInt()

virtual void tesseract::Network::ConvertToInt ( )
inlinevirtual

◆ CountAlternators()

virtual void tesseract::Network::CountAlternators ( const Network other,
double *  same,
double *  changed 
) const
inlinevirtual

◆ CreateFromFile()

Network * tesseract::Network::CreateFromFile ( TFile fp)
static

◆ DebugWeights()

virtual void tesseract::Network::DebugWeights ( )
inlinevirtual

◆ DeSerialize()

bool tesseract::Network::DeSerialize ( TFile fp)
virtual

◆ DisplayBackward()

void tesseract::Network::DisplayBackward ( const NetworkIO matrix)

◆ DisplayForward()

void tesseract::Network::DisplayForward ( const NetworkIO matrix)

◆ DisplayImage()

int tesseract::Network::DisplayImage ( Pix *  pix,
ScrollView window 
)
static

◆ Forward()

virtual void tesseract::Network::Forward ( bool  debug,
const NetworkIO input,
const TransposedArray input_transpose,
NetworkScratch scratch,
NetworkIO output 
)
inlinevirtual

◆ InitWeights()

int tesseract::Network::InitWeights ( float  range,
TRand randomizer 
)
virtual

◆ InputShape()

virtual StaticShape tesseract::Network::InputShape ( ) const
inlinevirtual

Reimplemented in tesseract::Input, and tesseract::Plumbing.

◆ IsPlumbingType()

virtual bool tesseract::Network::IsPlumbingType ( ) const
inlinevirtual

Reimplemented in tesseract::Plumbing.

◆ IsTraining()

bool tesseract::Network::IsTraining ( ) const
inline

◆ name()

const STRING& tesseract::Network::name ( ) const
inline

◆ needs_to_backprop()

bool tesseract::Network::needs_to_backprop ( ) const
inline

◆ num_weights()

int tesseract::Network::num_weights ( ) const
inline

◆ NumInputs()

int tesseract::Network::NumInputs ( ) const
inline

◆ NumOutputs()

int tesseract::Network::NumOutputs ( ) const
inline

◆ OutputShape()

virtual StaticShape tesseract::Network::OutputShape ( const StaticShape input_shape) const
inlinevirtual

◆ Random()

double tesseract::Network::Random ( double  range)
protected

◆ RemapOutputs()

virtual int tesseract::Network::RemapOutputs ( int  old_no,
const std::vector< int > &  code_map 
)
inlinevirtual

◆ Serialize()

bool tesseract::Network::Serialize ( TFile fp) const
virtual

◆ SetEnableTraining()

void tesseract::Network::SetEnableTraining ( TrainingState  state)
virtual

◆ SetNetworkFlags()

void tesseract::Network::SetNetworkFlags ( uint32_t  flags)
virtual

Reimplemented in tesseract::Plumbing.

◆ SetRandomizer()

void tesseract::Network::SetRandomizer ( TRand randomizer)
virtual

Reimplemented in tesseract::Plumbing.

◆ SetupNeedsBackprop()

bool tesseract::Network::SetupNeedsBackprop ( bool  needs_backprop)
virtual

Reimplemented in tesseract::Plumbing, and tesseract::Series.

◆ spec()

◆ TestFlag()

bool tesseract::Network::TestFlag ( NetworkFlags  flag) const
inline

◆ type()

NetworkType tesseract::Network::type ( ) const
inline

◆ Update()

virtual void tesseract::Network::Update ( float  learning_rate,
float  momentum,
float  adam_beta,
int  num_samples 
)
inlinevirtual

◆ XScaleFactor()

virtual int tesseract::Network::XScaleFactor ( ) const
inlinevirtual

Member Data Documentation

◆ backward_win_

ScrollView* tesseract::Network::backward_win_
protected

◆ forward_win_

ScrollView* tesseract::Network::forward_win_
protected

◆ kTypeNames

char const *const tesseract::Network::kTypeNames
staticprotected
Initial value:
= {
"Invalid", "Input",
"Convolve", "Maxpool",
"Parallel", "Replicated",
"ParBidiLSTM", "DepParUDLSTM",
"Par2dLSTM", "Series",
"Reconfig", "RTLReversed",
"TTBReversed", "XYTranspose",
"LSTM", "SummLSTM",
"Logistic", "LinLogistic",
"LinTanh", "Tanh",
"Relu", "Linear",
"Softmax", "SoftmaxNoCTC",
"LSTMSoftmax", "LSTMBinarySoftmax",
"TensorFlow",
}

◆ name_

STRING tesseract::Network::name_
protected

◆ needs_to_backprop_

bool tesseract::Network::needs_to_backprop_
protected

◆ network_flags_

int32_t tesseract::Network::network_flags_
protected

◆ ni_

int32_t tesseract::Network::ni_
protected

◆ no_

int32_t tesseract::Network::no_
protected

◆ num_weights_

int32_t tesseract::Network::num_weights_
protected

◆ randomizer_

TRand* tesseract::Network::randomizer_
protected

◆ training_

TrainingState tesseract::Network::training_
protected

◆ type_

NetworkType tesseract::Network::type_
protected

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