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

OCR for some images fails with 'Delaunay' object has no attribute 'vertices' #525

Closed
stweil opened this issue Jun 30, 2023 · 4 comments
Closed

Comments

@stweil
Copy link
Contributor

stweil commented Jun 30, 2023

Kraken fails on several images of one of our publications, for example on physical page 10:

(venv3.10) stweil@ocr-02:~/ocr$ kraken --input 1694884104_0010.jpg 1694884104_0010.txt segment --baseline ocr --model austriannewspapers.mlmodel
scikit-learn version 1.2.2 is not supported. Minimum required version: 0.17. Maximum required version: 1.1.2. Disabling scikit-learn conversion API.
Loading ANN /home/stweil/ocr/venv3.10/lib/python3.10/site-packages/kraken/blla.mlmodel	✓
Loading ANN austriannewspapers.mlmodel	✓
Segmenting	✓
Processing ━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   4% 3/81 0:00:45 0:00:02
[06/30/23 22:13:28] ERROR    Failed processing 1694884104_0010.jpg: 'Delaunay' object has no attribute 'vertices'                                                                                   kraken.py:418

The same error also occurs with other OCR models.

It can also be reproduced with Python 3.11 and newer Torch (requires pull request #518):

(venv3.11) stweil@ocr-02:~/ocr$ kraken --input 1694884104_0010.jpg 1694884104_0010.txt segment --baseline ocr --model austriannewspapers.mlmodel
scikit-learn version 1.2.2 is not supported. Minimum required version: 0.17. Maximum required version: 1.1.2. Disabling scikit-learn conversion API.
Torch version 2.0.1+cu117 has not been tested with coremltools. You may run into unexpected errors. Torch 2.0.0 is the most recent version that has been tested.
Loading ANN /home/stweil/ocr/venv3.11/lib/python3.11/site-packages/kraken/blla.mlmodel	✓
Loading ANN austriannewspapers.mlmodel	✓
Segmenting	✓
Processing ━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   4% 3/81 0:00:35 0:00:01
[06/30/23 22:30:12] ERROR    Failed processing 1694884104_0010.jpg: 'Delaunay' object has no attribute 'vertices'                                                                                   kraken.py:418
@stweil stweil changed the title Error 'Delaunay' object has no attribute 'vertices' when running OCR for some images OCR for some images fails with 'Delaunay' object has no attribute 'vertices' Jun 30, 2023
@stweil
Copy link
Contributor Author

stweil commented Jun 30, 2023

Downgrading from scipy-1.11.1 to scipy-1.10.1 helps:

(venv3.11) stweil@ocr-02:~/ocr$ kraken --input 1694884104_0010.jpg 1694884104_0010.txt segment --baseline ocr --model austriannewspapers.mlmodel
scikit-learn version 1.2.2 is not supported. Minimum required version: 0.17. Maximum required version: 1.1.2. Disabling scikit-learn conversion API.
Torch version 2.0.1+cu117 has not been tested with coremltools. You may run into unexpected errors. Torch 2.0.0 is the most recent version that has been tested.
Loading ANN /home/stweil/ocr/venv3.11/lib/python3.11/site-packages/kraken/blla.mlmodel	✓
Loading ANN austriannewspapers.mlmodel	✓
Segmenting	✓
Processing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 81/81 0:00:00 0:00:15
Writing recognition results for 1694884104_0010.jpg	✓

@stweil
Copy link
Contributor Author

stweil commented Jul 19, 2023

@mittagessen
Copy link
Owner

Arrgh, sorry. I've tagged a new release (4.3.13) containing a pinned scipy as a hotfix. I'll have a look on the actual reason tomorrow.

@mittagessen
Copy link
Owner

It's a regression in scikit-image. It is fixed in their latest release but they don't pin their requirements so it's easy to have something like this slip through.

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

2 participants