Pattern recognition

Abstract: Pattern recognition, for instance optical character recognition, is achieved by training a neural network, scanning an image, segmenting the image to detect a pattern, preprocessing the detected pattern, and applying the preprocessed detected pattern to the trained neural network. The preprocessing includes determining a centroid of the pattern and centrally positioning the centroid in a frame containing the pattern. The training of the neural network includes randomly displacing template patterns within frames before applying the template patterns to the neural network.

Description: The present invention relates generally to image processing and specifically to recognition of patterns, such as optical characters, by applying detected patterns to a neural network trained to recognize such patterns as corresponding to one of a set of pattern templates. Numerous schemes have been proposed for pattern recognition in the past. A great deal of research and development has occurred, particularly in the area of optical character recognition (OCR). See, for example, S.N. Srihari, V. Govindaraju, J.J. Hull, R.K. Fenrich and S. Lam, "Pattern Recognition, Character Recognition and Optical Character Readers", Technical Report CEDAR-TR-91-1, Center for Document Analysis and Recognition, State University of New York at Buffalo, Buffalo, N.Y., May 1991. Known schemes for OCR vary widely in their approaches. Some early attempts superimposed bit maps of detected images over templates of known characters. Such schemes were extremely sensitive to such factors as font differences, skewing, enlargement, and reduction. Other approaches concentrated on extracting particular features from detected characters. Results varied depending on the particular selection and processing of features. U.S. Patent No. 3,846,752 to Nakano et al. discloses character recognition apparatus using the density distribution of a character. The frequency spectrum of the density distribution is compared to that of density distributions corresponding to known characters, and the known character with the Fourier transform spectrum pattern most similar to that of the detected character is output as the recognized character. U.S. Patent No. 4,817,176 to Marshall et al. discloses another pattern recognition scheme using Fourier transformation, with various corrections for amplitude and phase differences. U.S. Patent No. 3,930,231 to Henrichon, Jr., et al. discloses use of a multiple cell grid for detection of pattern density and feature recognition. A vector signal is generated for a detected character based on the presence or absence of each recognizable feature, and this vector is compared with vectors representing known characters. U.S. Patent No. 3,993,976 to Ginsburg discloses pattern analysis using a transform to obtain spatial frequencies. The spatial frequencies are filtered to extract pattern information for determining general form, edge, texture, and depth information of the detected pattern. U.S. Patent No. 4,513,441 to Henshaw discloses comparison of two images by forming a composite overlay of the images and examining phase differences therein. In other arts, U.S. Patent No. 4,225,850 to Chang et al. discloses use of Fourier transform techniques to detect regions of an image field not containing fingerprint images. U.S. Patent No. 4,547,800 to Masaki discloses detection of positional deviations of workpieces by making parallel transformations and rotations on workpiece images and making comparisons with reference image information. U.S. Patent No. 4,346,405 to Yoda et al. discloses detection of temporal changes in television images by dividing a television screen into blocks and processing X-Y data for visual information therein. U.S. Patent No. 4,241,329 to Bahler et al. discloses speech recognition using spectral statistics to recognize a keyword in a continuous audio signal. U.S. Patent No. 3,760,356 to Srivastava discloses a technique for determining, within a set of binary numbers, an extreme binary number. Neural networks have also been applied to the task of OCR. In J. Loncelle, et al., Optical Character Recognition and Cooperating Neural Networks Techniques, ARTIFICIAL NEURAL NETWORKS, 2, I. Aleksander and J. Taylor, Ed., Elsevier Science Publishers, B.V., 1992, a neural network-based OCR system is described that yields error probabilities on the order of 10 -2 . In A. Khotanzad and J. Lu, Classification of Invariant Image Representations Using a Neural Network, 38 IEEE TRANSACTIONS ON ACOUSTICS, SPEECH, AND SIGNAL PROCESSING 6, pp. 1028 - 1038, June 1990, another neural network-based OCR system is described that yields perfect recognition accuracy for images having high signal-to-noise ratios, but relatively poor accuracy for noisy images. It is known from Himes, G.S. et R.M. Inigo "Centroid calculation using neural networks" J. of Electronic Imaging, vol. 1, no. 73, January 1992 pages 73-87, to provide a target recognition system in which an input image is segmented, a centroid calculated, and image shifting applied in accordance with the centroid calculation prior to recognition using a neural network. Grey level pixel values or binary pixel values may be processed. It is also known from Khotanzad, A. et J.H. Lu "Distortion invariant character recognition by a multilayer perceptron and back-propagation learning" Int. Joint conf. on Neural Networks, 24 July 1988, San Diego, CA, to provide optical character recognition of an image which is subject to preprocessing, feature extraction, and classification using a neural network. The image preprocessing consists of thresholding to binarise the image prior to feature extraction and recognition. None of these teachings provides an adequately robust technique for recognizing optical characters or other patterns as corresponding to one of a known set of patterns in situations where the image is corrupted by a significant amount of noise. The present invention seeks to address the above problems. In accordance with the present invention there is disclosed a method of recognizing a pattern in an image as corresponding to one of a set of predetermined template patterns comprising the steps of: inputting image data including the pattern to be recognized; detecting said pattern by segmenting the data to obtain a detected pattern; preprocessing the detected pattern to produce a preprocessed detected pattern; applying the preprocessed detected pattern as input to a neural network trained for recognizing said predetermined template patterns; and recognizing said preprocessed detected pattern by operation of said neural network to output an output signal representative of one of said predetermined template patterns to which the detected pattern corresponds; characterised in that said detected pattern is represented by a map of pixels each having a multi-bit pixel value and in that the step of preprocessing comprises the substeps of: (a) determining complements of each of said pixel values; (b) selecting as a noise value a minimum of said complements; (c) subtracting from each of said complements said noise value; and (d) selectively replacing said complements with a baseline value in response to said complements not exceeding a predetermined threshold value. In accordance with a described embodiment, a detected pattern is recognized among a set of known template patterns by first training a neural network with the known template patterns, the preprocessing the detected pattern, then applying the preprocessed detected pattern to the neural network. In one embodiment, training of the neural network includes preprocessing in which the position of each of a set of template patterns within a pattern frame is randomly shifted. Preprocessing is accomplished by inverting values of multi-valued pixels comprising the detected pattern, determining a noise level and subtracting it from the pixel values, and assigning new baseline values to pixels having values below a certain threshold. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 is a functional block diagram of apparatus for pattern recognition in accordance with the present invention. Figure 2 is a functional block diagram of a preprocessor for the apparatus of Figure 1, in accordance with the present invention. Figure 3 is a functional block diagram of a neural network in accordance with the present invention. Figure 4 is a functional block diagram of one neuron of the neural network of Figure 3, in accordance with the present invention. Figure 5 is a flow diagram illustrating steps used in training a neural network, in accordance with the present invention. Figure 6 is a flow diagram illustrating processing steps for pattern recognition in accordance with the present invention. DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS Referring now to Figure 1, there is shown a system 100 for pattern recognition in accordance with the present invention. Briefly, the system 100 is comprised of four major functional blocks. Scanner 102 is used to obtain a two-dimensional array of pixel values representing the scanned image, including the pattern to be recognized. Segmenter 104 detects the pattern by separating it from other image elements. Preprocessor 106 performs processing on the detected pattern to facilitate pattern recognition. Neural network 108 takes as input the detected, preprocessed pattern and provides as output a signal representative of the recognized pattern. In a preferred embodiment, a conventional scanner 102 and segmenter 104 are used to implement the invention. In a preferred embodiment, scanner 102 is a "ScanJet IIc" model digital scanner from Hewlett Packard Co., and provides a resolution of 400 dots (pixels) per inch, each pixel being quantized with an eight-bit gray scale resolution. Segmenter 104 is implemented conventionally through software operating on a conventional general-purpose 33 MHz IBM-compatible personal computer using a model 80486 microprocessor. Preprocessor 106 is described in greater detail in Figure 2, and neural network 108 is described in greater detail in Figures 3 and 4. Referring now to Figure 2, preprocessor 106 is comprised of five major functional blocks. Inverter 202 takes as input a 50 pixel wide by 60 pixel high representation of the detected pattern image obtained from segmenter 104 and replaces each pixel value thereof with a value that is the complement of the original pixel value. The effect of this operation is to invert the white portions of the image to black, and the black portions of the image to white. In a preferred embodiment, scanner 102 and segmenter 104 provide as output a gray-scale, rather than black-and-white, image, so inverter 202 also changes light gray pixels to dark gray, and dark gray pixels to light gray. In a preferred embodiment, scanner 102 and segmenter 104 provide an image resolution of 400 dots (pixels) per inch over a 3000 square pixel frame (50 pixels wide by 60 pixels high). Noise filter 204 performs two functions. First, noise filter 204 determines the minimum pixel value of the detected and inverted pattern, and subtracts that value from each pixel of the pattern. Thus, the minimum pixel value for each pattern becomes zero. Second, noise filter 204 compares each resulting pixel value with a minimum threshold value, and replaces all pixel values below that threshold with a "baseline" value. In a preferred embodiment, the threshold is set at 20% of the maximum pixel value in the pattern, and the baseline value is at zero. It has been found that this pixel value replacement reduces the sensitivity of system 100 to background noise without significantly impairing recognition accuracy. The output of noise filter 204 is applied to centroid positioner 206. Centroid positioner 206 first determines the centroid of the noise-filtered pattern, the centroid being a location defined by taking a weighted average of the coordinates of the pixels in the pattern, the weights corresponding to the pixel values. Once the centroid is determined, the entire pattern is shifted so that the centroid lies at the center of the 50 x 60 frame described above. The output of centroid positioner 206 is applied to dithering processor 208. Dithering processor 208 randomly shifts the position of an applied pattern before applying the pattern to normalizer 210 and eventually neural network 108, but performs this function only when neural network 108 is being trained. In a preferred embodiment, the random shift is independent in the horizontal and vertical directions over the range [-2, +2] pixels in each direction from the centroid. The purpose of such shift in location is to ensure recognition that is invariant to input displacements. Dithering processor 208 makes such shifts only during training of neural network 108, and performs no function during recognition. The output of dithering processor 208 is applied to normalizer 210, which forms a vector of dimension 3000 by concatenating each of the 60 rows of pixels comprising the noise-reduced and positioned pattern, and then scales this vector to be of unit length by multiplying each pixel value by an overall scaling value. This normalization acts as an automatic brightness adjustment to ensure that recognition is insensitive to relative darkness or lightness of a pattern. In a preferred embodiment, the centroid-positioned and possibly dithered pattern is applied to normalizer 210, but those skilled in the art will recognize that the pattern need not first be positioned before normalization. In an alternative embodiment, the output of noise filter 204 could be applied to normalizer 210 before positioning by centroid processor 206 and possible dithering by dithering processor 208. Whichever topology is used, the normalized, centroid-positioned pattern is then applied to neural network 108 for recognition. Referring now to Figure 3, the constituent elements of a neural network such as network 108 of Figure 1 are shown. In a preferred embodiment, neural network 108 has 3000 inputs, one for each pixel value of a 50 x 60 pixel applied pattern, and is implemented in a fully-connected feed forward architecture, i.e., each neural output from one layer is fed to each neural input of the next layer, and data flow only from left to right in Figure 3. For the sake of clarity, the neural network inputs are shown as a single input in Figure 3. Neural network 108 has two levels of neurons, e.g., 261 and an output comparator 395. A first level of neurons, e.g., neurons 261 - 280, consists of 20 neurons, each of which is connected to all 3000 of the inputs discussed above, and each of which provides an output signal. A second level of neurons, e.g., neurons 301 - 394, consists of 94 neurons, each of which accepts as input the output signals from each of the first level neurons, e.g., 261. Each of the second level of neurons, e.g., 301, produces a single output signal. Output comparator 395 accepts as input the signals produced by second level neurons, e.g., 301, and produces a signal indicative of which of the second level neurons, e.g., 301, has produced the largest output signal. Using the architecture illustrated in Figure 3, 94 different patterns may be recognized, one for each of the second layer of neurons, e.g., 301. In general, the number of layers and the number of neurons per layer need not be constrained to the {3000, 20, 94} architecture described above. However, some architectures will provide better results than others. For instance, the last layer, or output layer, should have as many neurons as the desired number of recognizable patterns. Furthermore, the other layers are constrained to some extent by the number of degrees of freedom required to unambiguously recognize the patterns based on the number of input signals available. It has been found that the {3000, 20,94} architecture described above provides extremely good results in practice. In a preferred embodiment, the neural network 108 is implemented in a conventional manner well known to those skilled in the art, by programming a general purpose personal computer. Referring now to Figure 4, there is shown greater detail of a neuron, e.g., 301 of Figure 3. Neuron 301 accepts as input a logical "1" signal to a bias weight element 400 and also accepts as inputs the output signals from neurons 261 - 280 to corresponding weight elements 401 - 420, respectively. Each element 400 - 420 multiplies the signal applied to it by scalar quantities w1 - w20, respectively. The set of scalar quantities w1 - w20 may be thought of as forming a 20-dimensional vector W. The actual values of scalar quantities w1 - w20 are adjusted in the course of training the neural network, discussed below. The outputs of elements 400 - 420 are summed by adder 450 and then applied to a sigmoid function 451. In a preferred embodiment, the particular sigmoid equation used by sigmoid function 451 is: Sgm ( s )≡ 1 1+ e -( s ) where s is any signal applied to sigmoid function 451. Thus, if the input signals from neurons 261 - 280 are denoted as a vector X and if the scalar quantities w1 - w20 are denoted as vector W , the overall transfer function for the neuron 301 is given by the equation: ƒ( X,W )= 1 1+ e -( X T W +ω 0 ) where X T W is the dot product of vectors X and W . Referring now to Figure 5, there is shown a flow diagram illustrating the steps involved in training a neural network, e.g., 108, in accordance with the present invention. Training 501 commences by scanning 502 an image containing a template pattern for which recognition is desired, for instance the letter "E". As described above in connection with preprocessor 106, the template image is inverted 503 by taking the complement of the pixel values for the image, a "noise" pixel value is determined 504 and then subtracted 505 from each of the pixel values, and those pixel values below a given threshold are replaced 506 by a "baseline" pixel value. Next, a 50 x 60 pixel frame is defined 507 around the template pattern. Typically, definition of such a frame is inherent in the operation of segmenter 104, and the frame so defined may be used directly in step 507. Next, the centroid of the template pattern is determined 508 and the entire template pattern is repositioned 509 so that the centroid is centered within the frame. The template pattern is then displaced 510 by a random number of pixels in the vertical and horizontal dimensions, normalized 511 to correspond to a unit length as discussed above, and the resulting pattern is applied 512 to the neural network. The actual operation of the neural network in training is conventional back propagation, as described in numerous references on the subject, such as A. Dengel, A. Luhn, and B. Verberreiter, "Model Based Segmentation and Hypothesis Generation for Recognition of Printed Documents," Proceedings of the SPIE, Vol. 860, pp. 89-94, 1988. As a result of such training, the scalar quantities w1 - w20 discussed above in connection with Figure 4 are determined. In a preferred embodiment, a 12-pt. Courier font typeface is used to provide template patterns, and approximately 430,000 training iterations are employed to yield an error probability on the order of 10 -6 . Referring now to Figure 6, there is shown a flow diagram of operation of system 100 in accordance with the present invention. Subsequent to the training discussed above in connection with Figure 5, operation commences by scanning 601 an image for which pattern recognition is desired. The image is then segmented 602 to obtain the individual patterns comprising the image. Next, a check 603 is made to determine whether processing for all such patterns is complete. If so, processing is complete. Otherwise, as previously described, the pattern is inverted 604 by taking the complement of the pixel values, a noise pixel value is determined 605 and subtracted 606 from each of the pixel values, those pixels values below a threshold are replaced 607 with a baseline value, a frame is defined 608 around the pattern, the centroid of the pattern is determined 609, and the pattern is positioned 610 so that the centroid is located in the center of the frame. Upon completion of these steps, the pattern is applied 611 to the neural network for recognition, and processing returns to step 603. While the discussion above has focused on optical recognition of printed characters, the present invention may also be applied to other types of pattern recognition as well. For example, a sound image rather than an optical image may effectively be preprocessed for neural network recognition by subtracting a noise level from each dimension of a time- or frequency-based vector representation of the sound image, by normalizing such a vector representation, or by replacing below-threshold components with a baseline value. Thus, the present invention may find application in areas other than optical character recognition. Therefore, pattern recognition is achieved by training a neural network with template patterns, detecting and preprocessing a pattern for which recognition is desired, and applying the detected, preprocessed pattern to the trained neural network. The above description is included to illustrate the operation of particular embodiments and is not meant to limit the scope of the invention.

Claims: A method of recognizing a pattern in an image as corresponding to one of a set of predetermined template patterns comprising the steps of: inputting (601) image data including the pattern to be recognized; detecting (602) said pattern by segmenting the data to obtain a detected pattern; preprocessing (604 to 610) the detected pattern to produce a preprocessed detected pattern; applying (611) the preprocessed detected pattern as input to a neural network (108) trained for recognizing said predetermined template patterns; and recognizing said preprocessed detected pattern by operation of said neural network to output an output signal representative of one of said predetermined template patterns to which the detected pattern corresponds; characterised in that said detected pattern is represented by a map of pixels each having a multi-bit pixel value and in that the step of preprocessing comprises the substeps of: (a) determining (604) complements of each of said pixel values; (b) selecting (605) as a noise value a minimum of said complements; (c) subtracting (606) from each of said complements said noise value; and (d) selectively replacing (607) said complements with a baseline value in response to said complements not exceeding a predetermined threshold value. A method as claimed in claim 1, wherein the step of preprocessing further comprises filtering pixel values by selectively assigning a predetermined filtered pixel value to a subset of said pixels responsive to said values of said pixels in said subset not exceeding a threshold value. A method as claimed in any preceding claim, wherein the step of segmenting includes defining (608) a frame around said detected pattern and wherein the step of preprocessing further comprises: (a) determining (609) a centroid of said detected pattern; and (b) positioning (610) said detected pattern within said frame such that said centroid is centrally located with respect to said frame. A method as claimed in any preceding claim wherein said inputting step comprises scanning an image using an optical scanner (102). A method as claimed in any preceding claim comprising a step of training said neural network, said training step comprising the substeps of: inputting (502) image data comprising at plurality of template images representative of said predetermined template patterns and, for each template image corresponding to a respective one of the template patterns, (a) defining (507) a frame around said template image; (b) determining (508) a centroid of said template image; (c) positioning (509) said one template image within said frame such that said centroid is centrally located with respect to said frame; (d) randomly displacing (510), subsequent to substep (c), said one template image within said frame; and (e) applying (512) said randomly displaced template image to said neural network. Apparatus (100) for recognizing a pattern in an image as corresponding to one of a set of predetermined template patterns, the apparatus comprising: input means (102) operable to input image data including the pattern to be recognized; detecting means (104) operable to detect said pattern by segmenting the data to obtain a detected pattern; preprocessing means (106) operable to preprocess the detected pattern to produce a preprocessed detected pattern; and a neural network (108) trained for recognizing said predetermined template patterns and operable to recognize said preprocessed detected pattern by outputting an output signal representative of one of said predetermined template patterns to which the detected pattern corresponds; characterised in that the detected pattern is represented by a map of pixels each having a multi-bit pixel value and in that preprocessing means comprises: (a) determining means (604) operable to determine complements of each of said pixel values; (b) selecting means (605) operable to select as a noise value a minimum of said complements; (c) subtracting means (606) operable to subtract from each of said complements said noise value; and (d) replacing means (607) operable to selectively replace said complements with a baseline value in response to said complements not exceeding a predetermined threshold value. Apparatus as claimed in claim 6, wherein the preprocessing means further comprises filtering means (204) operable to filter pixel values by selectively assigning a predetermined filtered pixel value to a subset of said pixels responsive to said values of said pixels in said subset not exceeding a threshold value. Apparatus as claimed in any of claims 6 and 7, wherein the segmenting means includes defining means (608) operable to define a frame around said detected pattern and wherein the preprocessing means further comprises: (a) determining means (206) operable to determine a centroid of said detected pattern; and (b) positioning means (206) operable to position said detected pattern within said frame such that said centroid is centrally located with respect to said frame. Apparatus as claimed in any of claims 6 to 8 wherein said inputting means comprises an optical scanner (102). Apparatus as claimed in any of claims 6 to 9, wherein said neural network comprises: a first layer (261 to 280) of neurons adapted to accept as input said preprocessed pattern signal and to produce therefrom a set of intermediate signals; a second layer (301 to 394) of neurons adapted to accept as input said intermediate signals and to produce therefrom a set of template merits; and comparator means (395) for determining a maximum of said template merits and producing said output signal in response thereto. Apparatus as claimed in claim 10, wherein said preprocessed pattern signal comprises 3000 of said multibit values; wherein said first layer of neurons comprises 20 neurons; and wherein said second layer of neurons comprises 94 neurons. Apparatus as claimed in claim 10, wherein said second layer of neurons (301-394) comprises the same number of neurons as the number of said known template patterns. Apparatus as claimed in any of claims 6 to 12, wherein said preprocessing means (106) comprises eliminating means (202,204) operable to eliminate noise from said image signal. Apparatus as claimed in claim 8 comprising dithering means (208) operable during training of the neural network to randomly displace the position of a template image within said frame.

Inventors: AVI-ITZHAK HADAR I, GARLAND HARRY T, THAN A DIEP, AVI-ITZHAK,HADAR I., GARLAND,HARRY T.
Applicants: CANON KK, CANON KABUSHIKI KAISHA
Application year: 1994
Main classification: G06K9
IPC codes: G06T7, G06K9, G06T1