#include <input.h>
|
| Input (const STRING &name, int ni, int no) |
|
| Input (const STRING &name, const StaticShape &shape) |
|
| ~Input () override=default |
|
STRING | spec () const override |
|
StaticShape | InputShape () const override |
|
StaticShape | OutputShape (const StaticShape &input_shape) const override |
|
bool | Serialize (TFile *fp) const override |
|
bool | DeSerialize (TFile *fp) override |
|
int | XScaleFactor () const override |
|
void | CacheXScaleFactor (int factor) override |
|
void | Forward (bool debug, const NetworkIO &input, const TransposedArray *input_transpose, NetworkScratch *scratch, NetworkIO *output) override |
|
bool | Backward (bool debug, const NetworkIO &fwd_deltas, NetworkScratch *scratch, NetworkIO *back_deltas) override |
|
| 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 |
|
const STRING & | name () 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 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 27 of file input.h.
◆ Input() [1/2]
tesseract::Input::Input |
( |
const STRING & |
name, |
|
|
int |
ni, |
|
|
int |
no |
|
) |
| |
◆ Input() [2/2]
Definition at line 32 of file input.cpp.
36 if (shape.height() == 1)
ni_ = shape.depth();
◆ ~Input()
tesseract::Input::~Input |
( |
| ) |
|
|
overridedefault |
◆ Backward()
◆ CacheXScaleFactor()
void tesseract::Input::CacheXScaleFactor |
( |
int |
factor | ) |
|
|
overridevirtual |
◆ DeSerialize()
bool tesseract::Input::DeSerialize |
( |
TFile * |
fp | ) |
|
|
overridevirtual |
◆ Forward()
◆ InputShape()
◆ 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 83 of file input.cpp.
87 int target_height = network->NumInputs();
89 Pix* pix = image_data.PreScale(target_height,
kMaxInputHeight, image_scale,
90 &width, &height,
nullptr);
92 tprintf(
"Bad pix from ImageData!\n");
95 if (width < min_width || height < min_width) {
96 tprintf(
"Image too small to scale!! (%dx%d vs min width of %d)\n", width,
◆ PreparePixInput()
Definition at line 111 of file input.cpp.
113 bool color = shape.depth() == 3;
114 Pix* var_pix = const_cast<Pix*>(pix);
115 int depth = pixGetDepth(var_pix);
116 Pix* normed_pix =
nullptr;
122 normed_pix = pixClone(var_pix);
124 normed_pix = pixConvertTo32(var_pix);
128 normed_pix = pixClone(var_pix);
130 normed_pix = pixConvertTo8(var_pix,
false);
132 int height = pixGetHeight(normed_pix);
133 int target_height = shape.height();
134 if (target_height == 1) target_height = shape.depth();
135 if (target_height != 0 && target_height != height) {
137 float im_factor = static_cast<float>(target_height) / height;
138 Pix* scaled_pix = pixScale(normed_pix, im_factor, im_factor);
139 pixDestroy(&normed_pix);
140 normed_pix = scaled_pix;
142 input->FromPix(shape, normed_pix, randomizer);
143 pixDestroy(&normed_pix);
◆ Serialize()
bool tesseract::Input::Serialize |
( |
TFile * |
fp | ) |
const |
|
overridevirtual |
◆ spec()
STRING tesseract::Input::spec |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ XScaleFactor()
int tesseract::Input::XScaleFactor |
( |
| ) |
const |
|
overridevirtual |
The documentation for this class was generated from the following files: