Path: blob/master/Model-5/OCR-Evaluator.ipynb
427 views
Kernel: Python 2
Evaluating OCR Models
TODO - Finish abstract class of cycler
In [1]:
Out[1]:
Loading Segmantation model:
INFO:tensorflow:Restoring parameters from models/gap-clas/CNN-CG
INFO:tensorflow:Restoring parameters from models/gap-clas/RNN/Bi-RNN-new
Global Variables
In [2]:
Load Trained Model
In [4]:
Out[4]:
INFO:tensorflow:Restoring parameters from models/char-clas/en/CharClassifier
INFO:tensorflow:Restoring parameters from models/word-clas/en/WordClassifier2
INFO:tensorflow:Restoring parameters from models/word-clas/en/CTC/Classifier2
Load image
In [5]:
Out[5]:
Loading words...
('-> Number of words:', 267)
|****************************************| 100.0%
()
('Number of chars:', 1356)
/Users/Piyush_Jena/ai-saturdays/tf/lib/python2.7/site-packages/unidecode/__init__.py:46: RuntimeWarning: Argument <type 'numpy.string_'> is not an unicode object. Passing an encoded string will likely have unexpected results.
_warn_if_not_unicode(string)
Testing
In [8]:
Out[8]:
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-8-ba806d4a814b> in <module>()
5 for line in f:
6 if LANG == 'en':
----> 7 WORDS[unidecode.unidecode(line.split(" ")[0])] = int(line.split(" ")[1])
8 else:
9 WORDS[line.split(" ")[0]] = int(line.split(" ")[1])
/Users/Piyush_Jena/ai-saturdays/tf/lib/python2.7/site-packages/unidecode/__init__.pyc in unidecode_expect_ascii(string)
46 _warn_if_not_unicode(string)
47 try:
---> 48 bytestring = string.encode('ASCII')
49 except UnicodeEncodeError:
50 return _unidecode(string)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 1: ordinal not in range(128)
Cycler
In [6]:
In [7]:
In [8]:
In [9]:
Out[9]:
STATS: Seq2Seq
spreads : zpasobe
Correct/Total: 626 / 1356
Letter Accuracy: 46.1652 %
Letter Accuracy with Correction: 45.8702 %
Word Accuracy: 21.3483 %
Word Accuracy with Correction: 29.588 %
--- 28.33 seconds ---
STATS: Seq2Seq2CNN
spreads : spreadds
Correct/Total: 830 / 1356
Letter Accuracy: 61.2094 %
Letter Accuracy with Correction: 61.2094 %
Word Accuracy: 28.4644 %
Word Accuracy with Correction: 44.1948 %
--- 43.31 seconds ---
STATS: CTC
spreads : spreads
Correct/Total: 853 / 1356
Letter Accuracy: 62.9056 %
Letter Accuracy with Correction: 67.1091 %
Word Accuracy: 41.1985 %
Word Accuracy with Correction: 56.5543 %
--- 36.54 seconds ---
STATS: Bi-RNN and CNN
spreads : spreads
Correct/Total: 1046 / 1356
Letter Accuracy: 77.1386 %
Letter Accuracy with Correction: 79.2773 %
Word Accuracy: 63.2959 %
Word Accuracy with Correction: 72.2846 %
--- 65.27 seconds ---
<__main__.CharCycler at 0x7f1f01150198>