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

#include <fullyconnected.h>

Inheritance diagram for tesseract::FullyConnected:
Collaboration diagram for tesseract::FullyConnected:

Public Member Functions

 FullyConnected (const STRING &name, int ni, int no, NetworkType type)
 
virtual ~FullyConnected ()=default
 
StaticShape OutputShape (const StaticShape &input_shape) const override
 
STRING spec () const override
 
void ChangeType (NetworkType type)
 
void SetEnableTraining (TrainingState state) override
 
int InitWeights (float range, TRand *randomizer) override
 
int RemapOutputs (int old_no, const std::vector< int > &code_map) override
 
void ConvertToInt () override
 
void DebugWeights () override
 
bool Serialize (TFile *fp) const override
 
bool DeSerialize (TFile *fp) override
 
void Forward (bool debug, const NetworkIO &input, const TransposedArray *input_transpose, NetworkScratch *scratch, NetworkIO *output) override
 
void SetupForward (const NetworkIO &input, const TransposedArray *input_transpose)
 
void ForwardTimeStep (int t, double *output_line)
 
void ForwardTimeStep (const double *d_input, int t, double *output_line)
 
void ForwardTimeStep (const int8_t *i_input, int t, double *output_line)
 
bool Backward (bool debug, const NetworkIO &fwd_deltas, NetworkScratch *scratch, NetworkIO *back_deltas) override
 
void BackwardTimeStep (const NetworkIO &fwd_deltas, int t, double *curr_errors, TransposedArray *errors_t, double *backprop)
 
void FinishBackward (const TransposedArray &errors_t)
 
void Update (float learning_rate, float momentum, float adam_beta, int num_samples) override
 
void CountAlternators (const Network &other, double *same, double *changed) const override
 
- Public Member Functions inherited from tesseract::Network
 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
 
const STRING & name () const
 
bool TestFlag (NetworkFlags flag) const
 
virtual bool IsPlumbingType () const
 
virtual void SetNetworkFlags (uint32_t flags)
 
virtual void SetRandomizer (TRand *randomizer)
 
virtual bool SetupNeedsBackprop (bool needs_backprop)
 
virtual int XScaleFactor () const
 
virtual void CacheXScaleFactor (int factor)
 
void DisplayForward (const NetworkIO &matrix)
 
void DisplayBackward (const NetworkIO &matrix)
 

Protected Attributes

WeightMatrix weights_
 
TransposedArray source_t_
 
const TransposedArray * external_source_
 
NetworkIO acts_
 
bool int_mode_
 
- Protected Attributes inherited from tesseract::Network
NetworkType type_
 
TrainingState training_
 
bool needs_to_backprop_
 
int32_t network_flags_
 
int32_t ni_
 
int32_t no_
 
int32_t num_weights_
 
STRING name_
 
ScrollView * forward_win_
 
ScrollView * backward_win_
 
TRand * randomizer_
 

Additional Inherited Members

- Static Public Member Functions inherited from tesseract::Network
static Network * CreateFromFile (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 inherited from tesseract::Network
double Random (double range)
 
- Static Protected Attributes inherited from tesseract::Network
static char const *const kTypeNames [NT_COUNT]
 

Constructor & Destructor Documentation

◆ FullyConnected()

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

◆ ~FullyConnected()

virtual tesseract::FullyConnected::~FullyConnected ( )
virtualdefault

Member Function Documentation

◆ Backward()

bool tesseract::FullyConnected::Backward ( bool  debug,
const NetworkIO &  fwd_deltas,
NetworkScratch *  scratch,
NetworkIO *  back_deltas 
)
overridevirtual

Reimplemented from tesseract::Network.

◆ BackwardTimeStep()

void tesseract::FullyConnected::BackwardTimeStep ( const NetworkIO &  fwd_deltas,
int  t,
double *  curr_errors,
TransposedArray *  errors_t,
double *  backprop 
)

◆ ChangeType()

void tesseract::FullyConnected::ChangeType ( NetworkType  type)
inline

◆ ConvertToInt()

void tesseract::FullyConnected::ConvertToInt ( )
overridevirtual

Reimplemented from tesseract::Network.

◆ CountAlternators()

void tesseract::FullyConnected::CountAlternators ( const Network &  other,
double *  same,
double *  changed 
) const
overridevirtual

Reimplemented from tesseract::Network.

◆ DebugWeights()

void tesseract::FullyConnected::DebugWeights ( )
overridevirtual

Reimplemented from tesseract::Network.

◆ DeSerialize()

bool tesseract::FullyConnected::DeSerialize ( TFile *  fp)
overridevirtual

Reimplemented from tesseract::Network.

◆ FinishBackward()

void tesseract::FullyConnected::FinishBackward ( const TransposedArray &  errors_t)

◆ Forward()

void tesseract::FullyConnected::Forward ( bool  debug,
const NetworkIO &  input,
const TransposedArray *  input_transpose,
NetworkScratch *  scratch,
NetworkIO *  output 
)
overridevirtual

Reimplemented from tesseract::Network.

◆ ForwardTimeStep() [1/3]

void tesseract::FullyConnected::ForwardTimeStep ( int  t,
double *  output_line 
)

◆ ForwardTimeStep() [2/3]

void tesseract::FullyConnected::ForwardTimeStep ( const double *  d_input,
int  t,
double *  output_line 
)

◆ ForwardTimeStep() [3/3]

void tesseract::FullyConnected::ForwardTimeStep ( const int8_t *  i_input,
int  t,
double *  output_line 
)

◆ InitWeights()

int tesseract::FullyConnected::InitWeights ( float  range,
TRand *  randomizer 
)
overridevirtual

Reimplemented from tesseract::Network.

◆ OutputShape()

StaticShape tesseract::FullyConnected::OutputShape ( const StaticShape &  input_shape) const
overridevirtual

Reimplemented from tesseract::Network.

◆ RemapOutputs()

int tesseract::FullyConnected::RemapOutputs ( int  old_no,
const std::vector< int > &  code_map 
)
overridevirtual

Reimplemented from tesseract::Network.

◆ Serialize()

bool tesseract::FullyConnected::Serialize ( TFile *  fp) const
overridevirtual

Reimplemented from tesseract::Network.

◆ SetEnableTraining()

void tesseract::FullyConnected::SetEnableTraining ( TrainingState  state)
overridevirtual

Reimplemented from tesseract::Network.

◆ SetupForward()

void tesseract::FullyConnected::SetupForward ( const NetworkIO &  input,
const TransposedArray *  input_transpose 
)

◆ spec()

STRING tesseract::FullyConnected::spec ( ) const
inlineoverridevirtual

Reimplemented from tesseract::Network.

◆ Update()

void tesseract::FullyConnected::Update ( float  learning_rate,
float  momentum,
float  adam_beta,
int  num_samples 
)
overridevirtual

Reimplemented from tesseract::Network.

Member Data Documentation

◆ acts_

NetworkIO tesseract::FullyConnected::acts_
protected

◆ external_source_

const TransposedArray* tesseract::FullyConnected::external_source_
protected

◆ int_mode_

bool tesseract::FullyConnected::int_mode_
protected

◆ source_t_

TransposedArray tesseract::FullyConnected::source_t_
protected

◆ weights_

WeightMatrix tesseract::FullyConnected::weights_
protected

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