Skip to content

Commit

Permalink
Remove Tensorflow support
Browse files Browse the repository at this point in the history
Tensorflow was never used because of missing models.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Nov 7, 2024
1 parent daaa902 commit d7c0a05
Show file tree
Hide file tree
Showing 13 changed files with 3 additions and 2,050 deletions.
28 changes: 0 additions & 28 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ lib_LTLIBRARIES = libtesseract.la
libtesseract_la_LDFLAGS = $(LEPTONICA_LIBS)
libtesseract_la_LDFLAGS += $(libarchive_LIBS)
libtesseract_la_LDFLAGS += $(libcurl_LIBS)
libtesseract_la_LDFLAGS += $(TENSORFLOW_LIBS)
if T_WIN
libtesseract_la_LDFLAGS += -no-undefined -lws2_32
else
Expand Down Expand Up @@ -509,10 +508,6 @@ libtesseract_lstm_la_CPPFLAGS += -I$(top_srcdir)/src/cutil
libtesseract_lstm_la_CPPFLAGS += -I$(top_srcdir)/src/dict
libtesseract_lstm_la_CPPFLAGS += -I$(top_srcdir)/src/lstm
libtesseract_lstm_la_CPPFLAGS += -I$(top_srcdir)/src/viewer
if TENSORFLOW
libtesseract_lstm_la_CPPFLAGS += -DINCLUDE_TENSORFLOW
libtesseract_lstm_la_CPPFLAGS += -I/usr/include/tensorflow
endif
if !NO_TESSDATA_PREFIX
libtesseract_lstm_la_CPPFLAGS += -DTESSDATA_PREFIX='"@datadir@"'
endif
Expand All @@ -535,7 +530,6 @@ noinst_HEADERS += src/lstm/reversed.h
noinst_HEADERS += src/lstm/series.h
noinst_HEADERS += src/lstm/static_shape.h
noinst_HEADERS += src/lstm/stridemap.h
noinst_HEADERS += src/lstm/tfnetwork.h
noinst_HEADERS += src/lstm/weightmatrix.h

noinst_LTLIBRARIES += libtesseract_lstm.la
Expand All @@ -556,10 +550,6 @@ libtesseract_lstm_la_SOURCES += src/lstm/reconfig.cpp
libtesseract_lstm_la_SOURCES += src/lstm/reversed.cpp
libtesseract_lstm_la_SOURCES += src/lstm/series.cpp
libtesseract_lstm_la_SOURCES += src/lstm/stridemap.cpp
if TENSORFLOW
libtesseract_lstm_la_SOURCES += src/lstm/tfnetwork.cpp
libtesseract_lstm_la_SOURCES += src/lstm/tfnetwork.pb.cc
endif
libtesseract_lstm_la_SOURCES += src/lstm/weightmatrix.cpp

# Rules for src/textord.
Expand Down Expand Up @@ -730,7 +720,6 @@ tesseract_LDFLAGS = $(OPENMP_CXXFLAGS)

tesseract_LDADD = libtesseract.la
tesseract_LDADD += $(LEPTONICA_LIBS)
tesseract_LDADD += $(TENSORFLOW_LIBS)
tesseract_LDADD += $(libarchive_LIBS)
tesseract_LDADD += $(libcurl_LIBS)

Expand Down Expand Up @@ -900,7 +889,6 @@ EXTRA_PROGRAMS += $(trainingtools)
extralib = libtesseract.la
extralib += $(libarchive_LIBS)
extralib += $(LEPTONICA_LIBS)
extralib += $(TENSORFLOW_LIBS)
if T_WIN
extralib += -lws2_32
endif
Expand Down Expand Up @@ -1008,7 +996,6 @@ fuzzer-api: unittest/fuzzers/fuzzer-api.cpp
$< \
$(builddir)/.libs/libtesseract.a \
$(LEPTONICA_LIBS) \
$(TENSORFLOW_LIBS) \
$(libarchive_LIBS) \
$(libcurl_LIBS) \
-o $@
Expand All @@ -1028,7 +1015,6 @@ fuzzer-api-512x256: unittest/fuzzers/fuzzer-api.cpp
$< \
$(builddir)/.libs/libtesseract.a \
$(LEPTONICA_LIBS) \
$(TENSORFLOW_LIBS) \
$(libarchive_LIBS) \
$(libcurl_LIBS) \
-o $@
Expand Down Expand Up @@ -1141,10 +1127,6 @@ endif # ENABLE_TRAINING
unittest_CPPFLAGS += -I$(top_srcdir)/src/viewer
unittest_CPPFLAGS += -I$(top_srcdir)/src/wordrec
unittest_CPPFLAGS += -I$(top_srcdir)/unittest
if TENSORFLOW
unittest_CPPFLAGS += -DINCLUDE_TENSORFLOW
unittest_CPPFLAGS += -I/usr/include/tensorflow
endif # TENSORFLOW

# Build googletest:
check_LTLIBRARIES = libgtest.la libgtest_main.la libgmock.la libgmock_main.la
Expand Down Expand Up @@ -1172,7 +1154,6 @@ GTEST_LIBS = libgtest.la libgtest_main.la -lpthread
GMOCK_LIBS = libgmock.la libgmock_main.la
TESS_LIBS = $(GTEST_LIBS)
TESS_LIBS += libtesseract.la $(libarchive_LIBS)
TESS_LIBS += $(TENSORFLOW_LIBS)
TRAINING_LIBS = libtesseract_training.la
TRAINING_LIBS += $(TESS_LIBS)
unittest_CPPFLAGS += -isystem $(top_srcdir)/unittest/third_party/googletest/googletest/include
Expand Down Expand Up @@ -1419,10 +1400,6 @@ networkio_test_CPPFLAGS = $(unittest_CPPFLAGS)
networkio_test_LDADD = $(TESS_LIBS)

normstrngs_test_SOURCES = unittest/normstrngs_test.cc
if TENSORFLOW
normstrngs_test_SOURCES += unittest/third_party/utf/rune.c
normstrngs_test_SOURCES += unittest/util/utf8/unilib.cc
endif # TENSORFLOW
normstrngs_test_CPPFLAGS = $(unittest_CPPFLAGS)
normstrngs_test_LDADD = $(TRAINING_LIBS) $(ICU_I18N_LIBS) $(ICU_UC_LIBS)

Expand All @@ -1441,11 +1418,6 @@ pagesegmode_test_CPPFLAGS = $(unittest_CPPFLAGS)
pagesegmode_test_LDADD = $(TRAINING_LIBS) $(LEPTONICA_LIBS)

pango_font_info_test_SOURCES = unittest/pango_font_info_test.cc
if TENSORFLOW
pango_font_info_test_SOURCES += unittest/third_party/utf/rune.c
pango_font_info_test_SOURCES += unittest/util/utf8/unicodetext.cc
pango_font_info_test_SOURCES += unittest/util/utf8/unilib.cc
endif # TENSORFLOW
pango_font_info_test_CPPFLAGS = $(unittest_CPPFLAGS)
pango_font_info_test_LDADD = $(TRAINING_LIBS) $(LEPTONICA_LIBS)
pango_font_info_test_LDADD += $(ICU_I18N_LIBS)
Expand Down
19 changes: 0 additions & 19 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -270,25 +270,6 @@ AC_ARG_WITH([curl],
AS_HELP_STRING([--with-curl],
[Build with libcurl which supports processing an image URL @<:@default=check@:>@]),
[], [with_curl=check])
AC_ARG_WITH([tensorflow],
AS_HELP_STRING([--with-tensorflow],
[support TensorFlow @<:@default=check@:>@]),
[], [with_tensorflow=check])
# Check whether to build with support for TensorFlow.
AM_CONDITIONAL([TENSORFLOW], false)
TENSORFLOW_LIBS=
AS_IF([test "x$with_tensorflow" != xno],
[AC_CHECK_HEADERS([tensorflow/core/framework/graph.pb.h],
[AC_SUBST([TENSORFLOW_LIBS], ["-lprotobuf -ltensorflow_cc"])
AM_CONDITIONAL([TENSORFLOW], true)
],
[if test "x$with_tensorflow" != xcheck; then
AC_MSG_FAILURE(
[--with-tensorflow was given, but test for libtensorflow-dev failed])
fi
])
])
# https://lists.apple.com/archives/unix-porting/2009/Jan/msg00026.html
m4_define([MY_CHECK_FRAMEWORK],
Expand Down
9 changes: 1 addition & 8 deletions src/lstm/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
#include "scrollview.h"
#include "series.h"
#include "statistc.h"
#ifdef INCLUDE_TENSORFLOW
# include "tfnetwork.h"
#endif
#include "tprintf.h"

namespace tesseract {
Expand Down Expand Up @@ -287,11 +284,7 @@ Network *Network::CreateFromFile(TFile *fp) {
network = new Series(name);
break;
case NT_TENSORFLOW:
#ifdef INCLUDE_TENSORFLOW
network = new TFNetwork(name);
#else
tprintf("TensorFlow not compiled in! -DINCLUDE_TENSORFLOW\n");
#endif
tprintf("Unsupported TensorFlow model\n");
break;
// All variants of FullyConnected.
case NT_SOFTMAX:
Expand Down
143 changes: 0 additions & 143 deletions src/lstm/tfnetwork.cpp

This file was deleted.

Loading

0 comments on commit d7c0a05

Please sign in to comment.