#include <networkbuilder.h>
|
static bool | InitNetwork (int num_outputs, STRING network_spec, int append_index, int net_flags, float weight_range, TRand *randomizer, Network **network) |
|
Definition at line 36 of file networkbuilder.h.
◆ NetworkBuilder()
tesseract::NetworkBuilder::NetworkBuilder |
( |
int |
num_softmax_outputs | ) |
|
|
inlineexplicit |
Definition at line 38 of file networkbuilder.h.
39 : num_softmax_outputs_(num_softmax_outputs) {}
◆ BuildFromString()
Network * tesseract::NetworkBuilder::BuildFromString |
( |
const StaticShape & |
input_shape, |
|
|
char ** |
str |
|
) |
| |
Definition at line 86 of file networkbuilder.cpp.
91 return ParseSeries(input_shape,
nullptr, str);
93 if (input_shape.depth() == 0) {
95 return ParseInput(str);
99 return ParseParallel(input_shape, str);
101 return ParseR(input_shape, str);
103 return ParseS(input_shape, str);
105 return ParseC(input_shape, str);
107 return ParseM(input_shape, str);
109 return ParseLSTM(input_shape, str);
111 return ParseFullyConnected(input_shape, str);
113 return ParseOutput(input_shape, str);
115 tprintf(
"Invalid network spec:%s\n", *str);
DLLSYM void tprintf(const char *format,...)
◆ InitNetwork()
bool tesseract::NetworkBuilder::InitNetwork |
( |
int |
num_outputs, |
|
|
STRING |
network_spec, |
|
|
int |
append_index, |
|
|
int |
net_flags, |
|
|
float |
weight_range, |
|
|
TRand * |
randomizer, |
|
|
Network ** |
network |
|
) |
| |
|
static |
Definition at line 45 of file networkbuilder.cpp.
50 Series* bottom_series =
nullptr;
51 StaticShape input_shape;
52 if (append_index >= 0) {
55 Series* series =
static_cast<Series*
>(*network);
56 Series* top_series =
nullptr;
57 series->SplitAt(append_index, &bottom_series, &top_series);
58 if (bottom_series ==
nullptr || top_series ==
nullptr) {
59 tprintf(
"Yikes! Splitting current network failed!!\n");
62 input_shape = bottom_series->OutputShape(input_shape);
65 char* str_ptr = &network_spec[0];
66 *network = builder.BuildFromString(input_shape, &str_ptr);
67 if (*network ==
nullptr)
return false;
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)
DLLSYM void tprintf(const char *format,...)
The documentation for this class was generated from the following files: