#include <networkbuilder.h>
|
static bool | InitNetwork (int num_outputs, const char *network_spec, int append_index, int net_flags, float weight_range, TRand *randomizer, Network **network) |
|
Definition at line 35 of file networkbuilder.h.
◆ NetworkBuilder()
tesseract::NetworkBuilder::NetworkBuilder |
( |
int |
num_softmax_outputs | ) |
|
|
inlineexplicit |
Definition at line 37 of file networkbuilder.h.
37 : num_softmax_outputs_(num_softmax_outputs) {}
◆ BuildFromString()
Network * tesseract::NetworkBuilder::BuildFromString |
( |
const StaticShape & |
input_shape, |
|
|
const char ** |
str |
|
) |
| |
Definition at line 88 of file networkbuilder.cpp.
92 return ParseSeries(input_shape,
nullptr, str);
94 if (input_shape.depth() == 0) {
96 return ParseInput(str);
100 return ParseParallel(input_shape, str);
102 return ParseR(input_shape, str);
104 return ParseS(input_shape, str);
106 return ParseC(input_shape, str);
108 return ParseM(input_shape, str);
110 return ParseLSTM(input_shape, str);
112 return ParseFullyConnected(input_shape, str);
114 return ParseOutput(input_shape, str);
116 tprintf(
"Invalid network spec:%s\n", *str);
void tprintf(const char *format,...)
◆ InitNetwork()
bool tesseract::NetworkBuilder::InitNetwork |
( |
int |
num_outputs, |
|
|
const char * |
network_spec, |
|
|
int |
append_index, |
|
|
int |
net_flags, |
|
|
float |
weight_range, |
|
|
TRand * |
randomizer, |
|
|
Network ** |
network |
|
) |
| |
|
static |
Definition at line 45 of file networkbuilder.cpp.
49 Series *bottom_series =
nullptr;
50 StaticShape input_shape;
51 if (append_index >= 0) {
54 auto *series =
static_cast<Series *
>(*network);
55 Series *top_series =
nullptr;
56 series->SplitAt(append_index, &bottom_series, &top_series);
57 if (bottom_series ==
nullptr || top_series ==
nullptr) {
58 tprintf(
"Yikes! Splitting current network failed!!\n");
61 input_shape = bottom_series->OutputShape(input_shape);
64 *network = builder.BuildFromString(input_shape, &network_spec);
65 if (*network ==
nullptr) {
68 (*network)->SetNetworkFlags(net_flags);
69 (*network)->InitWeights(weight_range, randomizer);
70 (*network)->SetupNeedsBackprop(
false);
71 if (bottom_series !=
nullptr) {
72 bottom_series->AppendSeries(*network);
73 *network = bottom_series;
75 (*network)->CacheXScaleFactor((*network)->XScaleFactor());
NetworkBuilder(int num_softmax_outputs)
The documentation for this class was generated from the following files: