mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 20:59:36 +08:00
Support build with Tensorflow
It expects include files in /usr/include/tensorflow. * Add configure option --with-tensorflow (disabled by default) * Fix data type tensorflow::int64 * Remove "third_party/" in include statements * Add dummy implementations for Backward and DebugWeights in TFNetwork * Add files generated with protoc from tfnetwork.proto (so the Tensorflow sources are not needed for the build) * Update Makefiles Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
3f74da5da9
commit
4382ab1a34
@ -195,6 +195,15 @@ if test "$enable_opencl" = "yes"; then
|
||||
])
|
||||
fi
|
||||
|
||||
# Check whether to build with support for Tensorflow.
|
||||
AC_MSG_CHECKING([--with-tensorflow])
|
||||
AC_ARG_WITH([tensorflow],
|
||||
AS_HELP_STRING([--with-tensorflow],
|
||||
[support Tensorflow @<:@default=check@:>@]),
|
||||
[], [with_tensorflow=check])
|
||||
AC_MSG_RESULT([$with_tensorflow])
|
||||
AM_CONDITIONAL([TENSORFLOW], [test "$with_tensorflow" != "no"])
|
||||
|
||||
# https://lists.apple.com/archives/unix-porting/2009/Jan/msg00026.html
|
||||
m4_define([MY_CHECK_FRAMEWORK],
|
||||
[AC_CACHE_CHECK([if -framework $1 works],[my_cv_framework_$1],
|
||||
|
@ -98,3 +98,8 @@ endif
|
||||
if ADD_RT
|
||||
tesseract_LDADD += -lrt
|
||||
endif
|
||||
|
||||
if TENSORFLOW
|
||||
tesseract_LDADD += -lprotobuf
|
||||
tesseract_LDADD += -ltensorflow_cc
|
||||
endif
|
||||
|
@ -10,6 +10,11 @@ AM_CPPFLAGS += \
|
||||
|
||||
AM_CXXFLAGS = $(OPENMP_CXXFLAGS)
|
||||
|
||||
if TENSORFLOW
|
||||
AM_CPPFLAGS += -DINCLUDE_TENSORFLOW
|
||||
AM_CPPFLAGS += -I/usr/include/tensorflow
|
||||
endif
|
||||
|
||||
if !NO_TESSDATA_PREFIX
|
||||
AM_CXXFLAGS += -DTESSDATA_PREFIX=@datadir@
|
||||
endif
|
||||
@ -37,3 +42,7 @@ libtesseract_lstm_la_SOURCES = \
|
||||
networkbuilder.cpp network.cpp networkio.cpp \
|
||||
parallel.cpp plumbing.cpp recodebeam.cpp reconfig.cpp reversed.cpp \
|
||||
series.cpp stridemap.cpp tfnetwork.cpp weightmatrix.cpp
|
||||
|
||||
if TENSORFLOW
|
||||
libtesseract_lstm_la_SOURCES += tfnetwork.pb.cc
|
||||
endif
|
||||
|
@ -3,7 +3,6 @@
|
||||
// Description: Encapsulation of an entire tensorflow graph as a
|
||||
// Tesseract Network.
|
||||
// Author: Ray Smith
|
||||
// Created: Fri Feb 26 09:35:29 PST 2016
|
||||
//
|
||||
// (C) Copyright 2016, Google Inc.
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -90,14 +89,14 @@ void TFNetwork::Forward(bool debug, const NetworkIO& input,
|
||||
if (!model_proto_.image_widths().empty()) {
|
||||
TensorShape size_shape{1};
|
||||
Tensor width_tensor(tensorflow::DT_INT64, size_shape);
|
||||
auto eigen_wtensor = width_tensor.flat<int64>();
|
||||
auto eigen_wtensor = width_tensor.flat<tensorflow::int64>();
|
||||
*eigen_wtensor.data() = stride_map.Size(FD_WIDTH);
|
||||
tf_inputs.emplace_back(model_proto_.image_widths(), width_tensor);
|
||||
}
|
||||
if (!model_proto_.image_heights().empty()) {
|
||||
TensorShape size_shape{1};
|
||||
Tensor height_tensor(tensorflow::DT_INT64, size_shape);
|
||||
auto eigen_htensor = height_tensor.flat<int64>();
|
||||
auto eigen_htensor = height_tensor.flat<tensorflow::int64>();
|
||||
*eigen_htensor.data() = stride_map.Size(FD_HEIGHT);
|
||||
tf_inputs.emplace_back(model_proto_.image_heights(), height_tensor);
|
||||
}
|
||||
|
@ -27,9 +27,9 @@
|
||||
|
||||
#include "network.h"
|
||||
#include "static_shape.h"
|
||||
#include "tfnetwork.proto.h"
|
||||
#include "third_party/tensorflow/core/framework/graph.pb.h"
|
||||
#include "third_party/tensorflow/core/public/session.h"
|
||||
#include "tfnetwork.pb.h"
|
||||
#include "tensorflow/core/framework/graph.pb.h"
|
||||
#include "tensorflow/core/public/session.h"
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
@ -69,6 +69,18 @@ class TFNetwork : public Network {
|
||||
NetworkScratch* scratch, NetworkIO* output) override;
|
||||
|
||||
private:
|
||||
// Runs backward propagation of errors on the deltas line.
|
||||
// See Network for a detailed discussion of the arguments.
|
||||
bool Backward(bool debug, const NetworkIO& fwd_deltas,
|
||||
NetworkScratch* scratch,
|
||||
NetworkIO* back_deltas) override {
|
||||
tprintf("Must override Network::DebugWeights for type %d\n", type_);
|
||||
}
|
||||
|
||||
void DebugWeights() override {
|
||||
tprintf("Must override Network::DebugWeights for type %d\n", type_);
|
||||
}
|
||||
|
||||
int InitFromProto();
|
||||
|
||||
// The original network definition for reference.
|
||||
|
932
src/lstm/tfnetwork.pb.cc
Normal file
932
src/lstm/tfnetwork.pb.cc
Normal file
@ -0,0 +1,932 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: tfnetwork.proto
|
||||
|
||||
#include "tfnetwork.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
#include <google/protobuf/stubs/port.h>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/wire_format_lite_inl.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// This is a temporary google only hack
|
||||
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
|
||||
#include "third_party/protobuf/version.h"
|
||||
#endif
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto {
|
||||
extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto ::google::protobuf::internal::SCCInfo<3> scc_info_GraphDef;
|
||||
} // namespace protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto
|
||||
namespace tesseract {
|
||||
class TFNetworkModelDefaultTypeInternal {
|
||||
public:
|
||||
::google::protobuf::internal::ExplicitlyConstructed<TFNetworkModel>
|
||||
_instance;
|
||||
} _TFNetworkModel_default_instance_;
|
||||
} // namespace tesseract
|
||||
namespace protobuf_tfnetwork_2eproto {
|
||||
static void InitDefaultsTFNetworkModel() {
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
|
||||
{
|
||||
void* ptr = &::tesseract::_TFNetworkModel_default_instance_;
|
||||
new (ptr) ::tesseract::TFNetworkModel();
|
||||
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
|
||||
}
|
||||
::tesseract::TFNetworkModel::InitAsDefaultInstance();
|
||||
}
|
||||
|
||||
::google::protobuf::internal::SCCInfo<1> scc_info_TFNetworkModel =
|
||||
{{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTFNetworkModel}, {
|
||||
&protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto::scc_info_GraphDef.base,}};
|
||||
|
||||
void InitDefaults() {
|
||||
::google::protobuf::internal::InitSCC(&scc_info_TFNetworkModel.base);
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata file_level_metadata[1];
|
||||
|
||||
const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, graph_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, global_step_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, spec_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, depth_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, x_size_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, y_size_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, batch_size_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, num_classes_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, using_ctc_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, image_input_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, image_widths_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, image_heights_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tesseract::TFNetworkModel, output_layer_),
|
||||
};
|
||||
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, sizeof(::tesseract::TFNetworkModel)},
|
||||
};
|
||||
|
||||
static ::google::protobuf::Message const * const file_default_instances[] = {
|
||||
reinterpret_cast<const ::google::protobuf::Message*>(&::tesseract::_TFNetworkModel_default_instance_),
|
||||
};
|
||||
|
||||
void protobuf_AssignDescriptors() {
|
||||
AddDescriptors();
|
||||
AssignDescriptors(
|
||||
"tfnetwork.proto", schemas, file_default_instances, TableStruct::offsets,
|
||||
file_level_metadata, NULL, NULL);
|
||||
}
|
||||
|
||||
void protobuf_AssignDescriptorsOnce() {
|
||||
static ::google::protobuf::internal::once_flag once;
|
||||
::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
|
||||
}
|
||||
|
||||
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
|
||||
void protobuf_RegisterTypes(const ::std::string&) {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
|
||||
}
|
||||
|
||||
void AddDescriptorsImpl() {
|
||||
InitDefaults();
|
||||
static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
|
||||
"\n\017tfnetwork.proto\022\ttesseract\032%tensorflow"
|
||||
"/core/framework/graph.proto\"\233\002\n\016TFNetwor"
|
||||
"kModel\022#\n\005graph\030\001 \001(\0132\024.tensorflow.Graph"
|
||||
"Def\022\023\n\013global_step\030\002 \001(\003\022\014\n\004spec\030\003 \001(\t\022\r"
|
||||
"\n\005depth\030\004 \001(\005\022\016\n\006x_size\030\005 \001(\005\022\016\n\006y_size\030"
|
||||
"\006 \001(\005\022\022\n\nbatch_size\030\010 \001(\005\022\023\n\013num_classes"
|
||||
"\030\t \001(\005\022\021\n\tusing_ctc\030\n \001(\010\022\023\n\013image_input"
|
||||
"\030\013 \001(\t\022\024\n\014image_widths\030\014 \001(\t\022\025\n\rimage_he"
|
||||
"ights\030\r \001(\t\022\024\n\014output_layer\030\016 \001(\tb\006proto"
|
||||
"3"
|
||||
};
|
||||
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
||||
descriptor, 361);
|
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
||||
"tfnetwork.proto", &protobuf_RegisterTypes);
|
||||
::protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto::AddDescriptors();
|
||||
}
|
||||
|
||||
void AddDescriptors() {
|
||||
static ::google::protobuf::internal::once_flag once;
|
||||
::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
|
||||
}
|
||||
// Force AddDescriptors() to be called at dynamic initialization time.
|
||||
struct StaticDescriptorInitializer {
|
||||
StaticDescriptorInitializer() {
|
||||
AddDescriptors();
|
||||
}
|
||||
} static_descriptor_initializer;
|
||||
} // namespace protobuf_tfnetwork_2eproto
|
||||
namespace tesseract {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
void TFNetworkModel::InitAsDefaultInstance() {
|
||||
::tesseract::_TFNetworkModel_default_instance_._instance.get_mutable()->graph_ = const_cast< ::tensorflow::GraphDef*>(
|
||||
::tensorflow::GraphDef::internal_default_instance());
|
||||
}
|
||||
void TFNetworkModel::clear_graph() {
|
||||
if (GetArenaNoVirtual() == NULL && graph_ != NULL) {
|
||||
delete graph_;
|
||||
}
|
||||
graph_ = NULL;
|
||||
}
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1900
|
||||
const int TFNetworkModel::kGraphFieldNumber;
|
||||
const int TFNetworkModel::kGlobalStepFieldNumber;
|
||||
const int TFNetworkModel::kSpecFieldNumber;
|
||||
const int TFNetworkModel::kDepthFieldNumber;
|
||||
const int TFNetworkModel::kXSizeFieldNumber;
|
||||
const int TFNetworkModel::kYSizeFieldNumber;
|
||||
const int TFNetworkModel::kBatchSizeFieldNumber;
|
||||
const int TFNetworkModel::kNumClassesFieldNumber;
|
||||
const int TFNetworkModel::kUsingCtcFieldNumber;
|
||||
const int TFNetworkModel::kImageInputFieldNumber;
|
||||
const int TFNetworkModel::kImageWidthsFieldNumber;
|
||||
const int TFNetworkModel::kImageHeightsFieldNumber;
|
||||
const int TFNetworkModel::kOutputLayerFieldNumber;
|
||||
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
|
||||
|
||||
TFNetworkModel::TFNetworkModel()
|
||||
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
|
||||
::google::protobuf::internal::InitSCC(
|
||||
&protobuf_tfnetwork_2eproto::scc_info_TFNetworkModel.base);
|
||||
SharedCtor();
|
||||
// @@protoc_insertion_point(constructor:tesseract.TFNetworkModel)
|
||||
}
|
||||
TFNetworkModel::TFNetworkModel(const TFNetworkModel& from)
|
||||
: ::google::protobuf::Message(),
|
||||
_internal_metadata_(NULL) {
|
||||
_internal_metadata_.MergeFrom(from._internal_metadata_);
|
||||
spec_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
if (from.spec().size() > 0) {
|
||||
spec_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.spec_);
|
||||
}
|
||||
image_input_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
if (from.image_input().size() > 0) {
|
||||
image_input_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_input_);
|
||||
}
|
||||
image_widths_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
if (from.image_widths().size() > 0) {
|
||||
image_widths_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_widths_);
|
||||
}
|
||||
image_heights_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
if (from.image_heights().size() > 0) {
|
||||
image_heights_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_heights_);
|
||||
}
|
||||
output_layer_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
if (from.output_layer().size() > 0) {
|
||||
output_layer_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_layer_);
|
||||
}
|
||||
if (from.has_graph()) {
|
||||
graph_ = new ::tensorflow::GraphDef(*from.graph_);
|
||||
} else {
|
||||
graph_ = NULL;
|
||||
}
|
||||
::memcpy(&global_step_, &from.global_step_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&using_ctc_) -
|
||||
reinterpret_cast<char*>(&global_step_)) + sizeof(using_ctc_));
|
||||
// @@protoc_insertion_point(copy_constructor:tesseract.TFNetworkModel)
|
||||
}
|
||||
|
||||
void TFNetworkModel::SharedCtor() {
|
||||
spec_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_input_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_widths_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_heights_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
output_layer_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
::memset(&graph_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&using_ctc_) -
|
||||
reinterpret_cast<char*>(&graph_)) + sizeof(using_ctc_));
|
||||
}
|
||||
|
||||
TFNetworkModel::~TFNetworkModel() {
|
||||
// @@protoc_insertion_point(destructor:tesseract.TFNetworkModel)
|
||||
SharedDtor();
|
||||
}
|
||||
|
||||
void TFNetworkModel::SharedDtor() {
|
||||
spec_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_input_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_widths_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_heights_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
output_layer_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
if (this != internal_default_instance()) delete graph_;
|
||||
}
|
||||
|
||||
void TFNetworkModel::SetCachedSize(int size) const {
|
||||
_cached_size_.Set(size);
|
||||
}
|
||||
const ::google::protobuf::Descriptor* TFNetworkModel::descriptor() {
|
||||
::protobuf_tfnetwork_2eproto::protobuf_AssignDescriptorsOnce();
|
||||
return ::protobuf_tfnetwork_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
|
||||
}
|
||||
|
||||
const TFNetworkModel& TFNetworkModel::default_instance() {
|
||||
::google::protobuf::internal::InitSCC(&protobuf_tfnetwork_2eproto::scc_info_TFNetworkModel.base);
|
||||
return *internal_default_instance();
|
||||
}
|
||||
|
||||
|
||||
void TFNetworkModel::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:tesseract.TFNetworkModel)
|
||||
::google::protobuf::uint32 cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
spec_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_input_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_widths_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
image_heights_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
output_layer_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
if (GetArenaNoVirtual() == NULL && graph_ != NULL) {
|
||||
delete graph_;
|
||||
}
|
||||
graph_ = NULL;
|
||||
::memset(&global_step_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&using_ctc_) -
|
||||
reinterpret_cast<char*>(&global_step_)) + sizeof(using_ctc_));
|
||||
_internal_metadata_.Clear();
|
||||
}
|
||||
|
||||
bool TFNetworkModel::MergePartialFromCodedStream(
|
||||
::google::protobuf::io::CodedInputStream* input) {
|
||||
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
|
||||
::google::protobuf::uint32 tag;
|
||||
// @@protoc_insertion_point(parse_start:tesseract.TFNetworkModel)
|
||||
for (;;) {
|
||||
::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
|
||||
tag = p.first;
|
||||
if (!p.second) goto handle_unusual;
|
||||
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
|
||||
// .tensorflow.GraphDef graph = 1;
|
||||
case 1: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
|
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
|
||||
input, mutable_graph()));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// int64 global_step = 2;
|
||||
case 2: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
|
||||
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
|
||||
input, &global_step_)));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// string spec = 3;
|
||||
case 3: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
|
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
|
||||
input, this->mutable_spec()));
|
||||
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->spec().data(), static_cast<int>(this->spec().length()),
|
||||
::google::protobuf::internal::WireFormatLite::PARSE,
|
||||
"tesseract.TFNetworkModel.spec"));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// int32 depth = 4;
|
||||
case 4: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
|
||||
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
|
||||
input, &depth_)));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// int32 x_size = 5;
|
||||
case 5: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) {
|
||||
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
|
||||
input, &x_size_)));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// int32 y_size = 6;
|
||||
case 6: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) {
|
||||
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
|
||||
input, &y_size_)));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// int32 batch_size = 8;
|
||||
case 8: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(64u /* 64 & 0xFF */)) {
|
||||
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
|
||||
input, &batch_size_)));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// int32 num_classes = 9;
|
||||
case 9: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(72u /* 72 & 0xFF */)) {
|
||||
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
|
||||
input, &num_classes_)));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// bool using_ctc = 10;
|
||||
case 10: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(80u /* 80 & 0xFF */)) {
|
||||
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
|
||||
input, &using_ctc_)));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// string image_input = 11;
|
||||
case 11: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(90u /* 90 & 0xFF */)) {
|
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
|
||||
input, this->mutable_image_input()));
|
||||
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_input().data(), static_cast<int>(this->image_input().length()),
|
||||
::google::protobuf::internal::WireFormatLite::PARSE,
|
||||
"tesseract.TFNetworkModel.image_input"));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// string image_widths = 12;
|
||||
case 12: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(98u /* 98 & 0xFF */)) {
|
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
|
||||
input, this->mutable_image_widths()));
|
||||
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_widths().data(), static_cast<int>(this->image_widths().length()),
|
||||
::google::protobuf::internal::WireFormatLite::PARSE,
|
||||
"tesseract.TFNetworkModel.image_widths"));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// string image_heights = 13;
|
||||
case 13: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(106u /* 106 & 0xFF */)) {
|
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
|
||||
input, this->mutable_image_heights()));
|
||||
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_heights().data(), static_cast<int>(this->image_heights().length()),
|
||||
::google::protobuf::internal::WireFormatLite::PARSE,
|
||||
"tesseract.TFNetworkModel.image_heights"));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// string output_layer = 14;
|
||||
case 14: {
|
||||
if (static_cast< ::google::protobuf::uint8>(tag) ==
|
||||
static_cast< ::google::protobuf::uint8>(114u /* 114 & 0xFF */)) {
|
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
|
||||
input, this->mutable_output_layer()));
|
||||
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->output_layer().data(), static_cast<int>(this->output_layer().length()),
|
||||
::google::protobuf::internal::WireFormatLite::PARSE,
|
||||
"tesseract.TFNetworkModel.output_layer"));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
handle_unusual:
|
||||
if (tag == 0) {
|
||||
goto success;
|
||||
}
|
||||
DO_(::google::protobuf::internal::WireFormat::SkipField(
|
||||
input, tag, _internal_metadata_.mutable_unknown_fields()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
success:
|
||||
// @@protoc_insertion_point(parse_success:tesseract.TFNetworkModel)
|
||||
return true;
|
||||
failure:
|
||||
// @@protoc_insertion_point(parse_failure:tesseract.TFNetworkModel)
|
||||
return false;
|
||||
#undef DO_
|
||||
}
|
||||
|
||||
void TFNetworkModel::SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const {
|
||||
// @@protoc_insertion_point(serialize_start:tesseract.TFNetworkModel)
|
||||
::google::protobuf::uint32 cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// .tensorflow.GraphDef graph = 1;
|
||||
if (this->has_graph()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
|
||||
1, this->_internal_graph(), output);
|
||||
}
|
||||
|
||||
// int64 global_step = 2;
|
||||
if (this->global_step() != 0) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->global_step(), output);
|
||||
}
|
||||
|
||||
// string spec = 3;
|
||||
if (this->spec().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->spec().data(), static_cast<int>(this->spec().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.spec");
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
|
||||
3, this->spec(), output);
|
||||
}
|
||||
|
||||
// int32 depth = 4;
|
||||
if (this->depth() != 0) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->depth(), output);
|
||||
}
|
||||
|
||||
// int32 x_size = 5;
|
||||
if (this->x_size() != 0) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->x_size(), output);
|
||||
}
|
||||
|
||||
// int32 y_size = 6;
|
||||
if (this->y_size() != 0) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->y_size(), output);
|
||||
}
|
||||
|
||||
// int32 batch_size = 8;
|
||||
if (this->batch_size() != 0) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteInt32(8, this->batch_size(), output);
|
||||
}
|
||||
|
||||
// int32 num_classes = 9;
|
||||
if (this->num_classes() != 0) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteInt32(9, this->num_classes(), output);
|
||||
}
|
||||
|
||||
// bool using_ctc = 10;
|
||||
if (this->using_ctc() != 0) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteBool(10, this->using_ctc(), output);
|
||||
}
|
||||
|
||||
// string image_input = 11;
|
||||
if (this->image_input().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_input().data(), static_cast<int>(this->image_input().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.image_input");
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
|
||||
11, this->image_input(), output);
|
||||
}
|
||||
|
||||
// string image_widths = 12;
|
||||
if (this->image_widths().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_widths().data(), static_cast<int>(this->image_widths().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.image_widths");
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
|
||||
12, this->image_widths(), output);
|
||||
}
|
||||
|
||||
// string image_heights = 13;
|
||||
if (this->image_heights().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_heights().data(), static_cast<int>(this->image_heights().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.image_heights");
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
|
||||
13, this->image_heights(), output);
|
||||
}
|
||||
|
||||
// string output_layer = 14;
|
||||
if (this->output_layer().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->output_layer().data(), static_cast<int>(this->output_layer().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.output_layer");
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
|
||||
14, this->output_layer(), output);
|
||||
}
|
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
|
||||
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
|
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_end:tesseract.TFNetworkModel)
|
||||
}
|
||||
|
||||
::google::protobuf::uint8* TFNetworkModel::InternalSerializeWithCachedSizesToArray(
|
||||
bool deterministic, ::google::protobuf::uint8* target) const {
|
||||
(void)deterministic; // Unused
|
||||
// @@protoc_insertion_point(serialize_to_array_start:tesseract.TFNetworkModel)
|
||||
::google::protobuf::uint32 cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// .tensorflow.GraphDef graph = 1;
|
||||
if (this->has_graph()) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::
|
||||
InternalWriteMessageToArray(
|
||||
1, this->_internal_graph(), deterministic, target);
|
||||
}
|
||||
|
||||
// int64 global_step = 2;
|
||||
if (this->global_step() != 0) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(2, this->global_step(), target);
|
||||
}
|
||||
|
||||
// string spec = 3;
|
||||
if (this->spec().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->spec().data(), static_cast<int>(this->spec().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.spec");
|
||||
target =
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
|
||||
3, this->spec(), target);
|
||||
}
|
||||
|
||||
// int32 depth = 4;
|
||||
if (this->depth() != 0) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->depth(), target);
|
||||
}
|
||||
|
||||
// int32 x_size = 5;
|
||||
if (this->x_size() != 0) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(5, this->x_size(), target);
|
||||
}
|
||||
|
||||
// int32 y_size = 6;
|
||||
if (this->y_size() != 0) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(6, this->y_size(), target);
|
||||
}
|
||||
|
||||
// int32 batch_size = 8;
|
||||
if (this->batch_size() != 0) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(8, this->batch_size(), target);
|
||||
}
|
||||
|
||||
// int32 num_classes = 9;
|
||||
if (this->num_classes() != 0) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(9, this->num_classes(), target);
|
||||
}
|
||||
|
||||
// bool using_ctc = 10;
|
||||
if (this->using_ctc() != 0) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->using_ctc(), target);
|
||||
}
|
||||
|
||||
// string image_input = 11;
|
||||
if (this->image_input().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_input().data(), static_cast<int>(this->image_input().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.image_input");
|
||||
target =
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
|
||||
11, this->image_input(), target);
|
||||
}
|
||||
|
||||
// string image_widths = 12;
|
||||
if (this->image_widths().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_widths().data(), static_cast<int>(this->image_widths().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.image_widths");
|
||||
target =
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
|
||||
12, this->image_widths(), target);
|
||||
}
|
||||
|
||||
// string image_heights = 13;
|
||||
if (this->image_heights().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->image_heights().data(), static_cast<int>(this->image_heights().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.image_heights");
|
||||
target =
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
|
||||
13, this->image_heights(), target);
|
||||
}
|
||||
|
||||
// string output_layer = 14;
|
||||
if (this->output_layer().size() > 0) {
|
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->output_layer().data(), static_cast<int>(this->output_layer().length()),
|
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE,
|
||||
"tesseract.TFNetworkModel.output_layer");
|
||||
target =
|
||||
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
|
||||
14, this->output_layer(), target);
|
||||
}
|
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
|
||||
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
|
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:tesseract.TFNetworkModel)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t TFNetworkModel::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:tesseract.TFNetworkModel)
|
||||
size_t total_size = 0;
|
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
|
||||
total_size +=
|
||||
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
|
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
|
||||
}
|
||||
// string spec = 3;
|
||||
if (this->spec().size() > 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::StringSize(
|
||||
this->spec());
|
||||
}
|
||||
|
||||
// string image_input = 11;
|
||||
if (this->image_input().size() > 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::StringSize(
|
||||
this->image_input());
|
||||
}
|
||||
|
||||
// string image_widths = 12;
|
||||
if (this->image_widths().size() > 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::StringSize(
|
||||
this->image_widths());
|
||||
}
|
||||
|
||||
// string image_heights = 13;
|
||||
if (this->image_heights().size() > 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::StringSize(
|
||||
this->image_heights());
|
||||
}
|
||||
|
||||
// string output_layer = 14;
|
||||
if (this->output_layer().size() > 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::StringSize(
|
||||
this->output_layer());
|
||||
}
|
||||
|
||||
// .tensorflow.GraphDef graph = 1;
|
||||
if (this->has_graph()) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::MessageSize(
|
||||
*graph_);
|
||||
}
|
||||
|
||||
// int64 global_step = 2;
|
||||
if (this->global_step() != 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::Int64Size(
|
||||
this->global_step());
|
||||
}
|
||||
|
||||
// int32 depth = 4;
|
||||
if (this->depth() != 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::Int32Size(
|
||||
this->depth());
|
||||
}
|
||||
|
||||
// int32 x_size = 5;
|
||||
if (this->x_size() != 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::Int32Size(
|
||||
this->x_size());
|
||||
}
|
||||
|
||||
// int32 y_size = 6;
|
||||
if (this->y_size() != 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::Int32Size(
|
||||
this->y_size());
|
||||
}
|
||||
|
||||
// int32 batch_size = 8;
|
||||
if (this->batch_size() != 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::Int32Size(
|
||||
this->batch_size());
|
||||
}
|
||||
|
||||
// int32 num_classes = 9;
|
||||
if (this->num_classes() != 0) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::Int32Size(
|
||||
this->num_classes());
|
||||
}
|
||||
|
||||
// bool using_ctc = 10;
|
||||
if (this->using_ctc() != 0) {
|
||||
total_size += 1 + 1;
|
||||
}
|
||||
|
||||
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
|
||||
SetCachedSize(cached_size);
|
||||
return total_size;
|
||||
}
|
||||
|
||||
void TFNetworkModel::MergeFrom(const ::google::protobuf::Message& from) {
|
||||
// @@protoc_insertion_point(generalized_merge_from_start:tesseract.TFNetworkModel)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
const TFNetworkModel* source =
|
||||
::google::protobuf::internal::DynamicCastToGenerated<const TFNetworkModel>(
|
||||
&from);
|
||||
if (source == NULL) {
|
||||
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tesseract.TFNetworkModel)
|
||||
::google::protobuf::internal::ReflectionOps::Merge(from, this);
|
||||
} else {
|
||||
// @@protoc_insertion_point(generalized_merge_from_cast_success:tesseract.TFNetworkModel)
|
||||
MergeFrom(*source);
|
||||
}
|
||||
}
|
||||
|
||||
void TFNetworkModel::MergeFrom(const TFNetworkModel& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:tesseract.TFNetworkModel)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
_internal_metadata_.MergeFrom(from._internal_metadata_);
|
||||
::google::protobuf::uint32 cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from.spec().size() > 0) {
|
||||
|
||||
spec_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.spec_);
|
||||
}
|
||||
if (from.image_input().size() > 0) {
|
||||
|
||||
image_input_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_input_);
|
||||
}
|
||||
if (from.image_widths().size() > 0) {
|
||||
|
||||
image_widths_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_widths_);
|
||||
}
|
||||
if (from.image_heights().size() > 0) {
|
||||
|
||||
image_heights_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_heights_);
|
||||
}
|
||||
if (from.output_layer().size() > 0) {
|
||||
|
||||
output_layer_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_layer_);
|
||||
}
|
||||
if (from.has_graph()) {
|
||||
mutable_graph()->::tensorflow::GraphDef::MergeFrom(from.graph());
|
||||
}
|
||||
if (from.global_step() != 0) {
|
||||
set_global_step(from.global_step());
|
||||
}
|
||||
if (from.depth() != 0) {
|
||||
set_depth(from.depth());
|
||||
}
|
||||
if (from.x_size() != 0) {
|
||||
set_x_size(from.x_size());
|
||||
}
|
||||
if (from.y_size() != 0) {
|
||||
set_y_size(from.y_size());
|
||||
}
|
||||
if (from.batch_size() != 0) {
|
||||
set_batch_size(from.batch_size());
|
||||
}
|
||||
if (from.num_classes() != 0) {
|
||||
set_num_classes(from.num_classes());
|
||||
}
|
||||
if (from.using_ctc() != 0) {
|
||||
set_using_ctc(from.using_ctc());
|
||||
}
|
||||
}
|
||||
|
||||
void TFNetworkModel::CopyFrom(const ::google::protobuf::Message& from) {
|
||||
// @@protoc_insertion_point(generalized_copy_from_start:tesseract.TFNetworkModel)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
void TFNetworkModel::CopyFrom(const TFNetworkModel& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:tesseract.TFNetworkModel)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool TFNetworkModel::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TFNetworkModel::Swap(TFNetworkModel* other) {
|
||||
if (other == this) return;
|
||||
InternalSwap(other);
|
||||
}
|
||||
void TFNetworkModel::InternalSwap(TFNetworkModel* other) {
|
||||
using std::swap;
|
||||
spec_.Swap(&other->spec_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
GetArenaNoVirtual());
|
||||
image_input_.Swap(&other->image_input_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
GetArenaNoVirtual());
|
||||
image_widths_.Swap(&other->image_widths_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
GetArenaNoVirtual());
|
||||
image_heights_.Swap(&other->image_heights_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
GetArenaNoVirtual());
|
||||
output_layer_.Swap(&other->output_layer_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
GetArenaNoVirtual());
|
||||
swap(graph_, other->graph_);
|
||||
swap(global_step_, other->global_step_);
|
||||
swap(depth_, other->depth_);
|
||||
swap(x_size_, other->x_size_);
|
||||
swap(y_size_, other->y_size_);
|
||||
swap(batch_size_, other->batch_size_);
|
||||
swap(num_classes_, other->num_classes_);
|
||||
swap(using_ctc_, other->using_ctc_);
|
||||
_internal_metadata_.Swap(&other->_internal_metadata_);
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata TFNetworkModel::GetMetadata() const {
|
||||
protobuf_tfnetwork_2eproto::protobuf_AssignDescriptorsOnce();
|
||||
return ::protobuf_tfnetwork_2eproto::file_level_metadata[kIndexInFileMessages];
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace tesseract
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::tesseract::TFNetworkModel* Arena::CreateMaybeMessage< ::tesseract::TFNetworkModel >(Arena* arena) {
|
||||
return Arena::CreateInternal< ::tesseract::TFNetworkModel >(arena);
|
||||
}
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
727
src/lstm/tfnetwork.pb.h
Normal file
727
src/lstm/tfnetwork.pb.h
Normal file
@ -0,0 +1,727 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: tfnetwork.proto
|
||||
|
||||
#ifndef PROTOBUF_INCLUDED_tfnetwork_2eproto
|
||||
#define PROTOBUF_INCLUDED_tfnetwork_2eproto
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
#if GOOGLE_PROTOBUF_VERSION < 3006001
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 3006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_table_driven.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/inlined_string_field.h>
|
||||
#include <google/protobuf/metadata.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
|
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
#include "tensorflow/core/framework/graph.pb.h"
|
||||
// @@protoc_insertion_point(includes)
|
||||
#define PROTOBUF_INTERNAL_EXPORT_protobuf_tfnetwork_2eproto
|
||||
|
||||
namespace protobuf_tfnetwork_2eproto {
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct {
|
||||
static const ::google::protobuf::internal::ParseTableField entries[];
|
||||
static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
|
||||
static const ::google::protobuf::internal::ParseTable schema[1];
|
||||
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
|
||||
static const ::google::protobuf::internal::SerializationTable serialization_table[];
|
||||
static const ::google::protobuf::uint32 offsets[];
|
||||
};
|
||||
void AddDescriptors();
|
||||
} // namespace protobuf_tfnetwork_2eproto
|
||||
namespace tesseract {
|
||||
class TFNetworkModel;
|
||||
class TFNetworkModelDefaultTypeInternal;
|
||||
extern TFNetworkModelDefaultTypeInternal _TFNetworkModel_default_instance_;
|
||||
} // namespace tesseract
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
template<> ::tesseract::TFNetworkModel* Arena::CreateMaybeMessage<::tesseract::TFNetworkModel>(Arena*);
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
namespace tesseract {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class TFNetworkModel : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tesseract.TFNetworkModel) */ {
|
||||
public:
|
||||
TFNetworkModel();
|
||||
virtual ~TFNetworkModel();
|
||||
|
||||
TFNetworkModel(const TFNetworkModel& from);
|
||||
|
||||
inline TFNetworkModel& operator=(const TFNetworkModel& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
#if LANG_CXX11
|
||||
TFNetworkModel(TFNetworkModel&& from) noexcept
|
||||
: TFNetworkModel() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline TFNetworkModel& operator=(TFNetworkModel&& from) noexcept {
|
||||
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
|
||||
if (this != &from) InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
static const ::google::protobuf::Descriptor* descriptor();
|
||||
static const TFNetworkModel& default_instance();
|
||||
|
||||
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
|
||||
static inline const TFNetworkModel* internal_default_instance() {
|
||||
return reinterpret_cast<const TFNetworkModel*>(
|
||||
&_TFNetworkModel_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
0;
|
||||
|
||||
void Swap(TFNetworkModel* other);
|
||||
friend void swap(TFNetworkModel& a, TFNetworkModel& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
inline TFNetworkModel* New() const final {
|
||||
return CreateMaybeMessage<TFNetworkModel>(NULL);
|
||||
}
|
||||
|
||||
TFNetworkModel* New(::google::protobuf::Arena* arena) const final {
|
||||
return CreateMaybeMessage<TFNetworkModel>(arena);
|
||||
}
|
||||
void CopyFrom(const ::google::protobuf::Message& from) final;
|
||||
void MergeFrom(const ::google::protobuf::Message& from) final;
|
||||
void CopyFrom(const TFNetworkModel& from);
|
||||
void MergeFrom(const TFNetworkModel& from);
|
||||
void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
bool MergePartialFromCodedStream(
|
||||
::google::protobuf::io::CodedInputStream* input) final;
|
||||
void SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const final;
|
||||
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
|
||||
bool deterministic, ::google::protobuf::uint8* target) const final;
|
||||
int GetCachedSize() const final { return _cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor();
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(TFNetworkModel* other);
|
||||
private:
|
||||
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
|
||||
return NULL;
|
||||
}
|
||||
inline void* MaybeArenaPtr() const {
|
||||
return NULL;
|
||||
}
|
||||
public:
|
||||
|
||||
::google::protobuf::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// string spec = 3;
|
||||
void clear_spec();
|
||||
static const int kSpecFieldNumber = 3;
|
||||
const ::std::string& spec() const;
|
||||
void set_spec(const ::std::string& value);
|
||||
#if LANG_CXX11
|
||||
void set_spec(::std::string&& value);
|
||||
#endif
|
||||
void set_spec(const char* value);
|
||||
void set_spec(const char* value, size_t size);
|
||||
::std::string* mutable_spec();
|
||||
::std::string* release_spec();
|
||||
void set_allocated_spec(::std::string* spec);
|
||||
|
||||
// string image_input = 11;
|
||||
void clear_image_input();
|
||||
static const int kImageInputFieldNumber = 11;
|
||||
const ::std::string& image_input() const;
|
||||
void set_image_input(const ::std::string& value);
|
||||
#if LANG_CXX11
|
||||
void set_image_input(::std::string&& value);
|
||||
#endif
|
||||
void set_image_input(const char* value);
|
||||
void set_image_input(const char* value, size_t size);
|
||||
::std::string* mutable_image_input();
|
||||
::std::string* release_image_input();
|
||||
void set_allocated_image_input(::std::string* image_input);
|
||||
|
||||
// string image_widths = 12;
|
||||
void clear_image_widths();
|
||||
static const int kImageWidthsFieldNumber = 12;
|
||||
const ::std::string& image_widths() const;
|
||||
void set_image_widths(const ::std::string& value);
|
||||
#if LANG_CXX11
|
||||
void set_image_widths(::std::string&& value);
|
||||
#endif
|
||||
void set_image_widths(const char* value);
|
||||
void set_image_widths(const char* value, size_t size);
|
||||
::std::string* mutable_image_widths();
|
||||
::std::string* release_image_widths();
|
||||
void set_allocated_image_widths(::std::string* image_widths);
|
||||
|
||||
// string image_heights = 13;
|
||||
void clear_image_heights();
|
||||
static const int kImageHeightsFieldNumber = 13;
|
||||
const ::std::string& image_heights() const;
|
||||
void set_image_heights(const ::std::string& value);
|
||||
#if LANG_CXX11
|
||||
void set_image_heights(::std::string&& value);
|
||||
#endif
|
||||
void set_image_heights(const char* value);
|
||||
void set_image_heights(const char* value, size_t size);
|
||||
::std::string* mutable_image_heights();
|
||||
::std::string* release_image_heights();
|
||||
void set_allocated_image_heights(::std::string* image_heights);
|
||||
|
||||
// string output_layer = 14;
|
||||
void clear_output_layer();
|
||||
static const int kOutputLayerFieldNumber = 14;
|
||||
const ::std::string& output_layer() const;
|
||||
void set_output_layer(const ::std::string& value);
|
||||
#if LANG_CXX11
|
||||
void set_output_layer(::std::string&& value);
|
||||
#endif
|
||||
void set_output_layer(const char* value);
|
||||
void set_output_layer(const char* value, size_t size);
|
||||
::std::string* mutable_output_layer();
|
||||
::std::string* release_output_layer();
|
||||
void set_allocated_output_layer(::std::string* output_layer);
|
||||
|
||||
// .tensorflow.GraphDef graph = 1;
|
||||
bool has_graph() const;
|
||||
void clear_graph();
|
||||
static const int kGraphFieldNumber = 1;
|
||||
private:
|
||||
const ::tensorflow::GraphDef& _internal_graph() const;
|
||||
public:
|
||||
const ::tensorflow::GraphDef& graph() const;
|
||||
::tensorflow::GraphDef* release_graph();
|
||||
::tensorflow::GraphDef* mutable_graph();
|
||||
void set_allocated_graph(::tensorflow::GraphDef* graph);
|
||||
|
||||
// int64 global_step = 2;
|
||||
void clear_global_step();
|
||||
static const int kGlobalStepFieldNumber = 2;
|
||||
::google::protobuf::int64 global_step() const;
|
||||
void set_global_step(::google::protobuf::int64 value);
|
||||
|
||||
// int32 depth = 4;
|
||||
void clear_depth();
|
||||
static const int kDepthFieldNumber = 4;
|
||||
::google::protobuf::int32 depth() const;
|
||||
void set_depth(::google::protobuf::int32 value);
|
||||
|
||||
// int32 x_size = 5;
|
||||
void clear_x_size();
|
||||
static const int kXSizeFieldNumber = 5;
|
||||
::google::protobuf::int32 x_size() const;
|
||||
void set_x_size(::google::protobuf::int32 value);
|
||||
|
||||
// int32 y_size = 6;
|
||||
void clear_y_size();
|
||||
static const int kYSizeFieldNumber = 6;
|
||||
::google::protobuf::int32 y_size() const;
|
||||
void set_y_size(::google::protobuf::int32 value);
|
||||
|
||||
// int32 batch_size = 8;
|
||||
void clear_batch_size();
|
||||
static const int kBatchSizeFieldNumber = 8;
|
||||
::google::protobuf::int32 batch_size() const;
|
||||
void set_batch_size(::google::protobuf::int32 value);
|
||||
|
||||
// int32 num_classes = 9;
|
||||
void clear_num_classes();
|
||||
static const int kNumClassesFieldNumber = 9;
|
||||
::google::protobuf::int32 num_classes() const;
|
||||
void set_num_classes(::google::protobuf::int32 value);
|
||||
|
||||
// bool using_ctc = 10;
|
||||
void clear_using_ctc();
|
||||
static const int kUsingCtcFieldNumber = 10;
|
||||
bool using_ctc() const;
|
||||
void set_using_ctc(bool value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:tesseract.TFNetworkModel)
|
||||
private:
|
||||
|
||||
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
|
||||
::google::protobuf::internal::ArenaStringPtr spec_;
|
||||
::google::protobuf::internal::ArenaStringPtr image_input_;
|
||||
::google::protobuf::internal::ArenaStringPtr image_widths_;
|
||||
::google::protobuf::internal::ArenaStringPtr image_heights_;
|
||||
::google::protobuf::internal::ArenaStringPtr output_layer_;
|
||||
::tensorflow::GraphDef* graph_;
|
||||
::google::protobuf::int64 global_step_;
|
||||
::google::protobuf::int32 depth_;
|
||||
::google::protobuf::int32 x_size_;
|
||||
::google::protobuf::int32 y_size_;
|
||||
::google::protobuf::int32 batch_size_;
|
||||
::google::protobuf::int32 num_classes_;
|
||||
bool using_ctc_;
|
||||
mutable ::google::protobuf::internal::CachedSize _cached_size_;
|
||||
friend struct ::protobuf_tfnetwork_2eproto::TableStruct;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// TFNetworkModel
|
||||
|
||||
// .tensorflow.GraphDef graph = 1;
|
||||
inline bool TFNetworkModel::has_graph() const {
|
||||
return this != internal_default_instance() && graph_ != NULL;
|
||||
}
|
||||
inline const ::tensorflow::GraphDef& TFNetworkModel::_internal_graph() const {
|
||||
return *graph_;
|
||||
}
|
||||
inline const ::tensorflow::GraphDef& TFNetworkModel::graph() const {
|
||||
const ::tensorflow::GraphDef* p = graph_;
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.graph)
|
||||
return p != NULL ? *p : *reinterpret_cast<const ::tensorflow::GraphDef*>(
|
||||
&::tensorflow::_GraphDef_default_instance_);
|
||||
}
|
||||
inline ::tensorflow::GraphDef* TFNetworkModel::release_graph() {
|
||||
// @@protoc_insertion_point(field_release:tesseract.TFNetworkModel.graph)
|
||||
|
||||
::tensorflow::GraphDef* temp = graph_;
|
||||
graph_ = NULL;
|
||||
return temp;
|
||||
}
|
||||
inline ::tensorflow::GraphDef* TFNetworkModel::mutable_graph() {
|
||||
|
||||
if (graph_ == NULL) {
|
||||
auto* p = CreateMaybeMessage<::tensorflow::GraphDef>(GetArenaNoVirtual());
|
||||
graph_ = p;
|
||||
}
|
||||
// @@protoc_insertion_point(field_mutable:tesseract.TFNetworkModel.graph)
|
||||
return graph_;
|
||||
}
|
||||
inline void TFNetworkModel::set_allocated_graph(::tensorflow::GraphDef* graph) {
|
||||
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
|
||||
if (message_arena == NULL) {
|
||||
delete reinterpret_cast< ::google::protobuf::MessageLite*>(graph_);
|
||||
}
|
||||
if (graph) {
|
||||
::google::protobuf::Arena* submessage_arena =
|
||||
reinterpret_cast<::google::protobuf::MessageLite*>(graph)->GetArena();
|
||||
if (message_arena != submessage_arena) {
|
||||
graph = ::google::protobuf::internal::GetOwnedMessage(
|
||||
message_arena, graph, submessage_arena);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
graph_ = graph;
|
||||
// @@protoc_insertion_point(field_set_allocated:tesseract.TFNetworkModel.graph)
|
||||
}
|
||||
|
||||
// int64 global_step = 2;
|
||||
inline void TFNetworkModel::clear_global_step() {
|
||||
global_step_ = GOOGLE_LONGLONG(0);
|
||||
}
|
||||
inline ::google::protobuf::int64 TFNetworkModel::global_step() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.global_step)
|
||||
return global_step_;
|
||||
}
|
||||
inline void TFNetworkModel::set_global_step(::google::protobuf::int64 value) {
|
||||
|
||||
global_step_ = value;
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.global_step)
|
||||
}
|
||||
|
||||
// string spec = 3;
|
||||
inline void TFNetworkModel::clear_spec() {
|
||||
spec_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline const ::std::string& TFNetworkModel::spec() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.spec)
|
||||
return spec_.GetNoArena();
|
||||
}
|
||||
inline void TFNetworkModel::set_spec(const ::std::string& value) {
|
||||
|
||||
spec_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.spec)
|
||||
}
|
||||
#if LANG_CXX11
|
||||
inline void TFNetworkModel::set_spec(::std::string&& value) {
|
||||
|
||||
spec_.SetNoArena(
|
||||
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
|
||||
// @@protoc_insertion_point(field_set_rvalue:tesseract.TFNetworkModel.spec)
|
||||
}
|
||||
#endif
|
||||
inline void TFNetworkModel::set_spec(const char* value) {
|
||||
GOOGLE_DCHECK(value != NULL);
|
||||
|
||||
spec_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
|
||||
// @@protoc_insertion_point(field_set_char:tesseract.TFNetworkModel.spec)
|
||||
}
|
||||
inline void TFNetworkModel::set_spec(const char* value, size_t size) {
|
||||
|
||||
spec_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
::std::string(reinterpret_cast<const char*>(value), size));
|
||||
// @@protoc_insertion_point(field_set_pointer:tesseract.TFNetworkModel.spec)
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::mutable_spec() {
|
||||
|
||||
// @@protoc_insertion_point(field_mutable:tesseract.TFNetworkModel.spec)
|
||||
return spec_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::release_spec() {
|
||||
// @@protoc_insertion_point(field_release:tesseract.TFNetworkModel.spec)
|
||||
|
||||
return spec_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline void TFNetworkModel::set_allocated_spec(::std::string* spec) {
|
||||
if (spec != NULL) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
spec_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), spec);
|
||||
// @@protoc_insertion_point(field_set_allocated:tesseract.TFNetworkModel.spec)
|
||||
}
|
||||
|
||||
// int32 depth = 4;
|
||||
inline void TFNetworkModel::clear_depth() {
|
||||
depth_ = 0;
|
||||
}
|
||||
inline ::google::protobuf::int32 TFNetworkModel::depth() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.depth)
|
||||
return depth_;
|
||||
}
|
||||
inline void TFNetworkModel::set_depth(::google::protobuf::int32 value) {
|
||||
|
||||
depth_ = value;
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.depth)
|
||||
}
|
||||
|
||||
// int32 x_size = 5;
|
||||
inline void TFNetworkModel::clear_x_size() {
|
||||
x_size_ = 0;
|
||||
}
|
||||
inline ::google::protobuf::int32 TFNetworkModel::x_size() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.x_size)
|
||||
return x_size_;
|
||||
}
|
||||
inline void TFNetworkModel::set_x_size(::google::protobuf::int32 value) {
|
||||
|
||||
x_size_ = value;
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.x_size)
|
||||
}
|
||||
|
||||
// int32 y_size = 6;
|
||||
inline void TFNetworkModel::clear_y_size() {
|
||||
y_size_ = 0;
|
||||
}
|
||||
inline ::google::protobuf::int32 TFNetworkModel::y_size() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.y_size)
|
||||
return y_size_;
|
||||
}
|
||||
inline void TFNetworkModel::set_y_size(::google::protobuf::int32 value) {
|
||||
|
||||
y_size_ = value;
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.y_size)
|
||||
}
|
||||
|
||||
// int32 batch_size = 8;
|
||||
inline void TFNetworkModel::clear_batch_size() {
|
||||
batch_size_ = 0;
|
||||
}
|
||||
inline ::google::protobuf::int32 TFNetworkModel::batch_size() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.batch_size)
|
||||
return batch_size_;
|
||||
}
|
||||
inline void TFNetworkModel::set_batch_size(::google::protobuf::int32 value) {
|
||||
|
||||
batch_size_ = value;
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.batch_size)
|
||||
}
|
||||
|
||||
// int32 num_classes = 9;
|
||||
inline void TFNetworkModel::clear_num_classes() {
|
||||
num_classes_ = 0;
|
||||
}
|
||||
inline ::google::protobuf::int32 TFNetworkModel::num_classes() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.num_classes)
|
||||
return num_classes_;
|
||||
}
|
||||
inline void TFNetworkModel::set_num_classes(::google::protobuf::int32 value) {
|
||||
|
||||
num_classes_ = value;
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.num_classes)
|
||||
}
|
||||
|
||||
// bool using_ctc = 10;
|
||||
inline void TFNetworkModel::clear_using_ctc() {
|
||||
using_ctc_ = false;
|
||||
}
|
||||
inline bool TFNetworkModel::using_ctc() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.using_ctc)
|
||||
return using_ctc_;
|
||||
}
|
||||
inline void TFNetworkModel::set_using_ctc(bool value) {
|
||||
|
||||
using_ctc_ = value;
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.using_ctc)
|
||||
}
|
||||
|
||||
// string image_input = 11;
|
||||
inline void TFNetworkModel::clear_image_input() {
|
||||
image_input_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline const ::std::string& TFNetworkModel::image_input() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.image_input)
|
||||
return image_input_.GetNoArena();
|
||||
}
|
||||
inline void TFNetworkModel::set_image_input(const ::std::string& value) {
|
||||
|
||||
image_input_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.image_input)
|
||||
}
|
||||
#if LANG_CXX11
|
||||
inline void TFNetworkModel::set_image_input(::std::string&& value) {
|
||||
|
||||
image_input_.SetNoArena(
|
||||
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
|
||||
// @@protoc_insertion_point(field_set_rvalue:tesseract.TFNetworkModel.image_input)
|
||||
}
|
||||
#endif
|
||||
inline void TFNetworkModel::set_image_input(const char* value) {
|
||||
GOOGLE_DCHECK(value != NULL);
|
||||
|
||||
image_input_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
|
||||
// @@protoc_insertion_point(field_set_char:tesseract.TFNetworkModel.image_input)
|
||||
}
|
||||
inline void TFNetworkModel::set_image_input(const char* value, size_t size) {
|
||||
|
||||
image_input_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
::std::string(reinterpret_cast<const char*>(value), size));
|
||||
// @@protoc_insertion_point(field_set_pointer:tesseract.TFNetworkModel.image_input)
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::mutable_image_input() {
|
||||
|
||||
// @@protoc_insertion_point(field_mutable:tesseract.TFNetworkModel.image_input)
|
||||
return image_input_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::release_image_input() {
|
||||
// @@protoc_insertion_point(field_release:tesseract.TFNetworkModel.image_input)
|
||||
|
||||
return image_input_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline void TFNetworkModel::set_allocated_image_input(::std::string* image_input) {
|
||||
if (image_input != NULL) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
image_input_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), image_input);
|
||||
// @@protoc_insertion_point(field_set_allocated:tesseract.TFNetworkModel.image_input)
|
||||
}
|
||||
|
||||
// string image_widths = 12;
|
||||
inline void TFNetworkModel::clear_image_widths() {
|
||||
image_widths_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline const ::std::string& TFNetworkModel::image_widths() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.image_widths)
|
||||
return image_widths_.GetNoArena();
|
||||
}
|
||||
inline void TFNetworkModel::set_image_widths(const ::std::string& value) {
|
||||
|
||||
image_widths_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.image_widths)
|
||||
}
|
||||
#if LANG_CXX11
|
||||
inline void TFNetworkModel::set_image_widths(::std::string&& value) {
|
||||
|
||||
image_widths_.SetNoArena(
|
||||
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
|
||||
// @@protoc_insertion_point(field_set_rvalue:tesseract.TFNetworkModel.image_widths)
|
||||
}
|
||||
#endif
|
||||
inline void TFNetworkModel::set_image_widths(const char* value) {
|
||||
GOOGLE_DCHECK(value != NULL);
|
||||
|
||||
image_widths_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
|
||||
// @@protoc_insertion_point(field_set_char:tesseract.TFNetworkModel.image_widths)
|
||||
}
|
||||
inline void TFNetworkModel::set_image_widths(const char* value, size_t size) {
|
||||
|
||||
image_widths_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
::std::string(reinterpret_cast<const char*>(value), size));
|
||||
// @@protoc_insertion_point(field_set_pointer:tesseract.TFNetworkModel.image_widths)
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::mutable_image_widths() {
|
||||
|
||||
// @@protoc_insertion_point(field_mutable:tesseract.TFNetworkModel.image_widths)
|
||||
return image_widths_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::release_image_widths() {
|
||||
// @@protoc_insertion_point(field_release:tesseract.TFNetworkModel.image_widths)
|
||||
|
||||
return image_widths_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline void TFNetworkModel::set_allocated_image_widths(::std::string* image_widths) {
|
||||
if (image_widths != NULL) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
image_widths_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), image_widths);
|
||||
// @@protoc_insertion_point(field_set_allocated:tesseract.TFNetworkModel.image_widths)
|
||||
}
|
||||
|
||||
// string image_heights = 13;
|
||||
inline void TFNetworkModel::clear_image_heights() {
|
||||
image_heights_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline const ::std::string& TFNetworkModel::image_heights() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.image_heights)
|
||||
return image_heights_.GetNoArena();
|
||||
}
|
||||
inline void TFNetworkModel::set_image_heights(const ::std::string& value) {
|
||||
|
||||
image_heights_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.image_heights)
|
||||
}
|
||||
#if LANG_CXX11
|
||||
inline void TFNetworkModel::set_image_heights(::std::string&& value) {
|
||||
|
||||
image_heights_.SetNoArena(
|
||||
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
|
||||
// @@protoc_insertion_point(field_set_rvalue:tesseract.TFNetworkModel.image_heights)
|
||||
}
|
||||
#endif
|
||||
inline void TFNetworkModel::set_image_heights(const char* value) {
|
||||
GOOGLE_DCHECK(value != NULL);
|
||||
|
||||
image_heights_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
|
||||
// @@protoc_insertion_point(field_set_char:tesseract.TFNetworkModel.image_heights)
|
||||
}
|
||||
inline void TFNetworkModel::set_image_heights(const char* value, size_t size) {
|
||||
|
||||
image_heights_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
::std::string(reinterpret_cast<const char*>(value), size));
|
||||
// @@protoc_insertion_point(field_set_pointer:tesseract.TFNetworkModel.image_heights)
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::mutable_image_heights() {
|
||||
|
||||
// @@protoc_insertion_point(field_mutable:tesseract.TFNetworkModel.image_heights)
|
||||
return image_heights_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::release_image_heights() {
|
||||
// @@protoc_insertion_point(field_release:tesseract.TFNetworkModel.image_heights)
|
||||
|
||||
return image_heights_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline void TFNetworkModel::set_allocated_image_heights(::std::string* image_heights) {
|
||||
if (image_heights != NULL) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
image_heights_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), image_heights);
|
||||
// @@protoc_insertion_point(field_set_allocated:tesseract.TFNetworkModel.image_heights)
|
||||
}
|
||||
|
||||
// string output_layer = 14;
|
||||
inline void TFNetworkModel::clear_output_layer() {
|
||||
output_layer_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline const ::std::string& TFNetworkModel::output_layer() const {
|
||||
// @@protoc_insertion_point(field_get:tesseract.TFNetworkModel.output_layer)
|
||||
return output_layer_.GetNoArena();
|
||||
}
|
||||
inline void TFNetworkModel::set_output_layer(const ::std::string& value) {
|
||||
|
||||
output_layer_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
|
||||
// @@protoc_insertion_point(field_set:tesseract.TFNetworkModel.output_layer)
|
||||
}
|
||||
#if LANG_CXX11
|
||||
inline void TFNetworkModel::set_output_layer(::std::string&& value) {
|
||||
|
||||
output_layer_.SetNoArena(
|
||||
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
|
||||
// @@protoc_insertion_point(field_set_rvalue:tesseract.TFNetworkModel.output_layer)
|
||||
}
|
||||
#endif
|
||||
inline void TFNetworkModel::set_output_layer(const char* value) {
|
||||
GOOGLE_DCHECK(value != NULL);
|
||||
|
||||
output_layer_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
|
||||
// @@protoc_insertion_point(field_set_char:tesseract.TFNetworkModel.output_layer)
|
||||
}
|
||||
inline void TFNetworkModel::set_output_layer(const char* value, size_t size) {
|
||||
|
||||
output_layer_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
|
||||
::std::string(reinterpret_cast<const char*>(value), size));
|
||||
// @@protoc_insertion_point(field_set_pointer:tesseract.TFNetworkModel.output_layer)
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::mutable_output_layer() {
|
||||
|
||||
// @@protoc_insertion_point(field_mutable:tesseract.TFNetworkModel.output_layer)
|
||||
return output_layer_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline ::std::string* TFNetworkModel::release_output_layer() {
|
||||
// @@protoc_insertion_point(field_release:tesseract.TFNetworkModel.output_layer)
|
||||
|
||||
return output_layer_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline void TFNetworkModel::set_allocated_output_layer(::std::string* output_layer) {
|
||||
if (output_layer != NULL) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
output_layer_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), output_layer);
|
||||
// @@protoc_insertion_point(field_set_allocated:tesseract.TFNetworkModel.output_layer)
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace tesseract
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#endif // PROTOBUF_INCLUDED_tfnetwork_2eproto
|
@ -1,9 +1,22 @@
|
||||
// Protocol description for Tesseract
|
||||
|
||||
// Compile this file with the Protocol Compiler protoc to generate
|
||||
// the files tfnetwork.pb.cc and tfnetwork.pb.h.
|
||||
|
||||
// This requires the protocol descriptions for Tensorflow
|
||||
// (included in the Tensorflow sources).
|
||||
|
||||
// With Tensorflow sources installed in /usr/src/tensorflow/tensorflow-1.10.1,
|
||||
// this command was used on Debian to generate the files:
|
||||
|
||||
// protoc --cpp_out=$PWD --proto_path=/usr/src/tensorflow/tensorflow-1.10.1 \
|
||||
// --proto_path=$PWD src/lstm/tfnetwork.proto
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package tesseract;
|
||||
|
||||
// TODO(rays) How to make this usable both in Google and open source?
|
||||
import "third_party/tensorflow/core/framework/graph.proto";
|
||||
import "tensorflow/core/framework/graph.proto";
|
||||
|
||||
// This proto is the interface between a python TF graph builder/trainer and
|
||||
// the C++ world. The writer of this proto must provide fields as documented
|
||||
|
@ -282,6 +282,9 @@ unicharset_extractor_LDADD += $(LEPTONICA_LIBS)
|
||||
wordlist2dawg_LDADD += $(LEPTONICA_LIBS)
|
||||
|
||||
extralib = $(libarchive_LIBS)
|
||||
if TENSORFLOW
|
||||
extralib += -lprotobuf -ltensorflow_cc
|
||||
endif
|
||||
|
||||
if !DISABLED_LEGACY_ENGINE
|
||||
ambiguous_words_LDADD += $(extralib)
|
||||
|
Loading…
Reference in New Issue
Block a user