Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_LSTM_choices fails #214

Closed
pgajdos opened this issue Jan 13, 2020 · 4 comments
Closed

test_LSTM_choices fails #214

pgajdos opened this issue Jan 13, 2020 · 4 comments

Comments

@pgajdos
Copy link

pgajdos commented Jan 13, 2020

Hi, I get one failure in the testsuite run:

[   61s] =================================== FAILURES ===================================
[   61s] ______________________ TestTessBaseApi.test_LSTM_choices _______________________
[   61s] 
[   61s] self = <tests.test_api.TestTessBaseApi testMethod=test_LSTM_choices>
[   61s] 
[   61s]     @unittest.skipIf(_TESSERACT_VERSION < 0x4000000, "tesseract < 4")
[   61s]     def test_LSTM_choices(self):
[   61s]         """Test GetBestLSTMSymbolChoices."""
[   61s]         self._api.SetVariable("lstm_choice_mode", "2")
[   61s]         self._api.SetImageFile(self._image_file)
[   61s]         self._api.Recognize()
[   61s]         LSTM_choices = self._api.GetBestLSTMSymbolChoices()
[   61s]         words = self._api.AllWords()
[   61s]         self.assertEqual(len(words), len(LSTM_choices))
[   61s]     
[   61s]         for choice, word in zip(LSTM_choices, words):
[   61s]             chosen_word = ""
[   61s]             for timestep in choice:
[   61s]                 for alternative in timestep:
[   61s]                     self.assertGreaterEqual(alternative[1], 0.0)
[   61s]                     self.assertLessEqual(alternative[1], 2.0)
[   61s]                 chosen_symbol = timestep[0][0]
[   61s]                 if chosen_symbol != " ":
[   61s]                     chosen_word += chosen_symbol
[   61s] >           self.assertEqual(chosen_word, word)
[   61s] E           AssertionError: '' != 'The'
[   61s] E           + The
[   61s] 
[   61s] tests/test_api.py:200: AssertionError
[   61s] ======================== 1 failed, 23 passed in 12.23s =========================

linux, x86_64
python 3.7.3
tesseract-ocr-4.1.1

@sirfz
Copy link
Owner

sirfz commented Jan 13, 2020

It's possibly failing because of the language files you're using as this is not failing in the CI pipeline.

@pgajdos
Copy link
Author

pgajdos commented Jan 14, 2020

Apologize, I do not know what you mean by language files, could you please elaborate?

I just went around and noticed that this module is not building for us for a long time:
https://build.opensuse.org/package/show/home:pgajdos/python-tesserocr
On the right side, you can see that the same sources are building for openSUSE 15.1 but are not for openSUSE:Tumbleweed (rolling distro with newest versions). So yes, something changed under the hood. After clicking on 'failed' or 'succeded' you can see the full build log including package versions which get installed.

So either I will turn the test off for now if you recommend it or I can try to debug for which I would need your further assistance.

@kba
Copy link

kba commented Jan 14, 2020

@pgajdos Have a look at the travis config file at https://github.com/sirfz/tesserocr/blob/master/.travis.yml The before_install section lists how the CI is setup and which osd/eng tesseract models are used. Can you try to install these models locally and see if the error persists?

@pgajdos
Copy link
Author

pgajdos commented Jan 21, 2020

Hmm, yes, with the latest eng.traineddata the test passes.

@sirfz sirfz closed this as completed Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants