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

Only one model in the repository? #237

Closed
jsbien opened this issue Jan 23, 2021 · 16 comments
Closed

Only one model in the repository? #237

jsbien opened this issue Jan 23, 2021 · 16 comments

Comments

@jsbien
Copy link

jsbien commented Jan 23, 2021

I just installed kraken and kraken list gives only
10.5281/zenodo.2577813 (pytorch) - A generalized model for English printed text.
Where are other models? I'm especially interested in Medieval Latin.

@kba
Copy link
Contributor

kba commented Jan 25, 2021

For Arabic there is https:/OpenITI/OCR_GS_Data, there is the legacy https:/mittagessen/kraken-models and there are various older pronn models listed in https://data.bib.uni-mannheim.de/ocr-models/ (data was gathered ~2017 though).

@pontelneptique shared a Latin mlmodel here: mittagessen/kraken-models#5

@jsbien
Copy link
Author

jsbien commented Jan 25, 2021

Thanks.
However for @PonteIneptique's model I see
This commit does not belong to any branch on this repository.
I've cloned the repository but I don't see the model there.
Moreover I don't know how to use a model which is not listed by 'kraken list' :-(

@mittagessen
Copy link
Owner

mittagessen commented Jan 25, 2021 via email

@jsbien
Copy link
Author

jsbien commented Jan 25, 2021

Thanks again.
Please note that kraken --help doesn't show -m option. What should I consult to avoid asking elementary questions?

@kba
Copy link
Contributor

kba commented Jan 25, 2021

You can see the definition of the CLI in kraken/kraken.py, i.e. those lines that start with @click.option, @click.argument etc.

@kba
Copy link
Contributor

kba commented Jan 25, 2021

I've cloned the repository but I don't see the model there.

Go to https:/mittagessen/kraken-models/blob/ec4407159e19d0df6e366038f262b4f5a8bbb12a/mlmodel/latin-teubner/latin-teubner.mlmodel and click "Download"

@mittagessen
Copy link
Owner

mittagessen commented Jan 25, 2021 via email

@jsbien jsbien closed this as completed Jan 25, 2021
@jsbien
Copy link
Author

jsbien commented Jan 25, 2021

Thank you very much!

@FergusJPWalsh
Copy link

Hi, I'm having real trouble understanding the documentation and parts of this thread.
Can you please tell me what the command would be to install a custom model from a Github repo?
If I can just download the file and put it in the Kraken directory, then which directory and where?
I'm using Linux (Ubuntu) and have Kraken installed.
Thank you.

@mittagessen
Copy link
Owner

mittagessen commented Aug 6, 2021 via email

@FergusJPWalsh
Copy link

I have tried using the -m option, and am still having no luck. I have the following models downloaded on my PC and I am also trying to get one from GitHub.

Please advise on exactly which commands I should use.

I appreciate your help.

kraken -m get model_grc_catlips.mlmodel
Usage: kraken [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...
Try "kraken --help" for help.

Error: no such option: -m
kraken get -m rahlfs-2014-05-26-19-05-00100000.pyrnn.pronn
Usage: kraken get [OPTIONS] MODEL_ID
Try "kraken get --help" for help.

Error: no such option: -m
kraken get rahlfs-2014-05-26-19-05-00100000.pyrnn.pronn
Retrieving model .[1.0987] Found 0 models when querying for id 'rahlfs-2014-05-26-19-05-00100000.pyrnn.pronn' 
Traceback (most recent call last):
  File "/home/fergus/.local/bin/kraken", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1163, in invoke
    rv.append(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/fergus/.local/lib/python3.8/site-packages/kraken/kraken.py", line 619, in get
    filename = repo.get_model(model_id, click.get_app_dir(APP_NAME),
  File "/home/fergus/.local/lib/python3.8/site-packages/kraken/repo.py", line 118, in get_model
    raise KrakenRepoException(f'Found {resp["hits"]["total"]} models when querying for id \'{model_id}\'')
kraken.lib.exceptions.KrakenRepoException: Found 0 models when querying for id 'rahlfs-2014-05-26-19-05-00100000.pyrnn.pronn'

@kba
Copy link
Contributor

kba commented Aug 10, 2021

@FergusJPWalsh If you already have the models downloaded, you don't need to call kraken get. Also -m is an option to the ocr command and should be the path to the model to use. See kraken ocr --help.

@FergusJPWalsh
Copy link

But when I call list I only get the English model

kraken list
Retrieving model list .✓
10.5281/zenodo.2577813 (pytorch) - A generalized model for English printed text

@FergusJPWalsh
Copy link

Could I ask that the whole process of installing a new model be explained to me, step by step and with the appropriate commands?
If so, I would be very grateful.

@kba
Copy link
Contributor

kba commented Aug 10, 2021

kraken list will only show the models in the repository, not your downloaded models.

Let's say yout want to process foo.png with https:/pharos-alexandria/ocr-greek_cursive/raw/master/kraken-models/model_grc_savile.mlmodel:

wget https:/pharos-alexandria/ocr-greek_cursive/raw/master/kraken-models/model_grc_savile.mlmodel
kraken -i foo.png binarize segment -bl ocr -m model_grc_savile.mlmodel

This will download the model and run binarization, segment and ocr with kraken.

@FergusJPWalsh
Copy link

Thank you so much. That's been a great help.

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

4 participants