Sunteți pe pagina 1din 6

Parallel Implementation of Devanagari Document Image Segmentation Approach on GPU

Brijmohan Singh, Nitin Gupta, Rashi Tyagi, Ankush Mittal, and Debashish Ghosh
Astt. Professor, Computer Science Deptt., College of Engineering Roorkee, Roorkee-247667, Uttarakhand, India bmsingh1981@gmail.com

Abstract. Fast and accurate algorithms are necessary for Optical Character Recognition (OCR) systems to perform operations on document images such as pre-processing, segmentation, extracting features, training-testing of classifiers and post processing. The main goal of this research work is to make segmentation accurate and faster for processing of large numbers of Devnagari document images using parallel implementation of algorithm on Graphics Processing Unit (GPU). Proposed method employs extensive usage of highly multithreaded architecture and shared memory of multi-cored GPU. An efficient use of shared memory is required to optimize parallel reduction in Compute Unified Device Architecture (CUDA). Proposed method achieved a speedup of 20x-30x over the serial implementation when running on a GPU named GeForce 9500 GT. Keywords: OCR, Segmentation, Parallelization, GPU, CUDA.

1 Introduction
Research on Devnagari character and word recognition is very difficult due to its challenging properties. This area of research is still open for further research due to the extent of variation among writing styles, speed, thickness of character and direction of different writers, Real-world handwriting is a mixture of cursive and noncursive parts, which makes the problem of recognition and synthesis more difficult, Similar looking characters may give ambiguity, Characters segment may touch where they should not or vice versa, variations and noises introduced during scanning and continuously increasing demand for accuracy, fast recognition, cheap and more practical to implement recognition system. The applications [1-3] of OCR such as form processing, automatic mail sorting, bank checks processing, and office automation for text entry. In handwritten document processing, half of the errors are due to segmentation. Segmentation process is challenging due to touching components, wide variety of handwriting styles, text line segmentation, location of word boundaries, overlapping of characters, identification of physical gaps between words and characters. Some elaborate studies on line, word and character segmentation are in [4-9]. In this work, we modified the traditional profiling based segmentation method and parallelized to make it faster using CUDA.
C. Singh et al. (Eds.): ICISIL 2011, CCIS 139, pp. 9297, 2011. Springer-Verlag Berlin Heidelberg 2011

Parallel Implementation of Devanagari Document Image Segmentation Approach

93

2 Introduction to nVidia CUDA


NVIDIA CUDA [10] is a general purpose parallel computing architecture introduced by NVIDIA. It includes the CUDA Instruction Set Architecture (ISA) and the parallel compute engine in the GPU.

3 Proposed Segmentation Method


The proposed segmentation method consists of two distinct stages. In the first stage, a preliminary segmentation was performed that executes line segmentation using modified histogram profiling method which uses the horizontal density of black pixels along with an axis. This process leads to the isolation of sub images corresponding to each line of the complete text. These sub images contain more than one word. In the second step, word segmentation was done using vertical density of black pixels along with an axis. These separate images of words can be further used for recognition purpose. 3.1 Sequential and Parallel Implementation of Line Segmentation Method First, we implemented the sequential code and then parallelized code of proposed method. The following pseudo code outlines the structure of proposed parallelized modified horizontal profiling method implementations for line segmentation: Input Output M : Density: 2 D image, Threshold Value Segmented Lines Image intensity matrix An array having number of pixels less than threshold value. Minima : An array having the position from where image is to be segmented Subroutine main() Define a block and grid For each row of M Call Density_Kernel(Image) End For Set: i=0 For each horizontal row (j) of M If (Density[j] ==0 && (Density[j - 1] > 0 || Density[j + 1] > 0)) Then minima[i++]=j; Modify_Kernel() End For While(minimaLength !=null) Calculate height between two rows Call Output_ Kernels(image) End While End Subroutine Density_kernel(image)

94

B. Singh et al.

If Intensity is less than threshold Then increment the density for each row Output_kenel(image) Use to create an image Modify_kernel() Calculate average of all the vertical intensities and then check the leftover parts between neighbour segmented lines. Divide it in to two parts and compare the density of upper and lower halfs, using neighbour pixels and according to this results either neglect these part or embed with segmented image. End Function 3.2 Sequential and Parallel Implementation of Word Segmentation Method Proposed method for word segmentation for sequential processing was implemented first and then in CUDA to get more efficiency. Parallelized algorithm is more efficient than sequential in terms of time. The parallel implementation followed the structure shown in the pseudo code below: Input 2 D image, Threshold Vale Output Segmentated Words M : Image intensity matrix Density: An array having number of pixels less than threshold value. Minima : An array having the position from where image is to be segmented Subroutine main() Define a block and grid For each column in M Call Density_Kernel(Image) End For Set i:=0 For each column (j) in M If (Density[j] ==0 && (Density[j - 1] > 0 || Density[j + 1] > 0)) Then minima[i++]=j; End For While(minimaLength !=null) Calculate height between two rows Call Output_ Kernels(image) End While End Subroutine Density_kernel(image) If Intensity is less than threshold Then increment the density for each row Output_kenel(image)

Parallel Implementation of Devanagari Document Image Segmentation Approach

95

Use to create an image Modify_kernel() Calculate average of all the horizontal intensities and then check the leftover parts between neighbour segmented lines. Divide it in to two parts and compare the density of upper and lower halfs, using neighbour pixels and according to this results either neglect these part or embed with segmented image. End Function

4 Results and Discussions


To test the proposed approach, we have collected a dataset of 10 document images of old newspapers and some are written by different writers. The results shown that modified profiling method works better than traditional profiling method. The comparison results are shown in figure 1and 2. The traditional profiling method works poor in overlapping text; it fails in calculating minima and maxima. Thus to avoid such problems we modified the method of finding minima and maxima for a text line. To make faster the profiling method, we parallelized proposed algorithm on CUDA and achieved a speedup of 20x-30x (on 10 images) over the serial implementation when running on a GPU named GeForce 9500 GT having 30 cores. Table 1 shows the comparison of execution time of proposed algorithm on CPU over GPU. Hence proposed method proved that it works better in overlapping cases and run faster on GPU. Our method does not give good result when there is a more noise in background, but it gives good result as compared to traditional profiling method as shown in fourth image in figure 1.
Traditional Profiling Method

S.N.

Input Image

Proposed Method

1.

Fig. 1. Shown line detection and segmentation in document images

96

B. Singh et al.

S.N.

Input Image

Traditional Profiling Method

Proposed Method

2.

3.

4.

Fig. 1. (continued)

Method Task Line Segmentation Word Segmentation

Traditional Profiling Method

Proposed Method

Fig. 2. Shown a sample of line and word segmentation

Parallel Implementation of Devanagari Document Image Segmentation Approach Table 1. Shown comparison of execution time CPU over GPU

97

Image 1.

2.

3.

4.

Execution time on CPU (Sec) 1.24 1.24 1.23 .61 .62 .61 1.12 1.13 1.12 1.91 1.93 1.91

Execution time on GPU(Sec) .0413 .0423 .0413 .0277 .0279 .0278 .0412 .0412 .0413 .0706 .0709 .0705

Average (Sec) Speedup CPU GPU 1.24 .0413 30x

.61

.0277

22x

1.12

.0412

28x

1.91

.0707

27x

5 Conclusion
In this work a fast and modified profiling based segmentation algorithm has been presented and analyzed. The results of proposed method on the graphics device are very fast, with large two dimensional images than sequential algorithm. This algorithm serves as an excellent framework to solve a diverse array of problems. Parallelization plays important role in OCR research to speed up any algorithm to make faster processing.

References
1. Marinai, S.: Introduction to Document Analysis and Recognition. SCI, vol. 90, pp. 120 (2008) 2. Tang, Y.Y., Suen, C.Y., Yan, C.D., Cheriet, M.: Document Analysis and Understanding: a Brief Survey. In: First ICDAR 1991, France, pp. 1731 (September-October 1991) 3. Plamondon, R., Srihari, S.N.: On-line and Off-line Handwritten Recognition: A Comprehensive Survey. IEEE Trans. on PAMI 22, 6284 (2000) 4. Lecolinet, E., Crettez, J.: A Grapheme Based Segmentation Technique for Cursive Script Recognition. In: Proceeding of First ICDAR 1991, France, pp. 740748 (SeptemberOctober 1991) 5. Yanikoglu, B., Sandon, P.A.: Segmentation of Off-Line Cursive Handwriting using Linear Programming. Pattern Recognition 31(12), 18251833 (1998) 6. Plessis, B., Siscu, A., Menu, E., Moreau, J.W.V.: Isolated Handwritten Word Recognition for Contextual Address Reading. In: Proc. USPS 51h Advanced Technology Conference, vol. 27(1), pp. 158164 (November 1992) 7. Paquet, T., Lecourtier, Y.: Handwritten Recognition: Application on Bank Cheques. In: Proceeding of First ICDAR 1991, France, pp. 749757 (September/October 1991) 8. Leroux, M., Salome, J.C., Badard, J.: Recognition of Cursive Script Words in a Small Lexicon. In: Proc. of first ICDAR 1991, France, pp. 774775 (September/October 1991) 9. Chaudhuri, B.B., Pal, U.: Skew Angle Detection of Digitized Indian Script Documents. IEEE Trans. on Pattern Analysis and Machine Intelligence 19(2), 182186 (1997) 10. Nvidia Corporation, CUDA Zone, http://www.nvidia.com

S-ar putea să vă placă și