#include <input.h>
|
| Input (const STRING &name, int ni, int no) |
|
| Input (const STRING &name, const StaticShape &shape) |
|
virtual | ~Input () |
|
virtual STRING | spec () const |
|
virtual StaticShape | InputShape () const |
|
virtual StaticShape | OutputShape (const StaticShape &input_shape) const |
|
virtual bool | Serialize (TFile *fp) const |
|
virtual bool | DeSerialize (TFile *fp) |
|
virtual int | XScaleFactor () const |
|
virtual void | CacheXScaleFactor (int factor) |
|
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) |
|
| Network () |
|
| Network (NetworkType type, const STRING &name, int ni, int no) |
|
virtual | ~Network () |
|
NetworkType | type () const |
|
bool | IsTraining () const |
|
bool | needs_to_backprop () const |
|
int | num_weights () const |
|
int | NumInputs () const |
|
int | NumOutputs () const |
|
const STRING & | name () const |
|
bool | TestFlag (NetworkFlags flag) const |
|
virtual bool | IsPlumbingType () const |
|
virtual void | SetEnableTraining (TrainingState state) |
|
virtual void | SetNetworkFlags (uinT32 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 void | DebugWeights () |
|
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 |
|
void | DisplayForward (const NetworkIO &matrix) |
|
void | DisplayBackward (const NetworkIO &matrix) |
|
|
static Pix * | PrepareLSTMInputs (const ImageData &image_data, const Network *network, int min_width, TRand *randomizer, float *image_scale) |
|
static void | PreparePixInput (const StaticShape &shape, const Pix *pix, TRand *randomizer, NetworkIO *input) |
|
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) |
|
Definition at line 28 of file input.h.
◆ Input() [1/2]
tesseract::Input::Input |
( |
const STRING & |
name, |
|
|
int |
ni, |
|
|
int |
no |
|
) |
| |
◆ Input() [2/2]
Definition at line 33 of file input.cpp.
37 if (shape.height() == 1)
ni_ = shape.depth();
◆ ~Input()
tesseract::Input::~Input |
( |
| ) |
|
|
virtual |
◆ Backward()
◆ CacheXScaleFactor()
void tesseract::Input::CacheXScaleFactor |
( |
int |
factor | ) |
|
|
virtual |
◆ DeSerialize()
bool tesseract::Input::DeSerialize |
( |
TFile * |
fp | ) |
|
|
virtual |
◆ Forward()
◆ InputShape()
virtual StaticShape tesseract::Input::InputShape |
( |
| ) |
const |
|
inlinevirtual |
◆ OutputShape()
◆ PrepareLSTMInputs()
Pix * tesseract::Input::PrepareLSTMInputs |
( |
const ImageData & |
image_data, |
|
|
const Network * |
network, |
|
|
int |
min_width, |
|
|
TRand * |
randomizer, |
|
|
float * |
image_scale |
|
) |
| |
|
static |
Definition at line 89 of file input.cpp.
93 int target_height = network->NumInputs();
95 Pix* pix = image_data.PreScale(target_height,
kMaxInputHeight, image_scale,
96 &width, &height,
nullptr);
98 tprintf(
"Bad pix from ImageData!\n");
101 if (width <= min_width || height < min_width) {
102 tprintf(
"Image too small to scale!! (%dx%d vs min width of %d)\n", width,
const int kMaxInputHeight
◆ PreparePixInput()
Definition at line 117 of file input.cpp.
119 bool color = shape.depth() == 3;
120 Pix* var_pix =
const_cast<Pix*
>(pix);
121 int depth = pixGetDepth(var_pix);
122 Pix* normed_pix =
nullptr;
128 normed_pix = pixClone(var_pix);
130 normed_pix = pixConvertTo32(var_pix);
134 normed_pix = pixClone(var_pix);
136 normed_pix = pixConvertTo8(var_pix,
false);
138 int height = pixGetHeight(normed_pix);
139 int target_height = shape.height();
140 if (target_height == 1) target_height = shape.depth();
141 if (target_height == 0) target_height = height;
142 float im_factor =
static_cast<float>(target_height) / height;
143 if (im_factor != 1.0f) {
145 Pix* scaled_pix = pixScale(normed_pix, im_factor, im_factor);
146 pixDestroy(&normed_pix);
147 normed_pix = scaled_pix;
149 input->FromPix(shape, normed_pix, randomizer);
150 pixDestroy(&normed_pix);
◆ Serialize()
bool tesseract::Input::Serialize |
( |
TFile * |
fp | ) |
const |
|
virtual |
Reimplemented from tesseract::Network.
Definition at line 44 of file input.cpp.
46 if (fp->FWrite(&shape_,
sizeof(shape_), 1) != 1)
return false;
virtual bool Serialize(TFile *fp) const
◆ spec()
virtual STRING tesseract::Input::spec |
( |
| ) |
const |
|
inlinevirtual |
Reimplemented from tesseract::Network.
Definition at line 34 of file input.h.
void add_str_int(const char *str, int number)
virtual STRING spec() const
◆ XScaleFactor()
int tesseract::Input::XScaleFactor |
( |
| ) |
const |
|
virtual |
The documentation for this class was generated from the following files:
- /home/stweil/src/github/tesseract-ocr/tesseract/lstm/input.h
- /home/stweil/src/github/tesseract-ocr/tesseract/lstm/input.cpp