scieee AI-readable full text Open interactive document viewer

Recognition of on-line handwritten mathematical expressions using 2D stochastic context-free grammars and hidden Markov models

Álvaro Muñoz, Francisco,Sánchez Peiró, Joan Andreu,Benedí Ruiz, José Miguel

Abstract

[EN] This paper describes a formal model for the recognition of on-line handwritten mathematical expressions using 2D stochastic context-free grammars and hidden Markov models. Hidden Markov models are used to recognize mathematical symbols, and a stochastic context-free grammar is used to model the relation between these symbols. This formal model makes possible to use classic algorithms for parsing and stochastic estimation. In this way, first, the model is able to capture many of variability phenomena that appear in on-line handwritten mathematical expressions during the training process. And second, the parsing process can make decisions taking into account only stochastic information, and avoiding heuristic decisions. The proposed model participated in a contest of mathematical expression recognition and it obtained the best results at different levels. 2012 Elsevier B.V. All rights reserved.

Full text

Document downloaded from: This paper must be cited as: The final publication is available at Copyright http://dx.doi.org/10.1016/j.patrec.2012.09.023 http://hdl.handle.net/10251/49505 Elsevier Álvaro Muñoz, F.; Sánchez Peiró, JA.; Benedí Ruiz, JM. (2014). Recognition of on-line handwritten mathematical expressions using 2D stochastic context-free grammars and hidden Markov models. Pattern Recognition Letters. 35:58-67. doi:10.1016/j.patrec.2012.09.023. Recognition of On-line Handwritten Mathematical Expressions Using 2D Stochastic Context-Free Grammars and Hidden Markov Models Francisco ´ Alvaro, Joan-Andreu S´anchez, Jos´e-Miguel Bened´ı Departamento de Sistemas Inform´aticos y Computaci´on Universitat Polit`ecnica de Val`encia. Valencia, Spain {falvaro,jandreu,jbenedi}@dsic.upv.es Abstract This paper describes a formal model for the recognition of on-line handwritten mathematical expressions using 2D stochastic context-free grammars and hidden Markov models. Hidden Markov models are used to recognize mathematical symbols, and a stochastic context-free grammar is used to model the relation between these symbols. This formal model makes possible to use classic algorithms for parsing and stochastic estimation. In this way, first, the model is able to capture many of variability phenomena that appear in on-line handwritten mathematical expressions during the training process. And second, the parsing process can make decisions taking into account only stochastic information, and avoiding heuristic decisions. The proposed model participated in a contest of mathematical expression recognition and it obtained the best results at different levels. Keywords: Mathematical expression recognition; Handwriting recognition; Stochastic parsing; Symbol recognition; Structural analysis; Spatial relations; Hidden Markov models 1. Introduction An essential part of information in science documents and many other fields is mathematical notation. Introducing mathematical expressions into computers and handling them usually requires special notation like L A T EX or MathML. However, in recent times there has been a great increasing of pen-based interfaces and tactile devices that allow users to provide handwritten data as input. This is a more natural way of introducing mathematical notation and it requires, in turn, developing systems that are able to recognize them. Recognition systems for mathematical expressions depend on the application [6]: on-line recognition systems for handwritten mathematical expressions, and off-line recognition systems for handwritten or printed mathematical expressions. In on-line recognition, the system input is usually a set of strokes that have geometric and temporal information. The system can take profit of temporal information of mathematical expressions that is not present in off-line recognition. This paper will be focused in on-line recognition of handwritten mathematical expressions. Handwritten mathematical expression recognition can be divided into two major steps [9]: symbol recognition and structural analysis. Symbol recognition involves segmentation of the input strokes into mathematical characters and symbol classification of these hypotheses. Structural analysis deals with finding out the structure of the expression according to the symbols arrangement. Several methods have been proposed to solve these problems jointly and separately. If the symbol recognition and structural analysis problems are performed jointly, then the segmentation can be considered as a hidden variable. If the symbol recognition and structural analysis problems are carried out separately, then the segmentation is done explicitly. The second approach is usually computational less expensive but it is prone to segmentation errors. The first approach is computational more expensive and efficient A? search strategies must be defined [29]. Several proposals have been studied for printed symbol recognition based on Support Vector Machines [24], Nearest Neighbor techniques or Hidden Markov Models (HMM) [3]. A survey of methods is provided in [9] for on-line recognition. The most usual representation techniques for on-line recognition are based on template or structural matching and HMM. Currently the error rate of mathematical symbols is about 5% for the best known classification techniques [14, 22, 31]. A very low error rate in mathematical symbol segmentation is crucial because it largely contributes to a reduction in the recognition of the full expression. Structural analysis of mathematical expression has been carried out by considering syntactic models that are able to represent spatial relations between the mathematical symbols. Trees are the mostly accepted models and they have been considered in [8, 12, 28, 40, 42] to represent these 2D spatial relations in on-line recognition. Minimum spanning trees have also been considered [13]. These tree structures are obtained through a parsing process. Evaluation and comparison of the structural analysis in mathematical expression recognition has hitherto been difficult because: first, most of the proposals used private data, and second, there has been a lack of standard performance evaluation measures [5, 19]. Lately, some public large corpora have been developed [23, 32] and also new metrics have been proposed [1, 30, 41]. Recently a Competition on Recognition of Online Handwritten Mathematical Expressions1(CROHME 2011) has been proposed [25]. This competition tried to define an experimental setup that allowed the comparison of different systems. The contribution of this paper is two-fold. First, from theoretical point of view, this paper takes a step forward in mathematical expression recognition by introducing a stochastic formal model based on 2D stochastic context free grammars (SCFG). The main contribution of this paper is an adequately formalized model that allowed us to deal appropriately with the two fundamental problems associated to this kind of models, that is, the learning problem, and the interpretation problem. The learning problem deals with the learning of the structural and stochastic part of the model from data. This paper introduces the learning of the main stochastic distributions of the model. The interpretation problem deals with obtaining the structure of the mathematical expression. The algorithm for parsing mathematical expressions according to the proposed model is also defined in this paper. It 1Competition held in International Conference on Document Analysis and Recognition (ICDAR 2011). http://www.isical.ac.in/~crohme/ 2 is important to remark that a correct formalization of the model allows us to use classical probabilistic estimation algorithms for learning and efficient algorithms for stochastic parsing. Second, from a more applied point of view, this paper contributes to mathematical symbol recognition and spatial relations classification as follows. HMM have been widely used for symbol recognition, in this work we applied two well-known sets of features used in handwritten text recognition [34, 35] that have not been yet tested in mathematical symbol recognition. Regarding spatial relations classification, we extended the work presented in [4] for printed mathematical expressions. We propose adding new features to account for variability in the handwritten case, as well as to recognize spatial relations that were not considered in that paper. We also employed a different method for computing the geometric features. A system for handwritten mathematical expression recognition based on parsing 2D- SCFG is completely detailed in this paper. It is composed by hybrid HMM as mathematical symbol classifier and spatial relations are determined according to geometric features. This model is able to solve jointly the problems involved in mathematical expression recognition: symbol recognition and structural analysis. The described system participated in the CROHME 2011 competition previously mentioned and it obtained the best results. The remainder of the paper is organized as follows. First, a review of related works is given in Section 2. Then, an overview of the on-line handwritten mathematical expressions recognition system is presented in Section 3. The formal statistical framework based on a two-dimensional extension of SCFG is described in Section 4. The mathematical symbol recognition process is explained is Section 5 and the spatial relations classification is detailed in Section 6. Finally, Section 7 presents a set of experiments performed to validate this approach using a public database of mathematical expressions and also the results obtained in the CROHME 2011 competition are reported. Conclusions and future work are presented in Section 8. 2. Related work There are several papers with detailed surveys on on-line recognition of mathematical expressions [9, 14, 37]. In this section we will briefly describe those papers that have influenced at most the approach of this paper. There are two main steps in mathematical expression recognition: symbol segmentation and recognition and structural analysis of the recognized symbols. On-line handwritten mathematical expressions are usually represented as a set of strokes. The segmentation problem consists on grouping properly these strokes to produce mathematical symbols. The segmentation problem has been tackled by computing connected components in [28] or applying the projection profile cutting method in [27], and the obtained strokes are then classified. The primary unit representation in mathematical expression recognition can be mathematical symbols [39] or strokes. When using strokes as primary unit representation, the segmentation into strokes can be explicitly used [42, 14, 40, 37, 29] or not [31, 22]. The use of explicit segmentation into strokes introduces the problem of grouping them to 3 compose symbols, and it makes the search difficult. Given that currently there are powerful symbol segmentation techniques [22], in this paper, the primary unit representation was mathematical symbols. Recognition of handwritten mathematical symbols is carried out using classical techniques. Several methods have been proposed to solve this problem, such as HMM [39, 18, 16], Neural Networks [33], Elastic Matching [7, 36] or Support Vector Machines [17]. Furthermore, some of these proposals combine on-line and off-line information to perform hybrid classification and improving recognition results [39, 17]. An important advantage of using HMM is that they may not require an explicit segmentation for training [31, 22]. In this work we have used HMM and we have combined on-line and off-line characteristics with HMM. Several approaches have tackled the structural analysis problem by using formal grammars. Chou [12] proposed to use SCFG in order to recognize printed mathematical expressions. Other proposals have been presented using definite clause grammars [10] or graph grammars [21]. Yamamoto et al. [40] presented a statistical formulation for on-line parsing of handwritten mathematical expressions based on the Cocke-Younger-Kasami (CYK) algorithm. Our proposal is similar to the approach based on two-dimensional SCFGs that was described in Pr˚uˇsa and V. Hlav´aˇc [28]. Pr˚uˇsa and V. Hlav´aˇc used weights associated to regions that contained symbols and then these regions were combined according to a penalty function based on region weights and syntactic rule weights. Our proposal uses stochastic distributions associated to regions in a similar way to [40], but the stochastic distributions associated to the model were different in our proposal. The stochastic definition of our model allowed us to use classical parsing and estimation algorithms for SCFG [20]. 3. System Overview This section presents an overview of the developed system, and the following sections provide a detailed description of the most important parts of the model. As we mentioned in the previous section, the symbol segmentation process was separated from the recognition of the full expression. That is, the segmentation process was considered as an explicit variable and not as a hidden variable. Considering the symbol segmentation as a hidden variable would be also possible in the developed system. The image was rendered by using linear interpolation between the points belonging to the same stroke. Then the connected components of the image were computed to obtain and a set of segmentation hypotheses (see Fig. 1). The recognition of the full expression was carried out with a Two-Dimensional Stochastic Context-free Grammar (2D-SCFG)2. This 2D-SCFG is introduced as a modification of a SCFG for strings. But in the two-dimensional case, the SCFG must account for spatial relations. Several spatial relations are stochastically explored between two regions: horizontal, subscript, superscript, vertical and inside. This information is coded in the rules. 2Matrices and left scripts (a bx) were not considered in this paper. 4 Strokes input Rendered image 10 27 9028 6150 9039 6155 9044 6152 ... 26 9579 5788 9576 5774 9582 5772 ... 41 9582 5744 9582 5741 ... 10 strokes input sequence 7 connected components (∆ = 3 strokes and x= 2 strokes) Figure 1: Mathematical expression initial segmentation by computing the connected components in the rendered image of the input sequence of strokes. Then, a stochastic constraint that takes into account the geometric position of each region is introduced in the parsing process. Note that two important problems are, first, the obtaining of the 2D-SCFG, and second, the parsing process. In this research, the rules of the grammar and the rule probabilities were manually defined. It is important to point out that the stochastic estimation of the rule probabilities could be performed with classic stochastic estimation algorithms [20] by defining appropriate algorithms. Section 4 introduces a parsing algorithm from which inside and outside versions could be derived. The other probability distributions of the 2D-SCFG were stochastically estimated from examples. In the parsing process, the initialization step was done using a mathematical symbol classifier to recognize the set of segmentation hypotheses. Afterwards, the productions of the grammar defined a set of syntactic and spatial constraints that guided the stochastic parsing process in order to build a complete structure of the most probable expression. The mathematical symbol recognition step was performed by using both on-line and off-line information. Note that the segmentation strategy based on computing connected components is not enough to solve this problem. Touching characters detection was not tackled in this work. However, the system is able to properly recognize symbols that are composed by more than one connected component. The detection of these type of symbols was integrated in the parsing process. For instance, an equal symbol (=) was recognized because the grammar had a production that composed an equal symbol as the vertical concatenation of two horizontal lines. In addition, some extra classes had to be added to recognize symbols whose components were not actual terminal symbols of the grammar, as the body of the ior a single stroke representing the ‘co’ part of the cosine function. Then, an isymbol is recognized as the vertical concatenation of a dot (·) and the body of an i(ı), as well as a cosine function can be recognized as the horizontal concatenation of ‘co’ and the letter ‘s’. 5 Finally, using the global information of the whole expression structure helped to improve the initial decisions made in segmentation, symbol recognition and spatial relations among regions. 4. Two-dimensional Stochastic Context-free Parsing SCFGs are a powerful formalism of syntactic pattern recognition that have been extensively used for string patterns. However, it is possible to slightly modify this formalism in order to model two-dimensional problems. In this paper, we studied the modeling of mathematical expressions using SCFGs. Hence, a 2D extension of a SCFG and its corresponding version of the CYK parsing algorithm are defined below. 4.1. Two-dimensional Stochastic Context-free Grammars First, we present the notation for Two-Dimensional Stochastic Context-free Grammars (2D-SCFGs) that constitute the formal framework used in this work. AContext-Free Grammar (CFG) Gis a four-tuple (N, Σ, S, P), where Nis a finite set of non-terminal symbols, Σ is a finite set of terminal symbols (N∩Σ = ∅), S∈Nis the starting symbol of the grammar, and Pis a finite set of rules: A→α,A∈N,α∈(N∪Σ)+. A CFG in Chomsky Normal Form (CNF) is a CFG in which the rules are of the form A→BC or A→a(where A, B, C ∈Nand a∈Σ). AStochastic Context-Free Grammar (SCFG) Gis defined as a pair (G, p), where Gis a CFG and p:P→]0,1] is a probability function of rule application such that ∀A∈N: PnA i=1 p(A→αi) = 1; where nAis the number of rules associated to non-terminal symbol A. A 2D-SCFG for mathematical expression recognition is a generalization of a SCFG, and introduces some significant differences. First, the terminal symbols are the recognized mathematical symbols in the two-dimensional regions corresponding to the segmentation hypotheses obtained in the pre-processing stage. Second, the grammar rules have an additional parameter that describes the spatial relation among regions. This relation is defined as Aspr −−→ α, where spr denotes the spatial relation that models the rule. Common spatial relations for mathematical expression recognition are: horizontal,vertical,inside,subscript and superscript. Terminal productions do not contain the spatial relation parameter. Finally, the main difference lies in how to combine the grammar rules to account for an image. We now describe a stochastic parsing method for this type of two-dimensional models. 4.2. CYK parsing for 2D-SCFG Let Gbe a CNF 2D-SCFG, and let C={c<x,y> i|i: 1 . . . C }be the set of segmentation hypotheses (representing the input expression) provided after the pre-processing step, where c<x,y> irepresents the segmentation hypothesis located at region defined by points <x, y> (top-left and bottom-right corners, respectively). In order to compute the probability of the best parsing of the input expression (represented by C) by the grammar Gis necessary to define a new version of the well-known CYK-based Viterbi algorithm [26] to consider two-dimensional images. 6 Following [15], this algorithm is essentially a dynamic programming method, which is based on the construction of a parsing table L. Each element in Lis defined according to the following concepts. Value e<x,y>[A] is the probability that Ais solution of the mathematical expression contained in the region defined by <x, y>. Analogously, e<x,y> l[A] is the probability that Ais solution of the mathematical subexpression contained in the region <x, y>, considering lsegmentation hypotheses. Finally, Ll={e<x,y> l[A]}is a stochastic parse structure where each element e<x,y> l[A] is composed from lsegmentation hypotheses. Following [26, 15], we now present a stochastic parsing algorithm for 2D-SCFG based on the well-know CYK algorithm. This algorithm will allow us to calculate the parsing table L. As in [26, 15], we will divide this process into two steps. First, the initialization begins building the set L1from the set of segmentation hypotheses defined in C: L1=L1∪ { e<xi,yi> 1[A]} ∀i: 1 . . . C such that: e<xi,yi> 1[A] = max m{p(A→m)qm(c<xi,yi>)} where mis a particular mathematical symbol, for which there is a specific recognizer. Value qm(c<xi,yi>) is the probability provided by the HMM symbol classifier (see section 5) of this class mfor segmentation hypothesis c<xi,yi>. Next, the parsing process continues calculating new subproblems of increasing size. Formally, the general case is computed as Ll=Ll∪ { e<x,y> l[A]} ∀ l: 2 . . . C with: e<x,y> l[A] = max B,C max rmax k:1...l−1max e<xB,yB> k[B]∈ Lk e<xC,yC> l−k[C]∈ Ll−k (p(Ar −→ BC)e<xB,yB> k[B]e<xC,yC> l−k[C]pr(<xB, yB>, <xC, yC>)) where a new subproblem e<x,y> l[A] is created from two subproblems of minor size e<xB,yB> k[B] and e<xC,yC> l−k[C] taking into account both the syntactic constraints, defined by p(Ar −→ B C), and the following constraints: first, rrepresents the spatial relation, and second, pr(<xB, yB>, <xC, yC>) is the probability that both regions were arranged according to the spatial relation r(see Section 6). Looking at the 2D CYK algorithm, the first remarkable difference is that the parsing table is indexed by only one index. On the standard CYK parsing algorithm two indexes explain the positions that define some substring. In the 2D case, there is a level for each subproblem size, and these levels store a set of elements which contain their two-dimensional space information. For that reason, at the initialization step the built subproblems are added at L1, that is to say that they cover one input element (in this case a connected component). 7 After that, the parsing process continues by building new subproblems of increasing size, where both spatial and syntactic constraints are taken into account for each new subproblem. Finally, the time complexity of the algorithm is O(n4|P|) where nis the symbol number of the input expression and |P|the rule number of the 2D-SCFG. The time complexity of the classical CYK is O(n3|P|). However, this complexity was reduced to O(|P|n3log n) by using a spatial data structure as is described in [2]. 5. Mathematical Symbol Recognition Hidden Markov Models (HMM) were used in this paper to perform the mathematical symbol recognition process by using two well-known sets of features widely employed in handwritten text recognition [34, 35]. In on-line recognition of mathematical symbols, the basic input unit is usually a sequence of strokes. In our approach, the basic input unit were isolated symbols made up from strokes. The path described by the points in each stroke was rendered, and then mathematical symbol hypotheses were obtained. The mathematical symbols were got by classifying a segmentation hypothesis according to off-line characteristics. Then each segmentation hypothesis was reinforced by combining both on-line and off-line information. Note that this process could be done in the opposite direction: first a segmentation hypothesis could be obtained according to on-line characteristics, and then each hypothesis could reinforced by combining both on-line and off-line information. The following subsections describe the recognition process for both cases and also the combination of both modalities. 5.1. Classification with off-line characteristics A sequence of strokes describes a path into the space, hence it is possible to draw the image representation from the on-line input. In this approach, we used simple linear interpolation between every two consecutive points (see Fig. 2). Each segmentation hypothesis was made up by computing the connected components in the rendered representation of the input sample. Then, each connected component was classified by using HMMs. HMM have been widely used for mathematical symbols classification in on-line recognition [14]. However their use in off-line recognition has not received much attention. In this paper, we explored the technique described in [34] applied to off-line mathematical symbols. The rendered representation was adequately normalized to a fixed size row, keeping the aspect ratio (see Fig. 2.a). Then, the image was transformed into a sequence of fixeddimension feature vectors as follows: the image was divided into a grid of small square cells, sized a small fraction of the image height. Each cell was characterized by the following features (Fig. 2): normalized grey level (b), horizontal grey-level derivative (c) and vertical grey-level derivative (d). To obtain smoothed values of these features, feature extraction was extended to a 5 ×5-cell window centered at the current cell and weighted by a twodimensional Gaussian function in b) and a unidimensional Gaussian function in c) and d). The derivatives were computed by least squares fitting a linear function. Columns of cells were processed from left to right and a feature vector was built for each column by stacking 8 Table 2: Recognition rate in spatial relation classification. #Feat Writer Hor. Subscript Super Vertical Inside Total 2Dep. 96.29 44.39 72.55 92.25 6.31 86.94 Ind. 96.43 46.34 70.17 92.61 3.57 85.97 9Dep. 98.56 74.43 91.30 97.40 99.33 96.32 Ind. 98.54 73.90 89.17 96.55 99.46 95.81 7.3. Mathematical Expression Recognition: MathBrush database Finally, mathematical expression recognition experiments were performed. The HMM classifier for mathematical symbol recognition and the SVM for spatial relations classification were trained as previously discussed. The 2D-SCFG was manually defined to cover general mathematical expressions, taking into account the type of expressions of the corpus. Evaluation of mathematical expression recognition systems is a difficult problem [5, 19], and several metrics have been proposed [30, 41, 1]. The EMERS metric [30] is a dissimilitude value computed as the tree edit distance between the tree representation of the obtained expression and the reference expression, ant it is not normalized. The main problem of the EMERS metric is that the representation ambiguity of coded mathematical expressions can produce different trees of the same expression. In [41], the authors proposed a representation that seems to cope with this ambiguity and they also presented their corresponding performance metrics. However, the representation required precise information of the structure of the expression at stroke level, and the MathBrush corpus annotation had not completely and explicitly this information. Recently, we proposed IMEGE4metric, a global measure based on image representation, which also deals with ambiguity. This metric is based on the image representation of the two expressions [1]. It computes a global dissimilitude value normalized in the range [0,100] such that if two expressions are identical the corresponding IMEGE value is equal to zero. Table 3 shows the results of the mathematical expression recognition experiment, where several measures were used: symbol segmentation rate (SYMseg), symbol recognition rate for well segmented symbols (SYMrec), expression recognition rate (EXPrec), and global expression metrics EMERS and IMEGE. Expression recognition rate was computed as the percentage of expressions whose IMEGE value was equal to zero. As expression recognition rate is a very pessimistic measure, we also report the rate of expressions for which the structure is perfectly recognized without regarding the symbol recognition errors (Struct). Results show that the proposed system is able to properly recognize handwritten mathematical expressions. The obtained performance evaluation measures validates the model, where all its parts are learnt automatically from training samples. Despite that the segmentation strategy of this approach is simple and it could be improved [22], symbol segmentation rate was 85.12% for writer dependent experiment and 83.84% for writer independent experiments. 4Software available at http://users.dsic.upv.es/~falvaro/imege.html 15 Table 3: Mathematical expression recognition results with MathBrush database. Writer SYMseg SYMrec EXPrec Struct EMERS IMEGE Dep. 85.12% 86.49% 19.39% 44.10% 4.98 37.51 Ind. 83.84% 84.11% 19.15% 43.22% 5.14 40.08 The symbol recognition approach based on hybrid HMM also presented a good behaviour obtaining symbol recognition rate of 86.49% and 84.11% for writer dependent and writer independent scenarios, respectively. Expression recognition rate was about 19% and taking into account only the structure of the expressions the recognition rate increases up to 44%. It should be noted that writer dependent results are better that writer independent results, as it was the expected behaviour. Finally, global comparison is difficult because, as far as we know, there are not results presented over this database using these measures. For that reason, in the following section we present comparable results of the developed system in a recent competition. 7.4. Mathematical Expression Recognition: CROHME competition The described system participated in the recent Competition on Recognition of Online Handwritten Mathematical Expressions [25]. Given that the comparison of mathematical expression recognition systems is not an easy task [5, 19], this competition was a good opportunity to compare different approaches in identical conditions. Five research groups participated, although system 5 was developed by the organizers and it did not compete. A training set and and two parts were defined for the competition. Part-I contains 296 expressions and Part-II consists of 921 expressions. Part-I was a subset of Part-II. The number of symbol classes in Part-I was 37 whereas 57 terminal symbols were considered in Part-II. Likewise, the expressions in Part-II of the training set were more complex than the Part-I expressions. Finally, a hidden test set was used to evaluate the performance of each system participating in the competition. The test set for Part-I contained 181 expressions and the test set for Part-II was composed of 348 expressions including the expressions in Part-I. The reported metrics are: stroke classification rate (STrec), symbol segmentation rate (SYMseg), symbol recognition rate for well segmented symbols (SYMrec), and expression recognition rate (EXPrec). First three metrics regarding symbol recognition are well-defined, and EXPrec was computed considering that an expression was perfectly recognized if the labeled tree and the recognized tree were identical. This measure can be biased because the same expression can be represented by different trees. Every model of the system was trained using the defined training sets for each part: hybrid HMM for mathematical symbol recognition and SVM for spatial relations classification. Moreover, the competition also provided a grammar for each part, which we slightly adapted to a proper 2D-SCFG definition for our model. Table 4 shows the final results of the competition [25], where we participated as system number 3. 16 Table 4: CROHME 2011 evaluation results [25]. System STrec SYMseg SYMrec EXPrec Part-I 1 53.23 59.06 88.78 4.42 2 22.39 27.98 82.11 0.55 3 78.73 88.07 92.22 29.28 4 37.41 55.15 81.71 0.00 5 78.57 87.56 91.67 40.88 Part-II 1 51.58 56.50 91.29 2.59 2 22.11 28.25 83.76 0.29 3 78.38 87.82 92.56 19.83 4 52.28 78.77 78.67 0.00 5 70.79 84.23 87.16 22.41 According to the results of the competition, the developed system had a good performance and it is robust as the results barely varied from Part-I to Part-II. It obtained significantly better results than the other participants for symbol recognition metrics. Regarding expression recognition rate, although the organizers’ system result was higher, our system also obtained good results and was declared winner of the competition. 8. Conclusions In this paper we presented an on-line handwritten mathematical expression recognition system. We defined a formal statistical framework based on 2D-SCFG and its corresponding CYK-based parsing algorithm. We also described a complete system where all components could be learnt from training data. Finally we performed several experiments over a large database and we concluded the following: •The combination of on-line and off-line information significantly improves mathematical symbol recognition. •Spatial relations between regions can be efficiently modeled using geometric features. Thus, a statistical distribution can be learnt from training data and then heuristic decisions could be avoided. •The statistical framework based on 2D-SCFG is able to properly recognize handwritten mathematical expressions. Furthermore, structural information can help to improve the initial symbol recognition and spatial relations decisions. For future work, given the statistical framework based on 2D-SCFG, the spatial relations classification should be improved. More sophisticated segmentation techniques should be incorporated in order to improve segmentation accuracy and to be able to tackle the touching 17 characters problem. Other features could be used to train HMM for mathematical symbol recognition. Acknowledgements Work supported by the EC (FEDER/ FSE) and the Spanish MEC/MICINN under the MIPRCV “Consolider Ingenio 2010” program (CSD2007-00018), the MITTRAL (TIN2009- 14633-C03-01) project, the FPU grant (AP2009-4363), and by the Generalitat Valenciana under the grant Prometeo/2009/014. References [1] F. ´ Alvaro, J.A. S´anchez, and J.M. Bened´ı. IMEGE: Image-based Mathematical Expression Global Error. DSIC-PRHLT Technical Report, Universitat Polit`ecnica de Val`encia, 2011. http://hdl.handle.net/10251/13084. [2] F. ´ Alvaro, J.A. S´anchez, and J.M. Bened´ı. Recognition of printed mathematical expressions using two-dimensional stochastic context-free grammars. In International Conference on Document Analysis and Recognition (ICDAR), 2011. [3] F. ´ Alvaro and J.A. S´anchez. Comparing several techniques for off-line recognition of printed mathematical symbols. In Proceedings of ICPR, volume 0, pages 1953–1956, Istambul, Turkey, August 2010. [4] W. Aly, S. Uchida, A. Fujiyoshi, and M. Suzuki. Statistical classification of spatial relationships among mathematical symbols. In Proceedings of ICDAR, pages 1350–1354, july 2009. [5] A.-M. Awal, H. Mouch`ere, and C. Viard-Gaudin. The problem of handwritten mathematical expression recognition evaluation. In International Conference on Frontiers in Handwriting Recognition (ICFHR), 2010, pages 646–651, nov. 2010. [6] D. Blostein and A. Grbavec. Handbook of Character Recognition and Document Image Analysis, chapter 21, Recognition of Mathematical Notation, pages 557–582. World Scientific Publishing Company, 1997. [7] K.F. Chan and D.Y. Yeung. Elastic structural matching for online handwritten alphanumeric character recognition. In Pattern Recognition, 1998. Proceedings. Fourteenth International Conference on, volume 2, pages 1508 –1511 vol.2, aug 1998. [8] K.F. Chan and D.Y. Yeung. An efficient syntatic approach to structural analysis for on-line handwritten mathematical expressions. Pattern Recognition, 33:375–384, 2000. [9] K.F. Chan and D.Y. Yeung. Mathematical expression recognition: a survey. International Journal on Document Analysis and Recognition, 3:3–15, 2000. [10] K.F. Chan and D.Y. Yeung. Error detection, error correction and performance evaluation in on-line mathematical expression recognition. Pattern Recognition, 34(8):1671 – 1684, 2001. [11] C.C. Chang and C.J. Lin. LIBSVM: A library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2:1–27, 2011. [12] P. A. Chou. Recognition of equations using a two-dimensional stochastic context-free grammar. In W. A. Pearlman, editor, Visual Communications and Image Processing IV, volume 1199 of SPIE Proceedings Series, pages 852–863, 1989. [13] Y. Eto and M. Suzuki. Mathematical formula recognition using virtual link network. In Proceedings of ICDAR, pages 762–767, Washington, DC, USA, 2001. IEEE Computer Society. [14] U. Garain and B.B. Chaudhuri. Recognition of online handwritten mathematical expressions. IEEE Trans. on Systems, Man, and Cybernetics - Part B: Cybernetics, 34(6):2366–2376, 2004. [15] J. Goodman. Semiring parsing. Computational Linguistics, 25(4):573–605, 1999. [16] L. Hu and R. Zanibbi. HMM-based recognition of online handwritten mathematical symbols using segmental K-means initialization and a modified pen-up/down feature. In Proceedings of ICDAR, September 2011. 18 [17] B. Keshari and S.M. Watt. Hybrid mathematical symbol recognition using support vector machines. In Proceedings of ICDAR, volume 2, pages 859 –863, sept. 2007. [18] A. Kosmala, G. Rigoll, S. Lavirotte, and L. Pottier. On-line handwritten formula recognition using hidden markov models and context dependent graph grammars. In Proceedings of ICDAR, pages 107 –110, sep 1999. [19] A. Lapointe and D. Blostein. Issues in performance evaluation: A case study of math recognition. In Proceedings of ICDAR, pages 1355–1359, Washington DC, USA, 2009. IEEE Computer Society. [20] K. Lari and S.J. Young. The estimation of stochastic context-free grammars using the inside-outside algorithm. Computer Speech and Language, 4:35–56, 1990. [21] S. Lavirotte and L. Pottier. Mathematical formula recognition using graph grammar. In Proceedings of the SPIE, volume 3305, pages 44–52, 1998. [22] Z.X. Luo, Y. Shi, and F.K. Soong. Symbol graph based discriminative training and rescoring for improved math symbol recognition. In Proceedings of ICASSP, pages 1953–1956, 2008. [23] S. MacLean, G. Labahn, E. Lank, M. Marzouk, and D. Tausky. Grammar-based techniques for creating ground-truthed sketch corpora. Int. J. Doc. Anal. Recognit., 14:65–74, March 2011. [24] C. Malon, S. Uchida, and M. Suzuki. Mathematical symbol recognition with support vector machines. Pattern Recognition Letters, 29(9):1326–1332, 2008. [25] H. Mouch`ere, C. Viard-Gaudin, U. Garain, D.H. Kim, and J.H. Kim. CROHME2011: Competition on recognition of online handwritten mathematical expressions. In Proceedings of ICDAR, September 2011. [26] H. Ney. Stochastic grammars and pattern recognition. In P. Laface and R. De Mori, editors, Speech Recognition and Understanding. Recent Advances, pages 319–344. Springer-Verlag, 1992. [27] M. Okamoto and B. Miao. Recognition of mathematical expressions by using the layout structures of symbols. Proceedings of ICDAR, pages 242–250, 1991. [28] D. Pr˚uˇsa and V. Hlav´aˇc. Mathematical formulae recognition using 2d grammars. Proceedings of ICDAR, 2:849–853, 2007. [29] T.H. Rhee and J. Hyung Kim. Efficient search strategy in structural analysis for handwritten mathematical expression recognition. Pattern Recognition, 42(12):3192–3201, 2009. [30] K. Sain, A. Dasgupta, and U. Garain. EMERS: a tree matching-based performance evaluation of mathematical expression recognition systems. IJDAR, pages 1–11, 2010. [31] Y. Shi, H. Li, and F.K. Soong. A unified framework for symbol segmentation and recognition of handwritten mathematical expressions. In Proceedings of ICDAR, pages 854–858, 2007. [32] M. Suzuki, F. Tamari, R. Fukuda, S. Uchida, and T. Kanahori. Inftyan integrated OCR system for mathematical documents. In C. Vanoirbeek, C. Roisin, and E.Munson, editors, Proceedings of ACM Symposium on Document Engineering, pages 95–104, Grenoble, 2003. [33] A. Thammano and S. Rugkunchon. A neural network model for online handwritten mathematical symbol recognition. In D.S. Huang, K. Li, and G. Irwin, editors, Intelligent Computing, volume 4113 of LNCS, pages 292–298. Springer Berlin / Heidelberg, 2006. [34] A.H. Toselli, A. Juan, and E. Vidal. Spontaneous handwriting recognition and classification. In Proc. of the 17th International Conference on Pattern Recognition, pages 433–436, Cambridge, UK, August 2004. [35] A.H. Toselli, M. Pastor, and E. Vidal. On-line handwriting recognition system for tamil handwritten characters. In J. Mart´ı, J.M. Bened´ı, A. Mendon¸ca, and J. Serrat, editors, Pattern Recognition and Image Analysis, volume 4477 of Lecture Notes in Computer Science, pages 370–377. Springer Berlin / Heidelberg, 2007. [36] B.Q. Vuong, Y. He, and S.C. Hui. Towards a web-based progressive handwriting recognition environment for mathematical problem solving. Expert Syst. Appl., 37:886–893, January 2010. [37] B.Q. Vuong, S.C. Hui, and Y. He. Progressive structural analysis for dynamic recognition of on-line handwritten mathematical expressions. Pattern Recognition Letters, 29:647–655, 2008. [38] F. Wessel, R. Schluter, K. Macherey, and H. Ney. Confidence measures for large vocabulary continuous speech recognition. IEEE Trans. Speech and Audio Processing, 9(3), Mar 2001. 19 [39] H.J. Winkler. HMM-based handwritten symbol recognition using on-line and off-line features. In Acoustics, Speech, and Signal Processing, 1996. ICASSP-96. Conference Proceedings., 1996 IEEE International Conference on, volume 6, pages 3438–3441, may 1996. [40] R. Yamamoto, S. Sako, T. Nishimoto, and S. Sagayama. On-line recognition of handwritten mathematical expressions based on stroke-based stochastic context-free grammar. IEIC Technical Report, 2006. [41] R. Zanibbi, P. Amit, H. Mouch`ere, C. Viard-Gaudin, and D. Blostein. Stroke-Based Performance Metrics for Handwritten Mathematical Expressions. In Proceedings of the 11th International Conference on Document Analysis and Recognition, Beijing, China, September 2011. [42] R. Zanibbi, D. Blostein, and J.R. Cordy. Recognizing mathematical expressions using tree transformation. IEEE Trans. on Pattern Analysis and Machine Intelligence, 24(11):1–13, 2002. 20