Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
Pannous committed Jan 10, 2019
1 parent b62317c commit e5ec6ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Binary file modified test_image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions text_recognizer.py
Expand Up @@ -7,13 +7,12 @@
from keras.models import load_model
from PIL import Image # python -m pip install --upgrade Pillow # WTF

weight_file = None # use model weights
# weight_file = 'best_weights.h5'
# weight_file = 'current_weights.h5'

weight_file = 'weights_ascii.h5' # learned on noisy data
# weight_file = 'weights_ascii_easy.h5' # no freckles
# weight_file = 'weights_ascii_clean.h5' # pure text
# weight_file = None # use model weights
# weight_file = 'weights_ascii.h5' # learned on noisy data
weight_file = 'weights_ascii_easy.h5' # no freckles
# weight_file = 'weights_ascii_clean.h5' # pure text, no rotation etc

chars = u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜß0123456789!@#$%^&*()[]{}-_=+\\|"\'`;:/.,?><~ '

Expand All @@ -25,7 +24,8 @@ def init_model(model_file="current_model.h5"):
global model
model = load_model(model_file)
model.summary()
model.load_weights(weight_file, reshape=True, by_name=True)
if weight_file:
model.load_weights(weight_file, reshape=True, by_name=True)

def predict_tensor(tensor):
if len(tensor.shape) == 2:
Expand Down

0 comments on commit e5ec6ac

Please sign in to comment.