Giter VIP home page Giter VIP logo

gasparian / crnn-ocr-lite Goto Github PK

View Code? Open in Web Editor NEW
146.0 146.0 30.0 139.47 MB

Lightweight CRNN for OCR (including handwritten text) with depthwise separable convolutions and spatial transformer module [keras+tf]

Python 93.28% Dockerfile 6.72%
crnn crnn-ocr ctc-loss handwritten-character-recognition handwritten-text-recognition keras-tensorflow lstm mobilenet ocr spatial-transformer-network stn

crnn-ocr-lite's People

Contributors

gasparian 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

crnn-ocr-lite's Issues

Predict.py runtime error

Hi ,

I'm getting the below error while running the predict function.

(User) C:\Jagadesh\529\CRNN_OCR_lite>python predict.py --G 0 --model_path C:\Jagadesh\529\CRNN_OCR_lite\models\OCR_IAM_ver1 --image_path C:\Jagadesh\529\CRNN_OCR_lite\input --result_path C:\Jagadesh\529\CRNN_OCR_lite\output
Using TensorFlow backend.
WARNING:tensorflow:From C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
2019-05-08 16:06:16.317501: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
WARNING:tensorflow:From C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\keras\backend\tensorflow_backend.py:3368: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob.
Traceback (most recent call last):
File "predict.py", line 105, in
model = load_custom_model(model_path, model_name='/model.json', weights="/final_weights.h5")
File "C:\Jagadesh\529\CRNN_OCR_lite\utils.py", line 327, in load_custom_model
model = model_from_json(loaded_model_json, custom_objects={'BilinearInterpolation': BilinearInterpolation})
File "C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\keras\engine\saving.py", line 368, in model_from_json
return deserialize(config, custom_objects=custom_objects)
File "C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\keras\layers_init_.py", line 55, in deserialize
printable_module_name='layer')
File "C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\keras\utils\generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\keras\engine\network.py", line 1027, in from_config
process_node(layer, node_data)
File "C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\keras\engine\network.py", line 986, in process_node
layer(unpack_singleton(input_tensors), **kwargs)
File "C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\keras\engine\base_layer.py", line 457, in call
output = self.call(inputs, **kwargs)
File "C:\Users\jsiriso\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\keras\layers\core.py", line 682, in call
return self.function(inputs, **arguments)
File "/data/data/CRNN_OCR_keras/utils.py", line 99, in ctc_lambda_func
IndexError: tuple index out of range

getting error while using own trained model.

getting error while running predict.py on our own trained model. used same version of python while training and predicting but getting unknown op code error. Thanks in Advance.

XXX lineno: 99, opcode: 47 Traceback (most recent call last): File "predict.py", line 115, in <module> model = load_custom_model(model_path, model_name='model.json', weights="final_weights.h5") File "C:\DivyanshuWorkspace\Code\PoA_switzerland\github\CRNN-OCR-lite-master\CRNN-OCR-lite-master\utils.py", line 327, in load_custom_model model = model_from_json(loaded_model_json, custom_objects={'BilinearInterpolation': BilinearInterpolation}) File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\saving\model_config.py", line 122, in model_from_json return deserialize(config, custom_objects=custom_objects) File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 175, in deserialize printable_module_name='layer') File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 358, in deserialize_keras_object list(custom_objects.items()))) File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 617, in from_config config, custom_objects) File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 1214, in reconstruct_from_config process_node(layer, node_data) File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 1162, in process_node output_tensors = layer(input_tensors, **kwargs) File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 926, in __call__ input_list) File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1117, in _functional_construction_call outputs = call_fn(cast_inputs, *args, **kwargs) File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\layers\core.py", line 903, in call result = self.function(inputs, **kwargs) File "C:/DivyanshuWorkspace/Code/PoA_switzerland/github/CRNN-OCR-lite-master/CRNN-OCR-lite-master/utils.py", line 99, in ctc_lambda_func y_pred, labels, input_length, label_length = args SystemError: unknown opcode

sharing coreMl

Hello,

Thanks for sharing your code, I have run your code I was wondering do you have Coreml model so we can run it on ios?
I tried to convert but as you have BilinearInterpolation layer, it complains that it is unknown.
Do you have any idea how could I convert it or if you have the coreml model do you mind to share it?

thanks,

runtime error in predict.py

while running the predict.py getting error at line 106 predict.py model = load_custom_model(model_path, model_name='model.json', weights="final_weights.h5") . error is menioned below:

Traceback (most recent call last):
File "predict.py", line 114, in
model = load_custom_model(model_path, model_name='model.json', weights="final_weights.h5")
File "C:\DivyanshuWorkspace\Code\PoA_switzerland\github\CRNN-OCR-lite-master\CRNN-OCR-lite-master\utils.py", line 327, in load_custom_model
model = model_from_json(loaded_model_json, custom_objects={'BilinearInterpolation': BilinearInterpolation})
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\saving\model_config.py", line 122, in model_from_json
return deserialize(config, custom_objects=custom_objects)
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 175, in deserialize
printable_module_name='layer')
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 358, in deserialize_keras_object
list(custom_objects.items())))
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\training.py", line 2239, in from_config
config, custom_objects=custom_objects)
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 617, in from_config
config, custom_objects)
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 1214, in reconstruct_from_config
process_node(layer, node_data)
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 1162, in process_node
output_tensors = layer(input_tensors, **kwargs)
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 926, in call
input_list)
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1098, in _functional_construction_call
self._maybe_build(inputs)
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2643, in _maybe_build
self.build(input_shapes) # pylint:disable=not-callable
File "C:\Users\Divyanshu.Singhi\Anaconda3\lib\site-packages\tensorflow\python\keras\layers\convolutional.py", line 2337, in
build
raise ValueError('The channel dimension of the inputs to '
ValueError: The channel dimension of the inputs to DepthwiseConv2D should be defined. Found None.

Predict.py runtime error

getting below error while running the code.

Using TensorFlow backend.
Traceback (most recent call last):
File "predict.py", line 82, in
from utils import init_predictor, DecodeCTCPred, Readf, edit_distance, normalized_edit_distance,
File "C:\E_Drive\Data Science\Projects\529 Payments\codes\CRNN_OCR_lite\utils.py", line 16, in
from keras.layers import Conv2D, MaxPooling2D, Activation, Dropout, add,
ImportError: cannot import name 'ReLU'

Can it run on multiple words in wild ?

Hi,

I am trying to execute the code on my custom data which are handwritten images in the wild.
python predict.py --G 0 --model_path ./models\OCR_mjsynth_FULL_2 --image_path ./imgs/pages/ --result_path ./
Do we require the image to be constraint to one word ?

predict.py run time error

run predict.py
without option of --validate
python3 predict.py --G 0 --model_path /data/data/CRNN_OCR_keras/data/OCR_IAM_ver1
--image_path /data/data/CRNN_OCR_keras/data/IAM_processed
--num_instances 128

has three errors

  1. not found: set_offset_monochrome
  2. not found: padd
  3. img = cv2.cvtColor(img.astype(np.uint8), cv2.COLOR_BGR2GRAY)

AttributeError: 'NoneType' object has no attribute 'astype'

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.