gasparian / crnn-ocr-lite Goto Github PK
View Code? Open in Web Editor NEWLightweight CRNN for OCR (including handwritten text) with depthwise separable convolutions and spatial transformer module [keras+tf]
Lightweight CRNN for OCR (including handwritten text) with depthwise separable convolutions and spatial transformer module [keras+tf]
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 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
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,
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
.
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'
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 ?
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
AttributeError: 'NoneType' object has no attribute 'astype'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.