scieee AI-readable full text Open interactive document viewer

Document segmentation using Relative Location Features

Cruz Fernández, Francisco

Abstract

[ES] Presentamos un método genérico para análisis de layout ideado para trabajar sobre documentos con layouts Manhattan y no-Manhattan. Proponemos la combinación de Relative Location Features junto con características de textura para codificar las relaciones entre las diferentes clases de entidades. Usando estas características construimos un Conditional Random Field que nos permite estimar el mejor etiquetado en términos de minimización de energía. Los experimentos realizados sobre ambos tipos de documentos demuestran que la utilización de Relative Location Features ayuda a mejorar los resultados de la segmentación en documentos altamente estructurados, así como ofrecer resultados a la altura del estado del arte sobre documentos sin una estructura aparente.

Full text

UNIVERSIDAD POLIT ´ ECNICA DE VALENCIA Document segmentation using Relative Location Features Francisco Cruz Fern´ andez Supervised by: Oriol Ramos Terrades Universidat Aut´ onoma de Barcelona Enrique Vidal Ruiz Universidad Polit´ ecnica de Valencia M.Sc. Thesis in Articial Intelligence, Pattern Recognition and Digital Image Departamento de Sistemas Inform´ aticos y Computaci´ on Valencia, June 2012 Acknowledgements I would love to dedicate this work to Chloe, for all her support and understanding during this year, and because without her this work could never have been possible. Also to my parents and to my sister, who are always there when I need them. Especially thanks to my supervisor Oriol Ramos, for being patient with me and for all the things he has taught me during this year. Also to all the people from the Computer Vision Center for receive me and treat me so well. Also thank the Universidad Polit´ ecnica de Valencia and all the people from the DSIC, especially to Enrique Vidal and all the friends I have there. Abstract In this thesis we present a generic layout analysis method devised to work in documents with both Manhattan and non-Mahnattan layouts. We propose to use Relative Location features combined with texture features to encode the relationships between the different class entities. Using these features we build a Conditional Random Field framework that allow us to obtain the best class configuration of an image in terms of energy minimization. The conducted experiments with Manhattan and non-Manhattan layouts prove that using Relative Location Features improves the segmentation results on highly structured documents, as well as results up to the state of the art on documents weakly structured. Contents 1 Introduction 3 1.1 RelatedWork ............................ 4 1.2 Objectives.............................. 6 1.3 Structure............................... 7 2 Datasets 8 2.1 Five Centuries of Marriages project . . . . . . . . . . . . . . . . 8 2.2 5CofM Ground Truth tool . . . . . . . . . . . . . . . . . . . . . . 10 2.3 PRImADataset ........................... 11 3 Method 13 3.1 Conditional Random Fields and graphical models . . . . . . . . . 14 3.1.1 Inference in graphical models . . . . . . . . . . . . . . . 15 3.2 Energy Minimization via Graph Cuts . . . . . . . . . . . . . . . . 16 3.3 Proposedmethod .......................... 18 3.4 Gaborfeatures............................ 18 3.4.1 Gaussian mixture model . . . . . . . . . . . . . . . . . . 20 3.4.2 Gabor-based classifier . . . . . . . . . . . . . . . . . . . 20 3.5 Relative Location features . . . . . . . . . . . . . . . . . . . . . 21 3.5.1 Probability maps estimation . . . . . . . . . . . . . . . . 22 3.5.2 Encoding Relative Location Features . . . . . . . . . . . 23 3.6 Combination of features . . . . . . . . . . . . . . . . . . . . . . 24 4 Experiments and results 25 4.1 Metrics ............................... 25 4.2 Statistical hypothesis test . . . . . . . . . . . . . . . . . . . . . . 26 4.3 DataPartition ............................ 26 4.4 Experimental settings . . . . . . . . . . . . . . . . . . . . . . . . 27 4.5 Cell size experiment . . . . . . . . . . . . . . . . . . . . . . . . 28 4.6 5CofM results discussion . . . . . . . . . . . . . . . . . . . . . . 29 4.7 PRImAResults ........................... 31 1 5 Conclusions and Future Work 35 5.1 Conclusions............................. 35 5.2 FutureWork............................. 36 A Contributions 37 Chapter 1 Introduction Along the history, humans have felt the need to transmit the information gained through their experiences and beliefs to the rest of people. The emergence of writing abilities in ancient cultures supposed a major breakthrough in the transmission of information, since it allowed written information to be transmitted to many individuals in different places without the need of the presence of the author. Over the centuries, huge amounts of written documents has been stored, even surpassing the volume of all the current information disposed in digital format. Written documents stored on the world’s great libraries and ancient archives offer a high variability respect to the nature of the content and document types. We can find since textual information in the form of scientific studies, literary compositions, administrative documents or records, to maps, paintings, images, photographs or other information provided in document form. With the objective of preserve all this information, the great breakthrough of scanning technologies in the last years have provided an efficient way to dispose of these documents in digital format while preserving the original source. This situation offers a chance to extract an manage all the information included in these collections, which adds the need of developing methods that help us in this task. Document Image Analysis and Recognition is the research field in charge of performing the task of analyze and perform overall interpretation of document images. The term of document analysis is a concept that extends to all kinds of documents, since handwritten documents, printed books or forms, to architectural drawings or any other information registered in paper. It is because of the great variability in types of documents that is common to find many works oriented to a particular task, which implies that a method devised to a particular document collection may be initially suitable to work on other documents but probably it will not obtain positive results. Dealing with documents, one important characteristic to highlight regards to the type of writting. The condition that a document is handwritten or typewritten has several advantages and disadvantages specially regarding to the easiness in the recognition of the text regions or the transcription of the characters. Historical 3 manuscripts, for instance, may result very difficult to transcribe even for the human eye due to degradation of the pages or complex writting styles. However, this task results less complicated in the case of typewritten documents. There are several tasks involved in the field of Document Image Analysis which differ in the elements to be analyzed. An important area within this field is text recognition, which is focused in performing text transcription by recognizing the characters and words in documents. Here, we can discriminate between two approaches depending on whether the documents are handwritten or typewritten. In the case of typewritten documents probably the most common technique are Optical Character Recognition (OCR) methods, which perform text transcription by combining word dictionaries with the recognized characters. This methods offer high success rates on typewritten characters, but are not suitable to work on handwritting documents because of the problems described above. Related with text recognition task, either in printed or handwritten documents, another ongoing research line is the word spotting task. Given an input text string, the objetive of word spotting is to find that inpunt within a colection of documents. Imagine for instance a huge collection of historical documents, the single fact of looking for a particular name in the system and finding the concrete page where this information is shown represent a huge time saving for historians and scientists. Another important task within Document Image Analysis is the layout analysis, which focus in analyzing the structure of the document by identifying the location of the different elements that comprise it. The layout analysis task usually serves as a previous step for many of the tasks described above, so that the detection of the different entities may suppose a key point in the processing of the document. Unless concrete tasks, general works in layout analysis usually focus on the detection of two main classes of elements, the ones belonging to text regions and the ones containing graphical elements [17]. 1.1 Related Work The problem of layout analysis have been addressed in several ways along the last decades. One important issue to take into account in the election of the method is the type of documents for which the method is devised. Within the field of layout analysis, we can mainly consider two groups of document layouts according to the distribution of the elements that comprise them: Manhattan and non-Manhattan layouts. Documents with a Manhattan layout are often organized following a grid shape or another regular structure, some cases of journal documents with rectangular text regions can be included in this category. On the contrary we can find the documents with a non-Manhattan layout, which are identified for being composed by irregular regions and without a visible structure. From the possible ways to address layout analysis on both types of documents we can mainly distinguish between three families of methods: connected compo- 4 nents, projection-based and texture analysis. On the one hand, methods based in connected components have proved to offer great applicability on both Manhattan and non-Manhattan layouts. This methods usually follows a bottom-up approach where pixels are grouped into more complex structures until the final entities are identified. An example in this line is the work of Li et al. in [23], where connected components are extracted and clustered into a tree description to perform page segmentation in journal documents. A similar approach is presented in the Oc´ e method [4] where the authors make use of a decision tree classifier based in connected components to detect text regions, images and other elements in contemporary documents. On the other hand we can find methods based in projection profiles. In [6] a method for text line detection in historical documents is presented. The authors propose a model inspired in natural language processing methods combining both vertical projection profiles and Hidden Markov Models. Also in [11], Ha et al. present a method based in recursive X-Y cuts for layout analysis in journal documents. This method is based in decomposing the document image into a set of rectangular blocks and performing vertical or horizontal projection profiles for the estimation of the layout. The work of Nagy et al. in [16] is another example in this line, in this work they also use the X-Y cut approach to identify text regions in technical reports. Unlike methods based in connected components that can be applied on several layouts, this approach does not produce good results on documents with a non-Manhattan layout. However in the case of Manhattan layouts results to be very useful. In addition to these methods, the third very extended family of methods on document segmentation is the analysis of the image texture. These methods are characterized for offering great invariance to possible changes in the possition and shape of the elements to detect, and can be applied on both Manhattan and non- Manhattan layouts with good results. One work that uses these features in text segmentation is [14], where Jain et al. perform text segmentation from journal pages using Gabor filters as mechanism of texture analysis. Another work in this scope is [17], which also uses texture information via Matched Wavelets to obtain text segmentation in both real scene and journal documents. The great potential shown by texture-based methods in image segmentation and object detection, [15], has promote several works comparing different texture methods [21]. Here the authors conclude that there is not a favourite method for every task, but each of them offers partitular advantages and disadvantages according to the image texure that have to be considered. Most recently, it have been proved that the inclusion of contextual information helps to improve the obtained results in most pattern recognition tasks, and layout analysis in documents is not an exception. Many works have tried to include this additional information into their models in form of neighbour relationships, and one common way of doing that is modeling the pixel dependences using Conditional Random Fields (CRF). Conditional Random Fields belongs to the family of graphical models that permits to model complex dependences between the random 5 Figure 2.4: Four examples of images from the PRImA dataset 12 Chapter 3 Method In this chapter we describe the developed method for this our document segmentation task. The objective that we follow is to find the optimal labelling configuration for an image Ithat maximizes the a posteriori probability P(C|I), being Cthe set composed of the label values corresponding to each pixel pin the image, considering the set of lclass labels L={c1, c2, ..., cl}. The proposed method aims to compute this probability by means of a Conditional Random Field framework. Using this model we are able to encode the pairwise dependences between the image pixels and compute the previous probability distribution in terms of energy minimization following the expression: P(C|I) = 1 Zexp    −X i Di(ci)−X {i,j}∈N Vi,j(ci, cj)   (3.1) Let analyze each term in detail. Firstly, the unary potential Dj(cj). This term represents how well the label cjfits in the j-th pixel pjof the image I. Secondly, we have to model the pairwise pixel interaction modeled by the energy term Vi,j, which represents the pairwise potential between the set Nof interacting neighbor pixels. This potential represents the penalty of assigning pixel label ciand cjto the pixels piand pjrespectively. We decided to model these penalties by means of the Potts model as V(α, β) = Tα,β ·π(α6=β)where the factor π(·)is 1 if the condition is true and 0 if false, and α, β ∈L. The use of this function must favors the pixels included on the same regions to be labelled with the same label, while obtaining better defined boundaries between regions. Finally Zis a normalization defined in next sections. In addition, note that the model was initially proposed to work at pixel level, however, as we deal with large images is necessary to make some modifications to ensure that the segmentation process is efficient. Our choice to overcome this situation was based in consider groups of pixels rather than individual pixels. It was decided to use a regular grid system that divide the image into regions of regular size called cells. Thus, we defined the grid Sk∈ {S1, ..., SK}consisting 13 of Krectangular cells covering the entire image. Given this new distribution of the image, the goal of finding the optimal pixel labeling is replaced by the goal of finding the optimal labeling at cell level. It is understood that this process may undermine the accuracy of the segmentation process, however we believe that does not substantially affect the objectives of this thesis. The rest of the section if organized as follows: Section 3.1 describes the Conditional Random Field theoretical framework whitin the graphical models family. Then, the main characteristics of the chosen minimization algorithm are described in section 3.2. Finally, the proposed Gabor features and the Relative Location Features are described in sections 3.4 and 3.5. 3.1 Conditional Random Fields and graphical models Many problems in the field of the computer vision require to model the existing dependences between the set of random variables X∪Y, considering Xas the set of real-valued feature variables and Ythe set of class variables to predict. Thus, in our segmentation task the label assigned to a group of pixels is supose to affect to the decision of labelling the pixels in their neigborhood by being related with each other. Therefore, the objective is to model the probability distribution of Y in respect to the variables on Xtaking into account this dependence level between them. When we face with this situation is neccesary to dispose of a method that permits to model this dependences, however this task may become complicated in cases with a large amount of variables or complex dependences between them. Graphical models provide a consistent framework in the modeling of the probability distributions behind these dependences. Acording to the dependence level that we want to model, there exists a entire family of graphical models that adjust to each of the possible circumstances. One of the most basic models is the naive Bayes model, where all the input variables are independent from each other. This model provides the neccesary to model the joint distribution between the feature variables of the model an its correspondent class variables. Extending this model to the next level of dependence, we can consider the case where the variables are arranged in a sequence, and here the Hidden Markov Models (HMM) are one of the most appropiate models to deal with it. This model is widely used in speech and handwritting recognition problems by its ability of model the temporal relationships between the elements of the speech or text sequences. The next logical extension for the dependences between the variables can be represented as relationships between the nodes in a graph. Here, we can locate several methods which differ in the topology of the graph edges and variables, as Bayesian networks, Markov Random Fields or Conditional Random Fields. Despite the similarities in the graphical representation, there are some differences between these methods in most part due to the probability distribution that 14 model and the type of dependences between the variables. The main idea under graphical models to model this distribution is that a probability distribution often can be factorized in a set of local functions that depend of a smaller subset of variables, which we call factors. Thus, considering the set of variables X∪Y, the probability distribution among them can be formulated as a product of factors Ψj(a, b)in the scope a⊆X∪Yas: p(Y, X) = 1 ZY j∈ε Ψj(a, b)(3.2) where εrepresents the set of dependences between a, b and the constant Z, called partition function, is a normalization factor to ensure that the probability distribution sums 1 defined as: Z=X x,y Y j∈ε Ψj(a, b)(3.3) we can realize as the calculation of Z is based on all the possible values of X and Y, which correspond with a exponential number of combinations between all possible the values of those variables. In the computation of this value lies the main complication in the inference of these models. In problems where we deal with images the set of input variables Xis already known, so we can keep it fixed. The resulting model is a Conditional Random Field defined from Eq. (3.2) as: p(Y|X) = 1 Z(X)Y j∈ Ψj(a, b)(3.4) where the partition function is now defined considering all the possible configurations of the class variables Yas: Z(X) = X YY j∈ Ψj(a, b).(3.5) Thus, this partition function correspond with the normalization factor defined in Eq. (3.1) according to the particular set of features Xfrom each image cell. Initially we can consider the set of functions Ψjas composed by any kind of function, however the use of exponential functions offers several advantages in our task. First, the use of exponential functions allow us to define our model in terms of summations instead of products. Second, it is easy to represent them as energy potentials. 3.1.1 Inference in graphical models Efficient inference of the model parameters may be a difficult process according to the dependence level between variables. Inference on sequence-based models as Hidden Markov Models or linear-chain CRFs have proved to be exact using 15 Belief Propagation based algorithms, as well as for the estimation of the most likely assigment class variables by means of the Viterbi algorithm. In the case of general graphical models, computing exact inference results to be intractable in the case of having loops. For these situations, a family of inference methods have been developed to offer an approximate estimation of the model parameters. Loopy Belief Propagation algorithm is the generalization of the general Belief Propagation for these models. The estimation of the most likely assigment for the model variables can be also computed by means of approximate methods as the max-product algorithm. In addition, the use of log-linear functions allows to easily define the maximum a posteriori estimation of Eq. (3.4) in terms of energy minimization as shown in Eq. (3.1). Here, methods as the Graph Cut algorithm can be used for the estimation process of this energies. 3.2 Energy Minimization via Graph Cuts We have proposed a CRF framework to perform layout analysis in terms of energy minimization as stated in Eq. (3.1). We have seen that a exact estimation of the best labeling can not be computed efficiently due to the great number of variables in the model, so we were forced to search for alternative approximate methods. Graph Cut algorithm [7] allow us to efficiently compute a local minimum of the minimization function based in the minimum cut problem of graphs theory. The idea behind this method lies in represent both the feature and class variables within a graph structure and define the most likely assigment as a cut in the graph. In this way, the CRF is represented as a undirected weighted graph G={V, ε} with two different types of nodes. First, we find the nodes that correspond to each input variables of the model, in our case each image cell Sk. Secondly, the graph includes the nodes correponding to the set of possible labels Lto be assigned to each variable, called terminal nodes. Each node will be connected by means of two types of edges. It is called t-link to an edge that connects a terminal node with a cell node, on the same way we call n-link to the edge connecting two neighbor cells nodes according to chosen connectivity. Finally, we define Cas the set of labels assigned to each cell at the end of the process, so that Ckwill represent the assigned label to cell k. A visual representation of the structure of the graph can be seen in Figure 3.1. Formally, given two terminal nodes c1and c2and the set of cells S, we call S1to the cells (nodes) assigned with the assigned label c1, and in the same way, S2to the nodes with labeled with c2. Thus, the set of nodes V1,2is formed by the terminal nodes c1,c2together with S1,2=S1∪S2. In what regards to the edges, the term t1 irepresent the t-link between the node iand the terminal node c1, in the same way we call t2 ito the t-link joined to the terminal node c2. We also call e{i,j} to the n-link connecting two neighbor pixels i, j. Initially, the graph G={V, ε}includes all the n-link according to a 4-connectivity 16 and all the possible t-link. So, the goal of the algorithm is to find a cut ζ⊂εof minimum cost resulting in the induced graph G={V, ε −ζ}. The cost of a partition is given by the sum of the wheights of each edge included in the resulting graph, this wheights are defined as follows: •t1 i=Di(c1) + Pj∈NiV(c1, cj) •e{i,j}=V(c1, c2) In that way, the total cost of Cis given by the following expression: E(C) = X i∈S Di(ci) + X {i,j}∈N Vi,j(ci, cj)(3.6) which corresponds with the argument of our exponential function defined in Eq. (3.1). Figure 3.1: Representation of the graph G={V, ε}from the GC algorithm [7] 17 3.3 Proposed method We propose two different approaches to compute the unary term Di(ci)in Eq. (3.1) to evaluate the contribution of the Relative Location Features. Our first approach is based in use texture features to compute a cell-level classification, using the conficence of the classifier for the construction of the CRF. Then, in our second approach we include the Relative Location Features into the final model. Figure 3.2 shows a diagram with the proposed approach using the RLF. The following sections describe in detail each of the proposed approaches. Figure 3.2: Segmentation process using Relative Location Features 3.4 Gabor features Gabor filters, named by the physicist Dennis Gabor, are linear filters composed by a sinusoidal wave modulated by a gaussian envelope that allows to perform measurements in both the spatial and frequency domains, which is of great worth for a segmentation task. It have been proved that some impulses of the visual process in mammalian brains can be modeled by Gabor functions [8], and the this method shares similarities with how humans process the information when analyze and discriminate between the different elements in an image. Gabor filter was initially proposed to work on 1D signals, but in our case we will work with the expanded 2D model. 2D Gabor filters are composed by the product of an elliptical Gaussian and a complex exponential representing a sinusoidal plane wave. The filter in the spatial domain is represented as follows: 18 ψ(x, y :f0, θ) = f2 0 πγηe−f2 0 γ2x02+f2 0 η2y02 ej2πf0x0 x0=xcosθ +ysinθ y0=−xsinθ +ycosθ where f0de filter base frequency, γand ηcorrespond with the perpendicular axes of the gaussian θ. In the frequency domain, the Fourier transformed version of the filter correspond with a single Gaussian bandpass filter defined as: ψ(u, v|f0, θ) = e−π2(u0−f0 α2+v0 β2) u0=ucosθ +vsinθ v0=−usinθ +vcosθ Usually, when we are using filter responses as features in a classification problem, the common procedure is computing a set of responses by means of a Multi- Resolution Gabor filter Bank. A filter Bank contains a set of filters implemented with different orientations and frequencies, varying this parameters ensures the detection method to be invariant to position or orientation changes in the image elements. Some previous works have studied the best way to select the set of orientations and frequencies [18]. Following their indications, we consider a exponential spacing of mfrequencies fl=k−lfmax, with l={0, ..., m −1}, where fmax is the maximum frequency fixed, flthe lth frequency and kthe scaling factor (k > 1). Regarding to the orientation angle, the most common is to set orientations uniformly as θb=b2π/n, with b={0, ..., n −1}. Where nis the number of orientations to be considered. In this way, we define our feature vector as the set x∈Rm×n, where the feature xl,b is given by the filter response of frequency land orientation bon a particular image pixel. Although the advantages of Gabor filters, there are some considerations to take into account. The main complication in the use of these filters is the computational cost of computing the responses for all the filters in the bank. The involved Fourier transform, for example, is one of the most expensive process to be computed in the computation of a Gabor response. In this field, the work of J. Ilonen et al. will help us to obtain this responses in a efficient way [13]. We use the Multi-Resolution Gabor Filter toolbox developed in [13] for the realization of the present work. Recent studies suggest that analyzing the relationships between filter responses helps to discriminate between different objects or classes in a classification task [12], and here, statistic models are the most appropiate to capture this information in detail. Among the possible models, Gaussian mixture models appears to be a powerfull method to capture this information. 19 3.4.1 Gaussian mixture model Once we have established how we compute the feature vectors, we need to decide which method is more appropiate to estimate a proper probablity density function (pdf) over the training data. Although there are many methods that could be used to estimate this pdf, it have been proved that finite mixture models approximate more complex, and therefore, more precise pdfs [22]. Here, among the possible distribution functions, Gaussian mixture models (Gmm) are widely used in these tasks, and have proved to be a powerfull tool when we work with continuousvalued feature vectors. A gaussian mixture model is defined as the result of a weighted sum of M gaussian components as: p(x|θ) = M X i=1 wig(x|µi,Σi)(3.7) where xis the feature vector described above and the factor wicorresponds with the weight that the component ihave over the feature vector x. These weights are restricted to satisfy PM i=1 wi= 1. Each density function g(x|µi,Σi)correspond to one of the Mgaussian components given by the expresion: g(x|µi,Σi) = 1 (2π)D/2|Σi|1/2exp −1 2(x−µi)0Σ−1 i(x−µi)(3.8) where µiand Σiare the mean and covariance matrix of the component i, repectively. The full Gaussian Mixture model is finally defined by the paremeter list θ= {w1, µ1,Σ1, ..., wM, µM,ΣM}that have to be estimated from the training data. The estimation of these parameters is performed by the Expectation-Maximization (EM) algorithm. 3.4.2 Gabor-based classifier Now we show how to include the obtained information by the Gmm into the proposed CRF framework. In this model we model each image pixel by its feature vector xjas described before, in that way, the probability P(cj|pj)in Eq. (3.1) that we compute is now defined as P(cj|xj), which is computed through the Gaussian Mixture model. Previously we described that we changed the image representation from pixels to a set of cells, so, as the described Gaussian Mixture Model provide us with a pixel level classification, is necessary to define a way to obtain this information but focused on each image cell Sk. In this scope we have studied three different approaches for the computation of P(ck|Sk): The first approach was devised to take into account the pixel level classification given by the probability density function from the Gaussian Mixture Model. One 20 we have a label assigned to each pixel of the cell, we assign the cell label as the mayority class between the pixel labels as: P(ck|Sk) = #{p∈Sk|ck= arg maxcp(xk|c)} #Sk (3.9) Secondly, we decided to take into account the prior probability of the occurrence of each class along the different document pages. Thus, the probability is now defined as: P(ck|Sk) = Pj∈Sk(P(xj|ck))P(ck) PcPj∈SkP(xj|c)P(c)(3.10) One problem from the previous approach is that some classes have very small prior probabilities. This event can be explained just by taking a look to the document images. We can see in Figure 2.2 as the classes tax and name include a reduced number of pixels respect to the class body or the background, therefore, as the prior probability is computed by the proportion of pixels of each class, the computed value results to be very small. To avoid this problem, we consider as third approach that all classes are equally probable, so, the proposed model results in: P(ck|Sk) = Pj∈Sk(P(xj|ck)) PcPj∈SkP(xj|c)(3.11) Once we have computed the value of P(ck|Sk)through any of the previous approaches, the unary term Dk(ck)in Eq. (3.1) is computed as Dk(ck) = −log P(ck|Sk). 3.5 Relative Location features So far, we have seen that using Conditional Random Fields on a segmentation task allow us to encode local and pairwise preferences between the model variables. However, this relationships are often limited to the variables in a defined neighborhood system, but although this information results to be useful in the segmentation process, there are still another relationships that can be model and to enrich the final model. There are some tasks where a previous knowledge about the semantics of the classes can be used to guide the segmentation process, for instance, if we want to discriminate between the classes body and tax (see Figure 2.2), we can restrict the system to find tax pixels only in areas above and at the right side from body pixels. There are also some cases where we do not have a semantic knowledge but we know from the definition of the problem that there is a correspondence between the classes. In administrative documents, for instance, we may know that the signature appears always in some place at the bottom of the document. Following this approach, Gould et al. present in [10] a method that permits to capture the inter-class spatial relationships and encode it in a feature. The method 21 (a) Original image (b) Classification result Figure 4.1: Initial cell-level classification result of one image from 5CofM dataset of the image. The same effect can be appreciated for the class name, for which we obtain labeled cells wich this class along the entire image. Although the CRF will help to smooth this results in terms of region homogenization, is expected that the inclusion of the Relative Location Features also contribute to correct these mistakes. In what regards to the implementation of the probability maps, we decided to represent them in a matrix of size 200 ×200 pixels, so that the computed displacements have to be normalized by the image width and height and quantized to be represented in this range. We also fix the Map coordinates in the range [−1,1] ×[−1,1] (see figure 3.3). In addition, each map is normalized in order to define a proper probability distribution and ensure Pl c=1 Mc|c0(u, v)=1. 4.5 Cell size experiment As we introduced in previous chapters, we have divided the image into a set of rectangular cells in order to reduce reduce the number of calculations needed. In this experiment we evaluate the effect of using different cell size in the partition process. We have compared two different cell sizes, 25 ×25 and 50 ×50 pixels, as we are interested in reduce to the minimum the number of calculations but ensuring that this process does not affect to the quality of our results. For the experiment we performed the segmentation of the 20 test images from the 5CofM dataset using the approach composed by both RLF and Gabor features (Eq. (3.14)). The estimation of the initial labelling was performed using Eq. (3.9). The results of the experiment are shown in Table 4.2. We can appreciate as 28 Relative Location Features Relative Location Features Cell size 25x25 Cell size 50x50 Class Precision Recall F-measure Precision Recall F-measure Body 0.83 0.96 0.88 0.88 0.96 0.92 Name 0.70 0.75 0.72 0.77 0.73 0.74 Tax 0.31 0.65 0.41 0.69 0.66 0.66 Table 4.2: Results on 5CofM dataset comparing cell sizes of 25 ×25 and 50 ×50 pixels. using cell size of 50 ×50 we obtain better results in general than using 25 ×25 pixels per cell. Initially we could have thought that using smaller cell sizes would produce better results, however, the distribution of the classes within the image can explain this results. We can see in Figure 2.2 as the area of the class tax is small in comparison with the classes body and name, so the division of this region into cells may produce that some tax cells are labeled with the class background, obtaining a small precision rate as can be seen in the results. The same effect is observed for the class name in less proportion. Considering the obtained results, we will use a cell size of 50 ×50 pixels for the rest of our experiments. 4.6 5CofM results discussion Now we show the results obtained in the conducted experiments over the 5CofM dataset. In addition to evaluating the effect of including the Relative Location Features, we also want to check which of the different ways to compute the probability P(ck|sk)shown in section 3.4.2 produce better results, as the initial cell classification is a crucial step in the encoding process of the RLF. The results are shown in Tables 4.3, 4.4 and 4.5, which corresponds to Eq. (3.9), Eq. (3.10) and Eq. (3.11), respectively. We show the results achieved for the classes body, name and tax, as the background detection was not of interest in this task. Considering the results, there are some aspects that deserve to be highlighted. First, we can appreciate that the approach based in counting the number of pixels of each class (Eq. (3.9)) achieves higher rates in terms of F-measure than the other two approaches. Observing the values for the precision and recall we can see as this approach gets lower precision rates, but rather higher in the case of recall, which we consider more valuable for the objectives of this task. Comparing the approaches based in Eq. (3.10) and Eq. (3.11) we can see as the one which takes into account the priori information of the classes gets slightly greater detection rates than the one that not consider this information. This situation can be understood by analyzing the license representation shown in Figure 2.2. We can appreciate that the area belonging to the classes name and tax represents a small fraction of 29 the entire license, so the priori probability of those classes is much lower than in classes body or background. This produce that in the final segmentation a great number of cells are assigned to the wrong class. Gabor features Relative Location Features Class Precision Recall F-measure Precision Recall F-measure Body 0.89 0.87 0.88 0.88 0.96 0.92 Name 0.27 0.82 0.40 0.77 0.73 0.74 Tax 0.35 0.91 0.50 0.69 0.66 0.66 Table 4.3: Precision, Recall and F-measure on 5CofM dataset using Eq.(3.9) for the estimation of P(ck|sk). Secondly, comparing both proposed approaches, we can appreciate in the results as the inclusion of the Relative Location Features permits to obtain higher F-measure rates in the three conducted experiments than using just Gabor features. This increase is mostly produced due to the increment in the precision rate of the classes name and tax as we predicted before. To check whether the observed result was significant from a statistical point of view we apply the Wilcoxon rank-sum test with a significance level of 5%. The results of the test proved that the improvement seen by the inclusion of the RLF was statistically significant for the three considered classes, so we can affirm that the inclusion of this features helps to improve the segmentation results in this type of documents. This conclusion confirms our initial hypothesis which motivated the realization of this work. Gabor features Relative Location Features Class Precision Recall F-measure Precision Recall F-measure Body 0.89 0.81 0.85 0.88 0.93 0.91 Name 0.34 0.23 0.27 0.85 0.35 0.48 Tax 0.74 0.27 0.38 0.76 0.44 0.54 Table 4.4: Precision, Recall and F-measure on 5CofM dataset using Eq. (3.10) for the estimation of P(ck|sk) Finally, we show the result of the segmentation of one page in Figure 4.2. There are some important aspects to highlight from this result. First we observe that, although the body regions are identified with high precision, the different licenses in the page are merged. The space between licenses was identified as a body part, which implies that we are not going to be able to directly discriminate between licenses. Secondly, the representation in cells produce that some missing regions specially in the class tax, as the major part of the cell is classified as background the entire cell is labeled with this class, which influences the recall of this class. Both problems are depicted in Figure 4.3. 30 Gabor features Relative Location Features Class Precision Recall F-measure Precision Recall F-measure Body 0.88 0.74 0.80 0.88 0.94 0.91 Name 0.16 0.61 0.26 0.79 0.49 0.60 Tax 0.60 0.53 0.54 0.75 0.57 0.61 Table 4.5: Precision, Recall and F-measure on 5CofM dataset using Eq. (3.11) for the estimation of P(ck|sk) 4.7 PRImA Results Now we show the results of the experiments performed on the PRImA dataset. The methodology of the experiments was the same than in the previous case, we show in Tables 4.7, 4.8 and 4.9 the different results obtained using each approach in 3.4.2. We show in Figure 4.4 the segmentation result on one image from PRImA dataset. The same result was achieved here respect to the way of computing the probability P(ck|sk)than in the previous case. The approach based in counting the number of pixels of each class in the cells gets the higher values of the F-measure and better recall of class text. However, the reason of this result is not strictly the same than in the 5CofM dataset. In this dataset there are some images, as images from technical documents, where no elements of the class image are found, so the priori probability of each class may be not adequate and representative for all the documents. In respect to the effect produced by the inclusion of the Relative Location Features into the model, we can appreciate how in this case the improvement achieved is not as large than before. Although we can see a slight increment in the precision detecting both classes and in the final F-measure value, the results obtained by the significance test shows values over the 5%, so the improvement achieved by the RLF can not be considered stadistically significant. Nevertheless, it should be noted that in the case of the class text the result of the test is close to be stadistically significant with a p-value of 0.05. Making a comparison of our results with the ones obtained in the ICDAR’09 contest [5] (Table 4.6), we can appreciate as the detection rate in terms of F- measure is up to the highest results achieved in the contest (84%-95%). In the case of our class image they do not concretely refer to this class but they consider the class Non-text where is included also graphs and other elements, so our results are not directly comparable with them. 31 Method Non-text Text Overall DICE 0.66 0.92 0.90 Fraunhofer 0.75 0.95 0.93 REGIM-ENIS 0.67 0.92 0.88 Tesseract 0.74 0.93 0.91 FineReader 0.72 0.93 0.92 OCRopus 0.52 0.84 0.78 Table 4.6: F-measure of the reported methods in ICDAR2009 [5] Gabor features Relative Location Features Class Precision Recall F-measure Precision Recall F-measure Text 0.87 0.91 0.88 0.88 0.94 0.90 Image 0.38 0.48 0.42 0.43 0.47 0.44 Table 4.7: Precision, Recall and F-measure on PRImA dataset using Eq. (3.9) for the estimation of P(ck|sk) Gabor features Relative Location Features Class Precision Recall F-measure Precision Recall F-measure Text 0.93 0.56 0.67 0.86 0.73 0.76 Image 0.42 0.32 0.35 0.43 0.37 0.38 Table 4.8: Precision, Recall and F-measure on PRImA dataset using Eq. (3.10) for the estimation of P(ck|sk) Gabor features Relative Location Features Class Precision Recall F-measure Precision Recall F-measure Text 0.92 0.60 0.70 0.86 0.74 0.77 Image 0.40 0.29 0.33 0.41 0.35 0.38 Table 4.9: Precision, Recall and F-measure on PRImA dataset using Eq. (3.11) for the estimation of P(ck|sk) 32 Figure 4.2: Segmentation result of one page from the volume 208 of 5CofM dataset 33 Figure 4.3: Segmentation results of two licenses of 5Cofm. The red square show an example of missing tax regions, and red line indicates the area where the two licenses are merged Figure 4.4: Segmentation result of one image from PRImA dataset: Original image (left), segmentation mask (center), overlapped images (right) 34 Chapter 5 Conclusions and Future Work 5.1 Conclusions Within the field of Document Image Analysis and Recognition, layout analysis is responsible for analyzing the structure of the document by identifying the location of the different entities that comprise it. According to the distribution of these entities it is possible to discriminate between documents with regular layouts, Manhattan layouts, and documents with an arbitrary distribution along the image, non-Manhattan layouts. In this work we have presented a generic method to perform layout analysis on both types of documents. Our proposal is focused in texture analysis and the use of Relative Location Features to encode the existent relationships between the different classes of entities. We have built a Conditional Random Field framework that allow us to obtain the best class configuration of an image in terms of energy minimization. In order to evaluate the integration of the Relative Location Features into the model we have proposed two different approaches for the construction of the CRF. In the first place, we use only texture features computed by a multi-resolution Gabor filter bank, then, in second place we add the combine the previous model with the Relative Location Features. We conducted experiments on two different datasets in order to check the effectiveness in documents with Manhattan and non-Manhattan layouts. The results obtained prove that the inclusion of RLF into the model significantly increase the quality of the segmentation in documents with Manhattan layout and highly structured. In the case of non-Manhatan layout we obtain a slight improvement in the case of detect text regions using RLF, however this improvement is not significantly enough to confirm that the use of RLF helps on this kind of documents. Despite of this, the obtained results on this dataset are up to other state of the art methods in document segmentation, which proves that our method can be applied on both types of layouts with positive results. 35 5.2 Future Work During the realization of this work have appeared several situations that have made us think about some improvements that could be used to improve the results, both as regards to the implementation details as some new ideas to improve the quality of the final segmentation of the licenses on 5CofM dataset. In addition, there are several open work lines in the 5CofM project on which we have to continue working. Regarding to details in the method implementation, we think that improving the inicial cell-level clasification may result in a most appropriate definition of the Relative Location Features. Besides, until now we compute the RLF directly from the classification result just one time, we think that reiterating this process over the values of the RLF in the previous interation it is also possible to improve the RLF accuracy. Another idea in this line is to compute the RLF using the segmentation result obtained by the approach based only in Gabor features instead than on the initial GMM cell-level classification. As an important part of the 5CofM project, we want to segment the different licenses on each page. As a result of this work the licenses are merging by the class body in the region between licenses, we think that this region can be represented separately as another extra class, as it contains some elements that may help to discriminate between this new class and the rest. So, next step will be the integration of this new class in the segmentation process and we expect to obtain in this way a proper license segmentation. In addition, in the future we want to extend our method to the rest of volumes of the 5CofM dataset. Finally, we are interested in compare the results of our method with other ongoing works in the 5CofM project, concretely in the segmentation of the volume 208, conducted by the PRHLT group from the Univesidad Polit´ ecnica de Valencia. For this purpose we have in mind some new evaluation metrics for the result of segmenting the licenses, as computing the relative displacement between the detected bounding boxes with respect to the ground truth. 36 Appendix A Contributions As result of the research process described in this thesis, it has been produced the following publication: •F. Cruz and O. Ramos Terrades. Document segmentation using Relative Location Features. 21th International Conference on Pattern Recognition 2012 (ICPR2012). 37