TeluguOCR / banti_telugu_ocr

End to end OCR system for Telugu. Based on Convolutional Neural Networks.
Apache License 2.0
49 stars 17 forks source link

When try to run get an error #15

Closed flipmedia closed 7 years ago

flipmedia commented 8 years ago

Dear Team, I installed your system and try to run using command $ python3 recognize.py sample_images/praasa.tif I got error as

Command line Arguments calibration 1 input_file_or_dir sample_images/praasa.tif labels_fname labellings/alphacodes.lbl log_level 20 ngram_fname library/mega.123.pkl nnet_fname library/nn.pkl scaler_fname scalings/relative48.scl

Traceback (most recent call last): File "recognize.py", line 121, in from banti.ocr import OCR File "/home/insight/Downloads/banti_telugu_ocr-master/banti/ocr.py", line 6, in from .classifier import Classifier File "/home/insight/Downloads/banti_telugu_ocr-master/banti/classifier.py", line 5, in from theanet.neuralnet import NeuralNet ImportError: No module named 'theanet'

Please advise What I do to avoid and run the system smooth...

Waiting reply

Thanks Anes

ChillarAnand commented 8 years ago

Looks like you have not installed theanet. Please install all requirements and try again.

flipmedia commented 8 years ago

Dear ChillarAnand, I try to install theanet using command $ sudo pip install theanets

it work fine . But still got the same error. I am using ubuntu 16.10

Waiting your fast reply

Thanks Anes

flipmedia commented 8 years ago

Dear ChiillerAnand, That problem now fixed, but still the system not work as expected ... My output is

insight@Inspiron:~/Downloads/banti_telugu_ocr-master$ sudo python3 recognize.py sample_images/praasa.tif [sudo] password for insight: Command line Arguments calibration 1 input_file_or_dir sample_images/praasa.tif labels_fname labellings/alphacodes.lbl log_level 20 ngram_fname library/mega.123.pkl nnet_fname library/nn.pkl scaler_fname scalings/relative48.scl

/usr/local/lib/python3.5/dist-packages/Theano-0.8.2-py3.5.egg/theano/tensor/signal/downsample.py:6: UserWarning: downsample module has been moved to the theano.tensor.signal.pool module. "downsample module has been moved to the theano.tensor.signal.pool module.") Initializing the OCR Traceback (most recent call last): File "recognize.py", line 128, in args.log_level) File "/home/insight/Downloads/banti_telugu_ocr-master/banti/ocr.py", line 32, in init ProGlyph.classifier = Classifier(nnet_fname, labels_fname, logbase=logbase) File "/home/insight/Downloads/banti_telugu_ocr-master/banti/classifier.py", line 20, in init self.ntwk = NeuralNet(_nnet_prms) File "/home/insight/Downloads/theanet-master/theanet/neuralnet.py", line 98, in init self.append_next_layer() File "/home/insight/Downloads/theanet-master/theanet/neuralnet.py", line 151, in append_next_layer _layer_args) File "/home/insight/Downloads/theanet-master/theanet/layer/convpool.py", line 57, in init border_mode=border_mode) File "/usr/local/lib/python3.5/dist-packages/Theano-0.8.2-py3.5.egg/theano/tensor/nnet/conv.py", line 153, in conv2d return op(input, filters) File "/usr/local/lib/python3.5/dist-packages/Theano-0.8.2-py3.5.egg/theano/gof/op.py", line 611, in call node = self.make_node(_inputs, *_kwargs) File "/usr/local/lib/python3.5/dist-packages/Theano-0.8.2-py3.5.egg/theano/tensor/nnet/conv.py", line 655, in make_node "inputs(%s), kerns(%s)" % (_inputs.dtype, _kerns.dtype)) NotImplementedError: The image and the kernel must have the same type.inputs(float64), kerns(float32)

Please advise where I need to fix

Thanks Anes

ChillarAnand commented 8 years ago
export THEANO_FLAGS='floatX=float32'

Run this command to set flags and re run it.

flipmedia commented 8 years ago

Dear ChillarAnand, I try to run it on Command line like this insight@Inspiron:~$ export THEANO_FLAGS 'floatX=float32 but no effect

Try to run on Python Terminal as

insight@Inspiron:~$ python3 Python 3.5.2 (default, Sep 10 2016, 08:21:44) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.

export THEANO_FLAGS 'floatX=float32 File "", line 1 export THEANO_FLAGS 'floatX=float32 ^ SyntaxError: invalid syntax

I have no idea what you mean to run that command . Please explain

Thanks Anes

ChillarAnand commented 8 years ago

You have to export like this in terminal

$ export THEANO_FLAGS='floatX=float32'

and then run

$ python3 recognize.py sample_images/praasa.tif
flipmedia commented 8 years ago

Hi ChillerAnand, The export command work fine , but later command $ python3 recognize.py sample_images/praasa.tif give output as below:

python3 recognize.py sample_images/praasa.tif Command line Arguments calibration 1 input_file_or_dir sample_images/praasa.tif labels_fname labellings/alphacodes.lbl log_level 20 ngram_fname library/mega.123.pkl nnet_fname library/nn.pkl scaler_fname scalings/relative48.scl

/usr/local/lib/python3.5/dist-packages/Theano-0.8.2-py3.5.egg/theano/tensor/signal/downsample.py:6: UserWarning: downsample module has been moved to the theano.tensor.signal.pool module. "downsample module has been moved to the theano.tensor.signal.pool module.") Initializing the OCR Traceback (most recent call last): File "recognize.py", line 128, in args.log_level) File "/home/insight/Downloads/banti_telugu_ocr-master/banti/ocr.py", line 32, in init ProGlyph.classifier = Classifier(nnet_fname, labels_fname, logbase=logbase) File "/home/insight/Downloads/banti_telugu_ocr-master/banti/classifier.py", line 20, in init self.ntwk = NeuralNet(_nnet_prms) File "/home/insight/Downloads/theanet-master/theanet/neuralnet.py", line 98, in init self.append_next_layer() File "/home/insight/Downloads/theanet-master/theanet/neuralnet.py", line 151, in append_next_layer _layer_args) File "/home/insight/Downloads/theanet-master/theanet/layer/convpool.py", line 57, in init border_mode=border_mode) File "/usr/local/lib/python3.5/dist-packages/Theano-0.8.2-py3.5.egg/theano/tensor/nnet/conv.py", line 153, in conv2d return op(input, filters) File "/usr/local/lib/python3.5/dist-packages/Theano-0.8.2-py3.5.egg/theano/gof/op.py", line 611, in call node = self.make_node(_inputs, *_kwargs) File "/usr/local/lib/python3.5/dist-packages/Theano-0.8.2-py3.5.egg/theano/tensor/nnet/conv.py", line 655, in make_node "inputs(%s), kerns(%s)" % (_inputs.dtype, _kerns.dtype)) NotImplementedError: The image and the kernel must have the same type.inputs(float64), kerns(float32)

Please advise

Thanks Anes

ChillarAnand commented 8 years ago

Are you exportinv variables correctly?

You have to export like this in terminal

$ export THEANO_FLAGS='floatX=float32'

and then run verify them with

$ echo $THEANO_FLAGS

and then run

$ python3 recognize.py sample_images/praasa.tif