Commit Graph

6001 Commits

Author SHA1 Message Date
Stefan Weil
ff830775f9 Fix memory leak in DocumentCache
It was introduced in commit 5cac52173e.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-03-01 11:31:48 +01:00
Stefan Weil
339c01894e Avoid fp division by 0 (fix issue #3314)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-28 19:42:01 +01:00
Egor Pugin
838a754d24
Merge pull request #3313 from stweil/learning_rate
Add new checks for floating point errors and fix a division by zero
2021-02-27 23:20:09 +03:00
Stefan Weil
cd60728e8a Avoid float division by zero when calculating adaptive learning rate
The following line results in a division by zero when
momentum is -1 and num_samples is even:

     learning_rate /= 1.0f - pow(momentum, num_samples);

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-27 21:08:41 +01:00
Stefan Weil
c12dde2862 Use float instead of double for learning_rate, momentum and adam_beta
Only WeightMatrix::Update used double parameters, all other functions
already used float. So this change avoids unnecessary conversions.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-27 21:08:41 +01:00
Stefan Weil
422452b9f4 Check for float errors when running tesseract and lstmtraining
Some illegal floating point calculations like division by zero,
illegal value or overflow will now abort tesseract with an error
message.

For lstmtraining there is now a new parameter --debug_float to
enable the same kind of checks. It is currently disabled by default
because such errors occur and would abort the training process.
That should be fixed in the future.

If tesseract also shows floating point errors which cannot be
fixed easily, a similar parameter to enable the checks can be
added there, too.

The new code requires the function feenableexcept which is only
available with the GNU libc, so it is only used on Linux.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 21:49:27 +01:00
Stefan Weil
51a214a51b Remove unused include statements for imagedata.h and document used ones
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 21:42:28 +01:00
Stefan Weil
1d7a981203 Disable code for unused classes WordFeature and FloatWordFeature
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 21:42:17 +01:00
Stefan Weil
5cac52173e Replace PointerVector by std::vector in class DocumentCache
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 21:42:07 +01:00
Stefan Weil
387acd9881 Initialize weight matrix with 0.0 (fix issue #3229)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 18:49:39 +01:00
Egor Pugin
1ab6b0fbc6
Merge pull request #3311 from stweil/master
Replace calls of exit function
2021-02-26 17:43:53 +03:00
Stefan Weil
58304cbfdd Don't compile OpenCL code when OpenCL is disabled
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 15:40:23 +01:00
Stefan Weil
a6946c3bf9 Replace calls of exit function
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 14:22:36 +01:00
Stefan Weil
373a3527ec Format code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 14:22:09 +01:00
Stefan Weil
ea446b1eae Remove blanks at line endings
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-26 14:05:36 +01:00
Stefan Weil
394c56ab15 Replace GenericVector by std::vector in class WERD_CHOICE
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 23:14:25 +01:00
Egor Pugin
b030b03e0d
Update configure.ac 2021-02-24 01:09:44 +03:00
Egor Pugin
c877c368a1
Merge pull request #3309 from stweil/std
Replace more STRING and GenericVector variables and other code maintenance
2021-02-24 01:04:03 +03:00
Egor Pugin
90afdef30d
Merge pull request #3162 from xloem/android
Specify ADD_RT for android platform, which embeds librt in libc
2021-02-24 00:22:17 +03:00
Stefan Weil
fccecb2d23 Replace GenericVector by std::vector in class ResultIterator
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 21:07:57 +01:00
Stefan Weil
2257028052 Replace GenericVector by std::vector in reject.cpp
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 21:06:59 +01:00
Stefan Weil
d62f27dd8f Replace GenericVector by std::vector in stepblob.cpp
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 20:47:06 +01:00
Stefan Weil
3e5b2760ab Replace GenericVector by std::vector for struct BlamerBundle
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 20:34:41 +01:00
Stefan Weil
0b8e937655 Use countof to get number of array elements
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 20:20:48 +01:00
Stefan Weil
7097dfd41c Replace GenericVector by std::vector for parameters
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 20:20:48 +01:00
Stefan Weil
f2d2695ce9 Replace STRING and clean declarations of local variables in eval_word_spacing
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 20:20:48 +01:00
Stefan Weil
5277443833 Replace more STRING
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-23 20:20:48 +01:00
Stefan Weil
ae00f291f6 Remove unused include statements
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-22 22:28:47 +01:00
Egor Pugin
8081cae82e
Merge pull request #3305 from Shreeshrii/vcpkg-cmake-win
Actions CI: Add workflow to build tesseract using vcpkg and cmake
2021-02-20 14:25:15 +03:00
Shree Devi Kumar
b99ff07f64 Actions CI: Add workflow to build tesseract and basicapitest using vcpkg and cmake 2021-02-20 09:33:15 +00:00
Egor Pugin
a219d64811
Merge pull request #3302 from Shreeshrii/PR1
Actions CI: Remove gcc from macOS CI
2021-02-15 17:07:57 +03:00
Shree Devi Kumar
efba7535f0 Actions CI: Remove gcc from macOS CI 2021-02-15 14:04:29 +00:00
Egor Pugin
0b35605420
Merge pull request #3300 from Shreeshrii/autocmake
Formatting changes and basicapitest.cpp from test/testing for Actions CI
2021-02-13 20:41:02 +03:00
Shree Devi Kumar
642e2ac9c1 Link to basicapitest in test/testing for Actions CI 2021-02-13 17:20:36 +00:00
Stefan Weil
65053890d7 Handle file list without terminating LF (fix issue #3298)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-13 11:44:47 +01:00
Stefan Weil
3d5fea6355 Update test submodule
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-13 11:02:48 +01:00
Stefan Weil
bc69e28de3 Update include statements for external header file allheaders.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-13 10:17:20 +01:00
Stefan Weil
b091b09b4f Fix default value for --enable-doc
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-13 10:05:42 +01:00
Egor Pugin
015504fad4
Merge pull request #3297 from Shreeshrii/autotools
Add basicapitest to daily Github Actions Workflow
2021-02-12 19:07:29 +03:00
Shree Devi Kumar
b2fbd72742 Add basicapitest to daily Github Actions Workflow 2021-02-12 15:46:43 +00:00
Stefan Weil
a20036622e Fix default value for --with-archive and --with-curl
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-11 23:15:35 +01:00
Egor Pugin
7b25f2f8bf
Merge pull request #3292 from stweil/master
Add new configure options --disable-doc, --with-archive and --with-curl
2021-02-11 11:40:27 +03:00
Stefan Weil
ddc36722b2 configure: Sort AC_ARG_WITH to get better help text
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-11 07:25:49 +01:00
Stefan Weil
974e396542 Add configure option --disable-doc (default: check)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-11 07:16:54 +01:00
Stefan Weil
2ba3f69667 Add configure option --with-curl (check for libcurl by default)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-10 22:56:51 +01:00
Stefan Weil
f1b9e326d0 Add configure option --with-archive (check for libarchive by default)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-10 22:56:27 +01:00
Stefan Weil
e6f15621c2 Remove Python training scripts which were moved to tesstrain
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-02-04 14:45:19 +01:00
Shree Devi Kumar
40f3c8d104 Change LATIN_FONTS to use replacement fonts from TeX Gyre collection 2021-02-04 13:51:03 +01:00
Egor Pugin
cefa3e7e7e
Merge pull request #3276 from Shreeshrii/travis
travis: export PKG_CONFIG_PATH for homebrew
2021-02-03 13:42:04 +03:00
Egor Pugin
bff87be625
Merge pull request #3279 from Shreeshrii/master
Add vcpkg build
2021-02-03 13:41:08 +03:00