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

regression: no model for tags type=default #564

Closed
bertsky opened this issue Jan 17, 2024 · 3 comments
Closed

regression: no model for tags type=default #564

bertsky opened this issue Jan 17, 2024 · 3 comments

Comments

@bertsky
Copy link

bertsky commented Jan 17, 2024

In trying to reproduce #525, I encountered this:

kraken --input 1694884104_0010.jpg 1694884104_0010.txt segment --baseline ocr --model $XDG_DATA_HOME/ocrd-resources/ocrd-kraken-recognize/austriannewspapers.mlmodel
Loading ANN /data/ocr-d/kraken/kraken/blla.mlmodel	✓
Loading ANN /data/ocr-d/ocrd_all/venv38/share/ocrd-resources/ocrd-kraken-recognize/austriannewspapers.mlmodel	✓
Segmenting	✓
Processing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% 0/81 -:--:-- 0:00:00
[01/17/24 11:27:07] ERROR    Failed processing 1694884104_0010.jpg: No model for tags {'type': 'default'}                       kraken.py:426

Looks like the cause is somewhere in 8ff27d1.

@bertsky
Copy link
Author

bertsky commented Jan 17, 2024

But if I switch the branching of the conditional:

--- a/kraken/rpred.py
+++ b/kraken/rpred.py
@@ -336,10 +336,10 @@ def _resolve_tags_to_model(tags: Optional[Sequence[Dict[str, str]]],
     """
     if not tags and default:
         return ('type', 'default'), default
+    elif tags and default:
+        return next(tags.values()), default
     elif tags:
         for tag in tags.items():
             if tag in model_map:
                 return tag, model_map[tag]
-    elif tags and default:
-        return next(tags.values()), default
     raise KrakenInputException(f'No model for tags {tags}')

then I get

'dict_values' object is not an iterator

so the moved line also needs an extra iter(...).

But then, still, I get lots of segmentation errors:

Tensor conversion failed with 'default'. Emitting empty record.

and the text result is empty.

@bertsky
Copy link
Author

bertsky commented Jan 17, 2024

thx!

@mittagessen
Copy link
Owner

mittagessen commented Jan 17, 2024 via email

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