A New OCR System Similar to ASR System

Similar documents
SYMBOL RECOGNITION IN HANDWRITTEN MATHEMATI- CAL FORMULAS

Hidden Markov Modelling

Hidden Markov Model and Speech Recognition

Shankar Shivappa University of California, San Diego April 26, CSE 254 Seminar in learning algorithms

Hidden Markov Models The three basic HMM problems (note: change in notation) Mitch Marcus CSE 391

Hidden Markov Models and Gaussian Mixture Models

STA 414/2104: Machine Learning

University of Cambridge. MPhil in Computer Speech Text & Internet Technology. Module: Speech Processing II. Lecture 2: Hidden Markov Models I

HIDDEN MARKOV MODELS IN SPEECH RECOGNITION

Hidden Markov Models Hamid R. Rabiee

Computational Genomics and Molecular Biology, Fall

Introduction to Markov systems

ISOLATED WORD RECOGNITION FOR ENGLISH LANGUAGE USING LPC,VQ AND HMM

OFF-LINE HANDWRITTEN WORD RECOGNITION USING HIDDEN MARKOV MODELS

10. Hidden Markov Models (HMM) for Speech Processing. (some slides taken from Glass and Zue course)

An Introduction to Bioinformatics Algorithms Hidden Markov Models

Hidden Markov Models and Gaussian Mixture Models

1. Markov models. 1.1 Markov-chain

Hidden Markov Models

Statistical Sequence Recognition and Training: An Introduction to HMMs

STA 4273H: Statistical Machine Learning

Hidden Markov Models

Hidden Markov Models

Parametric Models Part III: Hidden Markov Models

CS 136a Lecture 7 Speech Recognition Architecture: Training models with the Forward backward algorithm

Math 350: An exploration of HMMs through doodles.

Statistical Processing of Natural Language

Statistical NLP: Hidden Markov Models. Updated 12/15

O 3 O 4 O 5. q 3. q 4. Transition

Lecture 3: ASR: HMMs, Forward, Viterbi

L23: hidden Markov models

Hidden Markov Models and other Finite State Automata for Sequence Processing

CISC 889 Bioinformatics (Spring 2004) Hidden Markov Models (II)

On Optimal Coding of Hidden Markov Sources

Speech and Language Processing. Chapter 9 of SLP Automatic Speech Recognition (II)

A Revealing Introduction to Hidden Markov Models

Improving the Multi-Stack Decoding Algorithm in a Segment-based Speech Recognizer

Brief Introduction of Machine Learning Techniques for Content Analysis

Reformulating the HMM as a trajectory model by imposing explicit relationship between static and dynamic features

Novel VQ Designs for Discrete HMM On-Line Handwritten Whiteboard Note Recognition

Temporal Modeling and Basic Speech Recognition

Jorge Silva and Shrikanth Narayanan, Senior Member, IEEE. 1 is the probability measure induced by the probability density function

An Evolutionary Programming Based Algorithm for HMM training

Introduction to Machine Learning CMU-10701

order is number of previous outputs

Pairwise Neural Network Classifiers with Probabilistic Outputs

Substroke Approach to HMM-based On-line Kanji Handwriting Recognition

Hidden Markov Models

Hidden Markov Models. By Parisa Abedi. Slides courtesy: Eric Xing

Feature Extraction Using Zernike Moments

Human-Oriented Robotics. Temporal Reasoning. Kai Arras Social Robotics Lab, University of Freiburg

An Introduction to Hidden

Hidden Markov Models NIKOLAY YAKOVETS

Engineering Part IIB: Module 4F11 Speech and Language Processing Lectures 4/5 : Speech Recognition Basics

Design and Implementation of Speech Recognition Systems

Hidden Markov Models. Dr. Naomi Harte

Human Mobility Pattern Prediction Algorithm using Mobile Device Location and Time Data

HMM part 1. Dr Philip Jackson

Hidden Markov Models

CSCE 471/871 Lecture 3: Markov Chains and

PCA in On-Line Handwriting Recognition of Whiteboard Notes: A Novel VQ Design for Use with Discrete HMMs

Hidden Markov models

Hidden Markov Models. Aarti Singh Slides courtesy: Eric Xing. Machine Learning / Nov 8, 2010

Speech Recognition HMM

A Higher-Order Interactive Hidden Markov Model and Its Applications Wai-Ki Ching Department of Mathematics The University of Hong Kong

6.047 / Computational Biology: Genomes, Networks, Evolution Fall 2008

Recall: Modeling Time Series. CSE 586, Spring 2015 Computer Vision II. Hidden Markov Model and Kalman Filter. Modeling Time Series

Lecture 5: GMM Acoustic Modeling and Feature Extraction

Lecture 11: Hidden Markov Models

Advanced Data Science

Discrete Single Vs. Multiple Stream HMMs: A Comparative Evaluation of Their Use in On-Line Handwriting Recognition of Whiteboard Notes

Sparse Models for Speech Recognition

Page 1. References. Hidden Markov models and multiple sequence alignment. Markov chains. Probability review. Example. Markovian sequence

Hidden Markov Models

Graphical models for part of speech tagging

A TWO-LAYER NON-NEGATIVE MATRIX FACTORIZATION MODEL FOR VOCABULARY DISCOVERY. MengSun,HugoVanhamme

Machine Learning & Data Mining Caltech CS/CNS/EE 155 Hidden Markov Models Last Updated: Feb 7th, 2017

Outline of Today s Lecture

Dept. of Linguistics, Indiana University Fall 2009

Example: The Dishonest Casino. Hidden Markov Models. Question # 1 Evaluation. The dishonest casino model. Question # 3 Learning. Question # 2 Decoding

Upper Bound Kullback-Leibler Divergence for Hidden Markov Models with Application as Discrimination Measure for Speech Recognition

Hidden Markov Models Part 2: Algorithms

Hidden Markov Models, I. Examples. Steven R. Dunbar. Toy Models. Standard Mathematical Models. Realistic Hidden Markov Models.

Today s Lecture: HMMs

Statistical Methods for NLP

Multiple Sequence Alignment using Profile HMM

A Gentle Tutorial of the EM Algorithm and its Application to Parameter Estimation for Gaussian Mixture and Hidden Markov Models

Design and Implementation of Speech Recognition Systems

Hidden Markov Models

Sequence labeling. Taking collective a set of interrelated instances x 1,, x T and jointly labeling them

Robert Collins CSE586 CSE 586, Spring 2015 Computer Vision II

Training Hidden Markov Models with Multiple Observations A Combinatorial Method

Markov processes on curves for automatic speech recognition

Noise Robust Isolated Words Recognition Problem Solving Based on Simultaneous Perturbation Stochastic Approximation Algorithm

Hidden Markov Models. Three classic HMM problems

11.3 Decoding Algorithm

Graphical Models Seminar

Experiments with a Gaussian Merging-Splitting Algorithm for HMM Training for Speech Recognition

Probabilistic Graphical Models Homework 2: Due February 24, 2014 at 4 pm

Can Markov properties be learned by hidden Markov modelling algorithms?

Transcription:

A ew OCR System Similar to ASR System Abstract Optical character recognition (OCR) system is created using the concepts of automatic speech recognition where the hidden Markov Model is widely used. Results are very encouraging. Recognition accuracy in the rage 98 % to 99 % has been achieved. 1. Introduction Optical character recognition systems are used to convert text in printed documents into machine-readable ASCII codes for the purpose of storage or further processing. he range of applications is wide and includes postal code reading, automatic data entry into large administrative systems, recognition of print and script, automated cartography, banking, and reading devices for blind. It is an integral part of office automation in the form of text processing. he features, which characterize a good optical character recognition system, are accuracy, flexibility, and speed (El-Khaly, and Sid-Ahmed, 1990). In the last two decades, there has been progress in the field of machine recognition techniques for Latin and Chinese characters. Meanwhile, the machine recognition of Arabic characters has not yet been fully explored. Despite the fact that Arabic characters are used in writing many widespread languages like Arabic, Persian, Urdo, etc. he published literature includes very little information about the computer recognition of Arabic characters. However, these forms of printed text are usually presented as isolated characters. he shape of the character in these forms is independent of its location in the printed word, contrary to Arabic text (Al-Youfefi and Upda, 1992, El-Khaly, and Sid-Ahmed, 1990, and El-Wakil and Shoukry, 1988). 15 of 1Page

In order to illustrate the difference between Arabic text and various other texts, the main characteristics of Arabic characters are provided next: (i) Arabic is written cursively from right to left. (ii) Arabic words consist of one or more connected portions. (iii) he discontinuities between portions are due to some characters that are not connectable from the left side with the succeeding portion. (iv) Every character has more than one shape depending on its position within a connected portion of the word (beginning, middle, end of portion, or isolated character). (v) here are a lot of diacritics that may be associated with Arabic text. Hidden Markov Models (HMMs) have been used successfully for speech recognition applications and they have recently been applied to the problem of on-line handwriting recognition as well. In this thesis we will use the HMMs for solving the problem of off-line automatic recognition of connected Arabic text. o use the HMM techniques for the application of Arabic connected character recognition, we have to add some modifications to overcome the difference between speech signals and Arabic connected text. My idea is to scan the Arabic documents and to remove noise and discontinuities from the scanned images using preprocessing algorithms. hen we will look into the text-image using a sliding window that moves from right to left through text lines and take features of each window. hese features are used to train the Hidden Markov Models of the Arabic patterns. 2. Hidden Markov Models Overview: Hidden Markov models (HMMs) are a method of modeling systems with discrete, time dependant behavior characterized by common, short time processes and transitions between them. 15 of 2Page

An HMM can be thought of as a finite state machine where the transitions between the states are dependant upon the occurrence of some symbol. Associated with each state transition is an output probability distribution, which describes the probability with which a symbol will occur during the transition, and a transition probability indicating the likelihood of this transition. Since the late 1970 s, when HMMs were first applied to automatic speech recognition (ASR), several analytical techniques have been developed for estimating these probabilities. hese techniques enabled HMMs to become more computationally efficient, robust, and flexible. his has permitted HMMs to serve as the basis of many largevocabulary, speaker-independent systems. he HMM model describes a stochastic process, which produces a sequence of observed events or symbols. he HMM is called Hidden Markov Model because there is an underlying stochastic process that is not observable, but affects the observed sequence of events. he sequence of observations can be described using the notation: O O1, O2,..., Ot,..., O 1 where the process has been observed for the discrete time steps from time t=1 to t=. he observations may be any one of K symbols, v k. In speech recognition, these symbols may be low-level vector quantization (VQ) codebook entries computed at regular intervals, or high-level acoustic descriptors such as phonemes. he HMM may be thought of as a model of the process which produces the sequence of acoustic events belonging to a specific class, or word, in the vocabulary. Variations between observation sequences of the same class, such as word length and pronunciation, are modeled by the underlying stochastic nature of the HMM. An HMM-based ASR will generally have C HMMs, where C is the number of classes. he HMM recognizes the word when the final state is reached., 15 of 3Page

he key parameters to be determined in an HMM-based ASR system are the number of states per word, c, and the state transition and symbol output probability matrices. Large amounts of training data (per word) are needed to obtain acceptable estimates of these probability density functions. hese probability density functions capture the statistics of the talker population and are more robust for speaker-independent recognition than the finite number of word templates used in the dynamic time warping (DW) algorithm. Each HMM consists of a number of states. When the model is in state s i, the process may be measured and one of the symbols v k may be produced, according to an observation probability distribution, b i (v k ). At each time step t, the model will undergo a transition to a new state, s j, according to a transition probability distribution, given by a ij. hese transitions may take place between any two states, including self-transitions, as long as the transition probability distribution is non-zero. herefore, the HMM is a Markov process because the probability of being in a particular state at time t+1, given the state sequence prior to time t, depends only on the state at time t. An illustration of a typical HMM is provided in Figure 1. A particular model may be characterized by the number of states c, the number of observations K, and the three probability densities = { i }, A = {a ij }, and B = {b i (v k )}, where i is the initial probability distribution across states. he model of the c th word, M c, can be characterized by the set of M c = { c, A c, B c }. Pattern recognition with an HMM is equivalent to selecting the single model M c* from the set {M 1, M 2, M C } which maximizes the probability of observation sequence O 1 : C* = argmax 1 < c < C [Pr ( O 1 M c )]. For simplicity, Pr( O 1 M c ) will simply referred to as Pr(O M). he following sections describe how these three probability 15 of 4Page

densities can be calculated and how an efficient implementation can be realized. Figure 1: An illustration of a left-to-right hidden Markov model. Constructing an HMM he selection of the optimal number of states, which properly describe the observed sequence of events for a given word is a somewhat empirical process. For discrete words, one might select a number of states, which roughly correspond to the number of phonemes in the word to be modeled, with additional states corresponding to beginning and ending silences. When constructing an HMM, the probability distributions A and B cannot be determined using a direct analytical solution. However, an iterative procedure, known as forward-backward algorithm, or Baum-Welch algorithm, may be used for estimating these distributions. It has been shown that the Baum- Welch recursive algorithm can compute a new word model, M c' = { c', A c', B c' }, from an initial model M c = { c, A c, B c }, which either increases the probability of the sequence given the model, or leaves the probability estimates unchanged (M c = M c' ). If the probabilities remain unchanged, then M c is at a limiting point of the likelihood function. he forward-backward algorithm is a computationally efficient method for determining the model parameters. his iterative procedure uses the forward probabilities, i (t), and backward probabilities, j (t), to update the observation probabilities, b i (v k ), and transition probabilities a ij. It is dependant upon the computation of the probability of a partial 15 of 5Page

observation at time t < of t O 1 and state s i for a specific model M c with c states. In general, the forward probability is given by: i (t) = Pr ( O 1, s i M), and is computed by induction using an initial estimate of a ij and b i (v k ): 1. i (0) = i, 1 i ; 2. and for 1 t - 1 and 1 j : i (t) = ( j 1 j (t-1) a ji ) b i (O t ). From the forward probabilities, the probability of the complete observation sequence at time can be calculated: Pr (O M) = i (). hus, the forward algorithm calculates the probability that an observable sequence was generated by model M. An analogous backward probability can also be computed and is essential for updating the estimates of a ij and b j (v k ). he probability of the partial sequence Ot 1, given state s j at time t is given by: i (t) = Pr ( Ot 1 s i, M). his backward probability is computed in a similar fashion to the forward probability: 1. j () = 1, 1 j ; 2. and for -1 t 1 and 1 i : i (t) = j 1 i 1 j (t+1) a ij b j (O t+1 ). he probability of the complete sequence given the model can be computed with either the forward probabilities alone or from both the forward and backward probabilities: Pr (O M) = i 1 j 1 i (t) a ij b j (O t+1 ) j (t+1). Once the forward and backward probabilities are calculated, the word model M' = { ', A', B'}, can be reestimated. For a specific model M, the reestimation formulas are given by: i ' = i (1), 15 of 6Page

where i (t), the probability of state s i at time t, given the sequence O, is given by: i (t) = i (t) i (t) / Pr (O M). Likewise, A can be updated, a' ij = 1 ij (t) / 1 i (t), t 1 t 1 where ij (t), the probability of the state s i at time t and a transition to state s j at time t+1, is given by: ij (t) = i (t) a ij b j (O t+1 ) j (t+1) / Pr (O M). Finally, B can be updated, b' j (v k ) = t ( Ot vk ) j (t) / t 1 j (t), where the sum in the numerator is over all instances where the observation at t was the symbol v k. his type of iterative procedure is called an "estimate-maximize" algorithm, and is characterized by an efficient "hill-climbing" procedure for determining the word-model parameters (Rabinar, 1989 and Morgan and Scofield, 1992). HMM Recognition: he Viterbi Algorithm HMM recognition can begin once the word-model parameters are determined for all C words. During recognition, the input symbols generate a particular sequence of states which are visited by the HMM in producing the observation sequence. he state sequence essentially represents the segmentation of the words modeled by the HMM. However, to ensure that the optimal state sequence with the highest posteriori probability is selected, the Viterbi algorithm is employed. he Viterbi algorithm is a recursive optimal solution to the problem of estimating the state sequence of a discrete-time Markov process. It is essentially a dynamic programming procedure, which may be used to compute the state sequence with the highest priority. he Viterbi algorithm consists of the following three steps: (1) Initialize the probability,, of state s j and observation O 1, and let j (t) represent the state at time t, for which, a maximization over previous states has been performed: 15 of 7Page

j (1) = j b j (O 1 ), for 1 j j (1) = 0. (2) For 2 t and 1 j, recursively compute new values: j (t) = max 1 i [ i (t - 1) a ij ] b j (O t ), j (t) = argmax 1 < i < [ i (t - 1) a ij ] b j (O t ). (3) hen the single path with the highest probability can be computed and maximum likelihood state sequences can be recovered from j * (t): Pr (O M) = max 1 < j < [ j ()], j * = argmax 1 < j < [ j ()]. Practical Application of HMMs In the preceding formulas for computing model parameters, the forward and backward probabilities i (t) and i (t) appear. However, Levinson et al. note that these probabilities tend to zero exponentially as and in practice these values must be scaled to avoid under-flow. he scaling procedure involves multiplication of i (t) and i (t) by a scaling coefficient (t), selected such that (t) i (t) and (t) i (t) remain non-zero in the computation, and (t) = [ i 1 i (t)] -1. After reestimating the model parameters, the scale factors may be factored out and canceled. Unfortunately, the scale factors may not be factored out of the computation of the model probability, given by: However, under re-scaling: i 1 Pr (O M) = i () ( t 1 t 1 i 1 (t)) i (). i 1 (t) Pr (O M) = 1, Pr (O M) = 1 / t 1 i () = 1, (t). he log of the probability can then be expressed as: log (Pr (O M)) = - log [ (t)]. t 1 15 of 8Page

Rabiner and Juang have noted that in ASR applications, either the forward-backward procedure or the Viterbi algorithm may be used to determine Pr (O M). he summation in the forwardbackward procedure is usually dominated by the single term, which the maximization step in the Viterbi algorithm selects. As a result, the scaling procedure may be avoided since the Viterbi algorithm can be modified to compute log (Pr (O M)) directly. In this case the initial (log) probability is given by: j (1) = log ( i b j (O 1 )), And the recursion becomes: j (t) = max 1 < i < [ i (t -1) + log (a ij )] + log (b j (O t )). hen the log probability computed with the Viterbi algorithm for each word is: log (Pr (O M)) = max 1 < j < [ j ()]. he implementation of log values permits the computation of word probabilities to be additive rather than multiplicative, which avoids computer underflow and speeds up the recognition process considerably. In general, the HMM computational complexity is O ( 2 ) in the number of states searched by the Viterbi algorithm. Finally, it should be noted that there are a considerable number of HMM variants, which have been formulated to deal with specific continuous speech recognition (CSR) problems (Rabinar, 1989 and Morgan and Scofield, 1992). 3. OCR System Architecture he OCR system is divided into two subsystems: trainer and recognizer. he trainer subsystem is used to initialize and train hidden Markov models using many scanned bitmaps and their corresponding text files. he block diagram of the trainer subsystem is shown in Figure 2. 15 of 9Page

Figure 2: OCR rainer subsystem. o build an OCR system that is able to recognize an Arabic font with M different ligatures, we construct M different hidden Markov models each of them represents one of the Arabic font ligatures. he number of states per model is selected empirically to maximize the system performance. All models are initialized using a single bitmap that contains the complete set of ligatures of the used Arabic font. Figures 3 and 4 show selected set of ligatures for two of the most used Arabic fonts. Figure 3: Selected Ligatures for the Simplified Arabic Font. 15 of 11Page

Figure 4: Selected Ligatures for the raditional Arabic Font. he training documents including the initialization bitmap are scanned using a monochrome, 300 DPI scanner, and then a segmentor module is used to segment the bitmaps into a series of Arabic words starting from the upper-right corner of the page as show in Figure 5. Figure 5: Sliding Window over the Bitmap of an Arabic ext. he feature extractor module is used to extract features of a sliding window of the same height of the Arabic words and a fixed width, which is a ratio of the window s height. he sliding window slides through the body of the Arabic word from right to left using a fixed step, and provides a series of feature vectors to the feature quantizer module. Many sets of features are tested 15 of 11Page

with our OCR system, but invariant moments described by AlKhaly et al. [AlKhaly88] provided the best performance. he vector quantizer module provides a series of observations to the labeler module using the input train of feature vectors and a codebook constructed from many images of the training set of documents representing the Arabic font. he labeler module provides a series of observations with their associated sequence of patterns to the HMM trainer. he HMM trainer uses these inputs to adapt the values of the transition probability matrices and the observation probability matrices of models of these patterns to maximize the probability of the observation sequences of these patterns as described in the HMM section. he recognizer subsystem uses the trained HMMs to recognize the unseen documents of the same font used for training the OCR system. he block diagram of the recognizer subsystem is shown in Figure 6. Figure 6: he OCR Recognizer Subsystem. he Segmentor module segments the scanned bitmap into words, while the Feature Extractor and Vector Quantizer 15 of 12Page

modules generate a series of observations representing the segmented words as described in the training cycle. he HMMs Recognizer uses the trained HMMs of the selected Arabic font to generate a series of patterns that maximizes the probability of the observation sequence. Finally, the text preparator module converts the series of recognized patterns into their equivalent ligatures and stores these ligatures in a text file. 4. Experimental Results he OCR system was built using C++ language, and used for training the Simplified Arabic font using the set of ligatures shown in Figure 3. wenty-five text pages containing these ligatures were printed using a laser printer and scanned using a monochrome scanner with 300 DPI resolution. 21 pages of this set are used for training and four pages are used for testing the system. he following table represents the system recognition accuracy for different codebook sizes and different number of states per model. Codebook Size umber of States Recognition Accuracy 32 10 98.85 % 32 11 98.54 % 32 12 98.94 % 32 13 99.11 % 32 14 98.76 % 64 10 99.07 % 64 11 99.11 % 64 12 98.94 % 64 13 99.07 % 64 14 98.45 % 96 10 98.76 % 96 11 98.80 % 96 12 98.94 % 96 13 99.03 % 96 14 98.72 % able 1: est Results of Simplified Arabic Font he system was also used for training the raditional Arabic font using the set of ligatures shown in Figure 4 and provided the following results: 15 of 13Page

Codebook Size umber of States Recognition Accuracy 32 8 97.27 % 32 9 97.22 % 32 10 97.51 % 32 11 97.08 % 32 12 95.95 % 64 8 97.22 % 64 9 98.21 % 64 10 98.07 % 64 11 97.88 % 64 12 96.05 % 96 8 97.36 % 96 9 97.93 % 96 10 97.98 % 96 11 98.35 % 96 12 96.66 % able 2: est Results of raditional Arabic Font 5. Conclusion and Future work In this paper, I used HMM techniques for building a connected Arabic OCR system, and tested this system using the Simplified Arabic and raditional Arabic fonts of the Microsoft Word application. he system provided a very high accuracy (99.11 % for the Simplified Arabic font and 98.35 % for the raditional Arabic font). he first font provided better results because it contains less number of ligatures. In the future, the OCR system will be modified to be used for recognizing Connected Handwritten Arabic text. A robust segmentor has to be designed, and another set of features has to be used for this job. Also a language model has to be added for increasing the recognition accuracy of the system. he system also is slow, the recognition rate is about 10 words/sec. On PII, 333 MHz configuration. More experiments have to be done to increase the recognition speed. 15 of 14Page

References: - Al-Yousefi, H. and Upda, S.,: Recognition of Arabic Characters, IEE rans. Pattern Analysis and Machine Intelligence, pp. 853-857, Vol. 14, o. 8, 1992. - David P. Morgan and Christopher L. Scofield, eural etworks and Speech Processing, Kluwer Academic Publishers, 1992, pp. 119-127. - El-Khaly, F., and Sid-Ahmed, M., Machine Recognition of Optically Captured Machine Printed Arabic ext, Pattern Recognition, Vol. 23, o. 11, pp. 1207-1214, 1990. - El-Wakil, M.S., and Shoukry, A.A.,: On-Line Recognition of Handwritten Isolated Arabic Characters, Pattern Recognition, Vol.22, o. 2, pp. 97-105, 1989. - Rabinar, L.R., A utorial on Hidden Markov Models and Selected Applications in Speech Recognition, Proceedings of the IEEE, vol. 77 (2), February 1989. 15 of 15Page