Giter Club home page Giter Club logo

caltechlibrary / handprint Goto Github PK

View Code? Open in Web Editor NEW
160.0 12.0 17.0 167.91 MB

Apply different text recognition services to images of handwritten documents.

Home Page: https://caltechlibrary.github.io/handprint

License: BSD 3-Clause "New" or "Revised" License

Python 92.09% Makefile 7.04% TeX 0.87%
ocr htr optical-character-recognition machine-learning google-api microsoft-azure library-automation amazon-rekognition amazon-textract python handwritten-text-recognition google-cloud google-vision-api

handprint's Introduction

Handprint

The Handwritten Page Recognition Test is a command-line program that invokes HTR (handwritten text recognition) services on images of document pages. It can produce annotated images showing the results, compare the recognized text to expected text, save the HTR service results as JSON and text files, and more.

Latest release License Python GitHub stars DOI PyPI

Table of Contents

Introduction

Handprint (Handwritten Page Recognition Test) is a tool for comparing alternative services for offline handwritten text recognition (HTR). It was developed for use with documents from the Caltech Archives, but it is completely independent and can be applied to any images of text documents.

Handprint can generate images with recognized text overlaid over them to visualize the results. The image at right shows an example. Among other features, the software can also display bounding boxes, threshold results by confidence values, compare full-text results to expected/ground-truth results, and output the raw results from an HTR service as JSON and text files. It can work with individual images, directories of images, and URLs pointing to images on remote servers. Finally, Handprint can use multiple processor threads for parallel execution.

Services supported include Google's Google Cloud Vision API, Microsoft's Azure Computer Vision API, and Amazon's Textract and Rekognition. The framework for connecting to services could be expanded to support others as well (and contributions are welcome!).

Installation and configuration

The instructions below assume you have a Python interpreter version 3.8 or higher installed on your computer; if that's not the case, please first install Python and familiarize yourself with running Python programs on your system. If you are unsure of which version of Python you have, you can find out by running the following command in a terminal and inspecting the results:

# Note: on Windows, you may have to use "python" instead of "python3"
python3 --version

Note for Mac users: if you are using macOS Catalina (10.15) or later and have never run python3, then the first time you do, macOS will ask you if you want to install the macOS command-line developer tools. Go ahead and do so, as this is the easiest way to get a recent-enough Python 3 on those systems.

Handprint includes several adapters for working with cloud-based HTR services from Amazon, Google, and Microsoft, but does not include credentials for using the services. To be able to use Handprint, you must both install a copy of Handprint on your computer and supply your copy with credentials for accessing the cloud services you want to use. See below for more.

⓵  Install Handprint on your computer

Approach 1: using the standalone Handprint executables

Beginning with version 1.5.1, runnable self-contained single-file executables are available for select operating system and Python version combinations – to use them, you only need a Python 3 interpreter and a copy of Handprint, but do not need to run pip install or other steps. Please click on the relevant heading below to learn more.

macOS macOS

Visit the Handprint releases page and look for the ZIP files with names such as (e.g.) handprint-1.5.4-macos-python3.8.zip. Then:

  1. Download the one matching your version of Python
  2. Unzip the file (if your browser did not automatically unzip it for you)
  3. Open the folder thus created (it will have a name like handprint-1.5.4-macos-python3.8)
  4. Look inside for handprint and move it to a location where you put other command-line programs (e.g., /usr/local/bin)
Linux Linux

Visit the Handprint releases page and look for the ZIP files with names such as (e.g.) handprint-1.5.4-linux-python3.8.zip. Then:

  1. Download the one matching your version of Python
  2. Unzip the file (if your browser did not automatically unzip it for you)
  3. Open the folder thus created (it will have a name like handprint-1.5.4-linux-python3.8)
  4. Look inside for handprint and move it to a location where you put other command-line programs (e.g., /usr/local/bin)
Windows Windows

Standalone executables for Windows are not available at this time. If you are running Windows, please use one of the other methods described below.

Approach 2: using pipx

You can use pipx to install Handprint. Pipx will install it into a separate Python environment that isolates the dependencies needed by Handprint from other Python programs on your system, and yet the resulting handprint command wil be executable from any shell – like any normal application on your computer. If you do not already have pipx on your system, it can be installed in a variety of easy ways and it is best to consult Pipx's installation guide for instructions. Once you have pipx on your system, you can install Handprint with the following command:

pipx install handprint

Pipx can also let you run Handprint directly using pipx run handprint, although in that case, you must always prefix every Handprint command with pipx run. Consult the documentation for pipx run for more information.

Approach 3: using pip

If you prefer, you can install Handprint with pip. If you don't have pip package or are uncertain if you do, please consult the pip installation instructions. Then, to install or upgrade Handprint from the Python package repository, run the following command:

python3 -m pip install handprint --upgrade

⓶  Add cloud service credentials

A one-time configuration step is needed for each cloud-based HTR service after you install Handprint on a computer. This step supplies Handprint with credentials to access the services. In each case, the same command format is used:

handprint -a SERVICENAME CREDENTIALSFILE.json

SERVICENAME must be one of the service names printed by running handprint -l, and CREDENTIALSFILE.json must have one of the formats discussed below. When you run this command, Handprint copies CREDENTIALSFILE.json to a private location, and thereafter uses the credentials to access SERVICENAME. (The private location is different on different systems; for example, on macOS it is ~/Library/Application Support/Handprint/.) Examples are given below.

Microsoft

Microsoft's approach to credentials in Azure involves the use of subscription keys. The format of the credentials file for Handprint needs to contain two fields:

{
 "subscription_key": "YOURKEYHERE",
 "endpoint": "https://ENDPOINT"
}

The value "YOURKEYHERE" will be a string such as "18de248475134eb49ae4a4e94b93461c", and it will be associated with an endpoint URI such as "https://westus.api.cognitive.microsoft.com". To obtain a key and the corresponding endpoint URI, visit https://portal.azure.com and sign in using your account login. (Note: you will need to turn off browser security plugins such as Ad Block and uMatrix if you have them, or else the site will not work.) Once you are authenticated to the Azure portal, you can create credentials for using Azure's machine-learning services. Some notes all about this can be found in the Handprint project Wiki pages on GitHub.

Once you have obtained both a key and an endpoint URI, use a text editor to create a JSON file in the simple format shown above, save that file somewhere on your computer (for the sake of this example, assume it is myazurecredentials.json), and use the command discussed above to make Handprint copy the credentials file:

handprint -a microsoft myazurecredentials.json

Google

Credentials for using a Google service account need to be stored in a JSON file that contains many fields. The overall format looks like this:

{
  "type": "service_account",
  "project_id": "theid",
  "private_key_id": "thekey",
  "private_key": "-----BEGIN PRIVATE KEY-----anotherkey-----END PRIVATE KEY-----\n",
  "client_email": "emailaddress",
  "client_id": "id",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "someurl"
}

Getting one of these is summarized in the Google Cloud docs for Creating a service account, but more explicit instructions can be found in the Handprint project Wiki pages on GitHub. Once you have downloaded a Google credentials file from Google, save the file somewhere on your computer (for the sake of this example, assume it is mygooglecredentials.json), and use the command discussed above to make Handprint copy the credentials file:

handprint -a google mygooglecredentials.json

Amazon

Amazon credentials for AWS take the form of two alphanumeric strings: a key id string and a secret access key string. In addition, the service needs to be invoked with a region identifier. For the purposes of Handprint, these should be stored in a JSON file with the following format:

{
    "aws_access_key_id": "YOUR_KEY_ID_HERE",
    "aws_secret_access_key": "YOUR_ACCESS_KEY_HERE",
    "region_name": "YOUR_REGION_NAME_HERE"
}

Getting this information is, thankfully, a relatively simple process for Amazon's services. Instructions can be found in the Handprint project Wiki pages on GitHub. Once you have obtained the two alphanumeric keys and a region identifier string, use a text editor to create a JSON file in the simple format shown above, save that file somewhere on your computer (for the sake of this example, assume it is myamazoncredentials.json), and use two commands to make Handprint copy the credentials file for the two different Amazon services currently supported by Handprint:

handprint -a amazon-textract myamazoncredentials.json
handprint -a amazon-rekognition myamazoncredentials.json

Usage

Please see the documentation site for detailed documentation for Handprint.

Getting help

If you find an issue, please submit it in the GitHub issue tracker for this repository.

Contributing

I would be happy to receive your help and participation with enhancing Handprint! Please visit the guidelines for contributing for some tips on getting started.

If you plan on doing any development on Handprint, you may want to install the package dependencies listed in requirements-dev.txt, e.g., using a command such as the following. This will install dependencies necessary to run pytest.

python3 -m pip install -r requirements-dev.txt

License

Software produced by the Caltech Library is Copyright © 2018–2022 California Institute of Technology. This software is freely distributed under the BSD 3-clause OSI license. Please see the LICENSE file for more information.

Authors and history

Mike Hucka designed and implemented Handprint beginning in mid-2018.

Acknowledgments

The vector artwork of a hand used as a logo for Handprint was created by Kevin for the Noun Project. It is licensed under the Creative Commons CC-BY 3.0 license.

Handprint benefitted from feedback from several people, notably from Tommy Keswick, Mariella Soprano, Peter Collopy and Stephen Davison.

Handprint makes use of numerous open-source packages, without which it would have been effectively impossible to develop Handprint with the resources we had. I want to acknowledge this debt. In alphabetical order, the packages are:

Finally, I am grateful for computing & institutional resources made available by the California Institute of Technology.

handprint's People

Contributors

dependabot[bot] avatar mhucka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

handprint's Issues

Provide option to produce output in format other than png

From a user comment during a code4lib 2022 presentation today (2022-05-25): the png files produced for the overview images can get quite large, and it may be worth having an option to produce jpg as an alternative. This could be done as a command-line flag for the output format.

Switch to using CommonPy for utilities

A lot of the utilities included directly here have been split off into CommonPy, but this code still contains the original versions. It's probably time to switch to using CommonPy instead of keeping separate versions here.

Sometimes text is overwritten

For reasons that are not clear, sometimes the text output includes multiple words on top of each other. Here's an example:

image

I don't know what's going on here, but this should be fixed.

Empty .txt file for Google when using extended results

The text output .txt file from Google is empty when using -e to get extended results. This seems to be a change (possibly due to changes in Google's API?).

Thanks to Cody Carvel for reporting the problem via email.

shiv-produced binaries should remove old installations

The shiv-generated self-contained runnable Python binaries install Python libraries into the user's ~/.shiv directory. These are tied to the release of a given Handprint executable. Currently, nothing removes them after they are first installed (unless the user knows about it and removes them manually). It is possible to include a preamble where code can be added to do some cleanup, and the shiv documentation includes an example of how.

Future releases of Handprint should do this to avoid bloating users' ~/.shiv.

Resize images on a per-service basis

Currently, when an input image is larger than one of the destination services, Handprint resizes the input image to the max size accepted by any of the destination services. This means that some services might accept a larger image, and might produce different results than when given the (smaller) resized image.

Instead of resizing once, Handprint could treat each service separately and resize only for those that need a smaller image.

CORE REQUIREMENT - OFFLINE USE (No-Cloud and WITHOUT PAYWALL)

Has anyone gotten this to work with LM Studio, Ollama, or any of the other production-quality local LLM servers?

If you have it working and it is available as a Free and Open Source Software (FOSS) package, please reply back to this thread.

Thank you.

Rich Lysakowski, Ph.D.
AI-Local Activator for Off-Cloud Computing

Detect rate limits

At least in the case of Microsoft, it will stop returning answers if you hit a rate limit. Need to detect when that happens and pause or slow down the loop iteration.

Unable to run: RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf

Hi!
I want to try handprint but I'm unable to get it to run.
The command I'm trying to run is

handprint -s google ./
  • Binary version (1.6.0 from the releases page): reports Python too old even tough my python version should be up to date:
python3 --version              
Python 3.10.8
  • pipx version: gives the error above:
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
An error occurred (ImportError): numpy.core.multiarray failed to import
  • pip version, installed via pip install --no-cache-dir --upgrade handprint gives the same error.

Something I'm doing wrong?

Env

OS: Arch Linux (Manjaro)
Python: Python 3.10.8

Python 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.version.version
'1.22.2'
>>> 

Error in 1.5.3 installing service credentials for the first time

Due to having missed updating a call to log in the credentials module, first-time users will hit an error trying to install credentials for a service:

...
 File "/home/parallels/.shiv/handprint_8aaa095b0627e5378d25107a0bc0bd8839387521aad95eafce5ffa5a0e6e18bb/site-packages/handprint/credentials/base.py", line 50, in save_credentials
    if __debug__: log('creating credentials dir: {}.', Credentials.creds_dir)
TypeError: log() takes 1 positional argument but 2 were given

Check if converted file is available before converting images

Currently, the main loop iterates over the available services, and the inner loop iterates over the files to be processed. This means that when images need to be converted from a format like jp2, the inner loop is doing it every time it comes across the file, because it's iterating over the original file (e.g., "foo.jp2") and not checking if a converted version already exists. It should check for converted files so it doesn't have to convert images repeatedly.

Option -G with -e does not produce images

Option -e should leave an image for the results of a given service, named X.handprint-SERVICE.png for SERVICE, but if -G is given as well, then it does not produce the image. This is a clear bug in the logic.

(Thanks to Matt Cook at Harvard for reporting this.)

Warning about starting a Matplotlib GUI outside of the main thread

In Python 3.8.6 (and maybe other versions), with matplotlib 3.3.2 (and maybe other versions), running Handprint now results in a warning:

images.py:219: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.

This is something new and may indicate a deeper problem.

Change output file naming scheme

The current scheme can lead to filename collisions too easily. Need to come up with an alternative. Nothing will be perfect but we should be able to do a little bit better.

Segmentation fault on macOS Mojave

(env) tommasos-mbp:TestHandwriting tommaso$ handprint -s amazon-textract test-1.png
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Welcome to Handprint, the Handwritten page recognition test! ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Will apply 1 service (amazon-textract) to 1 image.
Will use up to 2 process threads.
Starting on test-1.png
Sending to amazon-textract and waiting for response ...
Got result from amazon-textract.
Creating annotated image for amazon-textract.
/Users/tommaso/Documents/Code/CSEM_repos/TestHandwriting/env/lib/python3.7/site-packages/handprint/images.py:218: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
fig, axes = plt.subplots(nrows = 1, ncols = 1, figsize = (20, 20))
2020-08-05 15:02:36.591 Python[2255:77879] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
2020-08-05 15:02:36.623 Python[2255:77879] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff381f8a7d __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff628caa17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff382125d9 -[NSException raise] + 9
3 AppKit 0x00007fff357b85ca -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 317
4 AppKit 0x00007fff357b59f7 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1479
5 AppKit 0x00007fff357b542a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
6 _macosx.cpython-37m-darwin.so 0x0000000116d7cc40 -[Window initWithContentRect:styleMask:backing:defer:withManager:] + 80
7 _macosx.cpython-37m-darwin.so 0x0000000116d808b4 FigureManager_init + 292
8 Python 0x000000010bf1df30 wrap_init + 12
9 Python 0x000000010bee589d wrapperdescr_call + 337
10 Python 0x000000010bedfc46 _PyObject_FastCallKeywords + 358
11 Python 0x000000010bf75322 call_function + 730
12 Python 0x000000010bf6e297 _PyEval_EvalFrameDefault + 6767
13 Python 0x000000010bee01a4 function_code_fastcall + 106
14 Python 0x000000010bee0b17 _PyObject_Call_Prepend + 131
15 Python 0x000000010bf1de9e slot_tp_init + 80
16 Python 0x000000010bf1abca type_call + 172
17 Python 0x000000010bedfc46 _PyObject_FastCallKeywords + 358
18 Python 0x000000010bf75322 call_function + 730
19 Python 0x000000010bf6e297 _PyEval_EvalFrameDefault + 6767
20 Python 0x000000010bee01a4 function_code_fastcall + 106
21 Python 0x000000010bf75329 call_function + 737
22 Python 0x000000010bf6e297 _PyEval_EvalFrameDefault + 6767
23 Python 0x000000010bf75b1d _PyEval_EvalCodeWithName + 1698
24 Python 0x000000010bedfa10 _PyFunction_FastCallDict + 444
25 Python 0x000000010bee0b17 _PyObject_Call_Prepend + 131
26 Python 0x000000010bedfedd PyObject_Call + 136
27 Python 0x000000010bf6e57b _PyEval_EvalFrameDefault + 7507
28 Python 0x000000010bf75b1d _PyEval_EvalCodeWithName + 1698
29 Python 0x000000010bedfa10 _PyFunction_FastCallDict + 444
30 Python 0x000000010bf6e57b _PyEval_EvalFrameDefault + 7507
31 Python 0x000000010bf75b1d _PyEval_EvalCodeWithName + 1698
32 Python 0x000000010bedfa10 _PyFunction_FastCallDict + 444
33 Python 0x000000010bf6e57b _PyEval_EvalFrameDefault + 7507
34 Python 0x000000010bf75b1d _PyEval_EvalCodeWithName + 1698
35 Python 0x000000010bedfa10 _PyFunction_FastCallDict + 444
36 Python 0x000000010bf6e57b _PyEval_EvalFrameDefault + 7507
37 Python 0x000000010bf75b1d _PyEval_EvalCodeWithName + 1698
38 Python 0x000000010bedfd98 _PyFunction_FastCallKeywords + 212
39 Python 0x000000010bf75329 call_function + 737
40 Python 0x000000010bf6e3da _PyEval_EvalFrameDefault + 7090
41 Python 0x000000010bf75b1d _PyEval_EvalCodeWithName + 1698
42 Python 0x000000010bedfd98 _PyFunction_FastCallKeywords + 212
43 Python 0x000000010bf75329 call_function + 737
44 Python 0x000000010bf6e332 _PyEval_EvalFrameDefault + 6922
45 Python 0x000000010bee01a4 function_code_fastcall + 106
46 Python 0x000000010bee0b17 _PyObject_Call_Prepend + 131
47 Python 0x000000010bedfedd PyObject_Call + 136
48 Python 0x000000010bf6e57b _PyEval_EvalFrameDefault + 7507
49 Python 0x000000010bee01a4 function_code_fastcall + 106
50 Python 0x000000010bf75329 call_function + 737
51 Python 0x000000010bf6e27e _PyEval_EvalFrameDefault + 6742
52 Python 0x000000010bee01a4 function_code_fastcall + 106
53 Python 0x000000010bf6e57b _PyEval_EvalFrameDefault + 7507
54 Python 0x000000010bee01a4 function_code_fastcall + 106
55 Python 0x000000010bf75329 call_function + 737
56 Python 0x000000010bf6e27e _PyEval_EvalFrameDefault + 6742
57 Python 0x000000010bee01a4 function_code_fastcall + 106
58 Python 0x000000010bf75329 call_function + 737
59 Python 0x000000010bf6e27e _PyEval_EvalFrameDefault + 6742
60 Python 0x000000010bee01a4 function_code_fastcall + 106
61 Python 0x000000010bee0b17 _PyObject_Call_Prepend + 131
62 Python 0x000000010bedfedd PyObject_Call + 136
63 Python 0x000000010bfdbd01 t_bootstrap + 71
64 Python 0x000000010bfa30be pythread_wrapper + 25
65 libsystem_pthread.dylib 0x00007fff6428c2eb _pthread_body + 126
66 libsystem_pthread.dylib 0x00007fff6428f249 _pthread_start + 66
67 libsystem_pthread.dylib 0x00007fff6428b40d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

Use in google colab?

Thanks for making this code public! I am trying to use it in google colab, but after the pip installation in colab I receive dependency warnings. When I then try to run

!handprint -l

I get the error message:

Traceback (most recent call last):
  File "/usr/local/bin/handprint", line 5, in <module>
    from handprint.__main__ import console_scripts_main
  File "/usr/local/lib/python3.7/dist-packages/handprint/__main__.py", line 46, in <module>
    from sidetrack import set_debug, log, logr
ImportError: cannot import name 'logr' from 'sidetrack' (/usr/local/lib/python3.7/dist-packages/sidetrack/__init__.py)

A similar error message appears when I try !python3 -m handprint -h.

So is there a way to run handprint on google colab? Is there some explanatory colab notebook available? Am I missing maybe some installation/initialization steps? Do you plan to make handprint also workable for colab? Thanks

protobuf version error

I got the following error running handprint when I tried to use it (running with -l and adding credentials did not trigger).

The error displayed after this line of output:

Sending to google and waiting for response ...

In case it matters or helps, I ran handprint with -s google to only run against google because I haven't set up credentials for the other services yet.

 An error occurred (TypeError): Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated
with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and
will be much slower).

More information:
https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

I checked the installed version of protobuf package, and then downgraded.

% pip freeze | grep protobuf
protobuf==4.21.3
% pip install "protobuf<=3.20"

Downgrading resolved the error.

JOSS review - paper / state of the field

As far as I can tell there is no review of the "state of the field" in the paper. Or do no other, somewhat similar tools exist? Alternatively, you could also compare to existing solutions / use of the services without tools.
And, not totally sure, but a lot of the usage description might be better relegated to the Readme or documentation, which the paper is not supposed to be I think.

Keep going after errors involving a file

If something goes wrong like file conversion fails or a service complains that a file is too large, Handprint currently stops running altogether. It should go on to the next file or URL.

Trying to use on a folder with multiple subfolders, each of the folders contains one image

I am using this:

!handprint /s google ./save/

and getting this:

+-----------------------------------------------------------------------------+
| Welcome to Handprint: HANDwritten Page RecognitIoN Test |
+-----------------------------------------------------------------------------+
Given 10 images to work on.
Will apply results of 1 service: google
Will use credentials stored in
C:\Users\sdunomir\AppData\Local\CaltechLibrary\Handprint/.
Will use up to 1 process threads.

Traceback (most recent call last):
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\runpy.py", line 194, in run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\sdunomir\finished assignments for ML\handprint.exe_main
.py", line 7, in
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\handprint_main
.py", line 585, in console_scripts_main
plac.call(main)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\plac_core.py", line 436, in call
cmd, result = parser.consume(arglist)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\plac_core.py", line 287, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\handprint_main
.py", line 550, in main
alert_fatal(f'An error occurred ({ex_class.name}): {antiformat(str(ex))}')
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\bun\ui.py", line 101, in alert_fatal
ui.alert_fatal(text, *args, **kwargs)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\bun\cli.py", line 166, in alert_fatal
self._print_or_queue(text.format(*args), style = 'fatal')
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\bun\cli.py", line 127, in _print_or_queue
self._console.print(text, style = style, highlight = False)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\rich\console.py", line 1655, in print
self._buffer.extend(new_segments)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\rich\console.py", line 854, in exit
self._exit_buffer()
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\rich\console.py", line 812, in _exit_buffer
self._check_buffer()
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\rich\console.py", line 1960, in _check_buffer
legacy_windows_render(
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\rich_windows_renderer.py", line 17, in legacy_windows_render
term.write_styled(text, style)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\rich_win32_console.py", line 418, in write_styled
self.write_text(text)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\site-packages\rich_win32_console.py", line 379, in write_text
self.write(text)
File "C:\Users\sdunomir\Miniconda3\envs\tf2\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-78: character maps to

It seems like all the images are recognized, but them something seems to break...
Thanks in advance

JOSS Paper - Documentation - Example usage

Hi, I think ideally you could add exmaple usage instructions also to the wiki. This would be easier for users, so after the installation part they could directly test something, without looking for the documentation site. (maybe even directly with an image from the tests or other freely available image so that users can test without having their data at the ready)

JOSS review — readme should include statement of need & audience

per JOSS review checklist, the documentation in your readme should include:

A statement of need: Do the authors clearly state what problems the software is designed to solve and who the target audience is?

You can probably adapt the second paragraph from the statement of need in your JOSS paper.

Also, in both places I think you should clarify audience — you say in the paper that people can use handprint without writing any code, but it seems like people will still need to be fairly technical to get this set up and configured.

python -m pip issue

Dear Mike:
Thanks for such a great piece of software. I discovered it a few weeks ago, and I am using it to dump (tentatively, roughly) microfilms from familysearch.org to text, that have not yet been indexed (maybe never).
Thanks to the program of you can save months of turning the page trying to read old writing trying to find a last name.
I do not know if it corresponds, but I comment that the 1st time when trying to install, as the documentation indicates:

python3 -m pip install [email protected]:caltechlibrary/handprint.git --user --upgrade

I got the following error.
"ERROR: Invalid requirement: '[email protected]:caltechlibrary/handprint.git'
Hint: It looks like a path. File '[email protected]:caltechlibrary/handprint.git' does not exist."

In my case it does work:
python -m pip install -e git+https://github.com/caltechlibrary/handprint.git@master#egg=handprint --user --upgrade

, with:
git version 2.25.1
Python 3.8.1
pip 19.3.1

Again thank you very much!
Cheers!

Do error checking on intermediate dictionary values

In the case of results that involve nested dictionaries, it looks like we can't get away from testing that intermediate values exist. For example, around line 62 of handprint/htr/google.py, the code

return self._results[path]['document_text_detection']['fullTextAnnotation']['text']

it seems it can happen that fullTextAnnotation doesn't exist.

Credentials files are not saved in expected format on Windows

The credentials files are copied to C:\Users<username>\AppData\Local\Handprint\Handprint but are not renamed to the filenames expected for credentials. Once the files are renamed to amazon_credentials.json or microsoft_credentials.json and readded using /a commands will run properly.

Tested with AWS and Microsoft credentials, but I believe this is caused by the process used to copy credentials and not the individual service credential classes.

Only confirmed on Windows.

'handprint/methods' does not exist

While installing on Windows getting error:
D:\OCR\handprint-0.10.0\handprint-0.10.0>py -m pip install . --upgrade
Processing d:\ocr\handprint-0.10.0\handprint-0.10.0
ERROR: Complete output from command python setup.py egg_info:
ERROR: running egg_info
creating pip-egg-info\handprint.egg-info
writing pip-egg-info\handprint.egg-info\PKG-INFO
writing dependency_links to pip-egg-info\handprint.egg-info\dependency_links.txt
writing requirements to pip-egg-info\handprint.egg-info\requires.txt
writing top-level names to pip-egg-info\handprint.egg-info\top_level.txt
writing manifest file 'pip-egg-info\handprint.egg-info\SOURCES.txt'
error: package directory 'handprint/methods' does not exist
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-req-build-kebkz6bp
WARNING: You are using pip version 19.1.1, however version 19.2.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Resize large files to smaller size

If a file exceeds the file size threshold for a service, Handprint should rescale it down to a sufficiently small size so that it can be sent to the service.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.