# Patent

## Title
Semi-supervised method for training multiple pattern recognition and registration tool models

## Abstract

A system and method for training multiple pattern recognition and registration models commences with a first pattern model. The model is trained from multiple images. Composite models can be used to improve robustness or model small differences in appearance of a target region. Composite models combine data from noisy training images showing instances of underlying patterns to build a single model. A pattern recognition and registration model is generated that spans the entire range of appearances of the target pattern in the set of training images. The set of pattern models can be implemented as either separate instances of pattern finding models or as a pattern multi-model. The underlying models can be standard pattern finding models or pattern finding composite models, or a combination of both.

## Background
RELATED APPLICATIONS
This application is a divisional of co-pending U.S. patent application Ser. No. 13/955,120, filed Jul. 31, 2013, entitled A SEMI-SUPERVISED METHOD FOR TRAINING MULTIPLE PATMAX MODELS, which application claims the benefit of U.S. Provisional Application Ser. No. 61/841,142, filed Jun. 28, 2013, entitled A SEMI-SUPERVISED METHOD FOR TRAINING MULTIPLE PATMAX MODELS, the entire disclosures of each of the above applications are herein incorporated by reference.


FIELD OF THE INVENTION
The present invention relates to machine vision where images of objects are obtained using a camera or other imaging device where locating a target pattern in the image corresponds to locating the pattern on the object being imaged.
BACKGROUND OF THE INVENTION
A challenge in machine vision systems is to make them user friendly and accessible to a broader range of potential users. There are certain aspects that users understand clearly (for example, how to generate a set of training images) and what the ground truth of the situation is. However, beyond that, many of the aspects of training and run-time operation of the machine vision systems will be more difficult to apply.
In machine vision where images of objects are obtained using a camera or other imaging device and where a pattern on the object being imaged is located using a method that executes on a computer or other computing device. Given a set of images, each of which contains at least one instance of a target pattern, but where the target pattern may vary in appearance, it can also be a challenge to identify and train a minimum set of pattern recognition and registration models that are applicable for all images in the image set. The pattern recognition and registration procedure is described in greater detail in U.S. Pat. Nos. 6,408,109; 6,658,145; and 7,016,539, the disclosures of which are incorporated by reference as useful background information. If a pattern is recognized, the pattern recognition and registration procedure (or “tool”) confirms that the viewed pattern is, in fact, the pattern for which the tool is searching and fixes its position, orientation, scale, skew and aspect. An example of such a search tool is the PatMax® product available from Cognex Corporation of Natick, Massa., USA. The pattern recognition and registration procedure is a method of geometric pattern finding. The methods described herein apply generally to geometric pattern finding.
For example, a pattern might consist of elements containing circles and lines. Referring to FIG. 1, pattern 110 includes a circle 112 and two intersecting lines 114, 116; pattern 120 includes a circle 122 and a pair of lines 124, 126; and pattern 130 includes a circle 132 and a pair of lines 134, 136. Across the image set of trained images, the circles may vary in radius and the lines vary by thickness or number. This may be particularly so in the field of semiconductors or other materials in which a plurality of layers are deposited on a substrate, which can lead to distortion of features on each of the layers. The polarity of the patterns may also change throughout the image set (as shown in the difference between pattern 120 and pattern 130. The images may also contain a high degree of noise.
The problem has at least two components. First, the training image set consists of noisy images so it is difficult to train a clean model from a single image. Second, the pattern has different appearances in the training set which makes training a single model both difficult and prone to error at runtime.
SUMMARY OF THE INVENTION
To overcome the disadvantages of the prior art, the systems and methods herein use a pattern recognition and registration model to perform training Illustratively, a pattern finding model is a single model trained from multiple training images. In some embodiments, composite models can be used to either improve robustness over standard pattern recognition and registration models, and/or to model small differences in appearance of a target region. To improve robustness composite models combine data from noisy (or otherwise distorted) training images showing instances of a single underlying pattern to build a single robust model. To achieve this, a training element using the pattern recognition and registration model uses the input images and a known relative position, or pose (this human-identified or computer-determined).
To account for small differences in appearance of a target region, a training method is employed to train a set of pattern recognition and registration models that span the entire range (or at least a large portion of the entire range) of appearances of the target pattern in the training set. The set of pattern recognition and registration models can manifest as either separate instances of pattern models or as a pattern multi-model. A pattern multi-model is a collection of pattern recognition and registration models. The underlying models can be standard pattern recognition and registration models or a composite pattern model, or a combination of the two. The pattern multi-model is intended for use in modeling targets whose appearance varies significantly. The multi-model can be run in various modes to take advantage of prior knowledge of the likely temporal sequence model appearances. The incorporation of multiple pattern models within the pattern multi-model framework can be used to reduce the amount of front-end processing, thus allowing for incremental performance gains over running separate pattern model instances. The pattern multi-model can also examine results from its component models to filter for overlap, for example if results from two models overlap by more than a user specified threshold, then the pattern multi-model may only return the better match (or higher scoring) result to the user.



BRIEF DESCRIPTION OF THE DRAWINGS
The invention description below refers to the accompanying drawings, of which:
FIG. 1, already described, shows three exemplary images each including a pattern, according to a pattern recognition and registration procedure;
FIG. 2 is a schematic block diagram of an exemplary machine vision system for practicing the principles of the present invention in accordance with an illustrative embodiment;
FIG. 3 is a flow chart of a procedure for training a single pattern recognition and registration model, in accordance with the illustrative embodiments;
FIG. 4 is a flow chart of a procedure for training a pattern multi-model and measuring performance of a currently trained output model, in accordance with the illustrative embodiments;
FIG. 5 is a flow chart of a procedure for proposing and ranking candidates for addition of the output model collection, in accordance with the illustrative embodiments; and
FIG. 6 is flow chart of a procedure for proposing the highest scoring candidate to the user and outputting pattern multi-models, in accordance with the illustrative embodiments.



DETAILED DESCRIPTION
FIG. 2 is a schematic block diagram of a machine vision system 200 that may be utilized to practice the principles of the present invention in accordance with an illustrative embodiment. The machine vision system 200 includes a capturing device 205 that generates an image of an object 210 having one or more features 215. The capturing device 205 can comprise a conventional video camera or scanner. Such a video camera can be a charge coupled device (CCD) or other system for obtaining appropriate image information, such as the well-known CMOS sensors. Image data (or pixels) generated by the capturing device 205 represents an image intensity, for example, color or brightness of each point in the scene within the resolution of the capturing device 205. The capturing device 205 transmits a digital image data via a communications path 220 to an image analysis system 225. The image analysis system 225 can comprise a conventional digital data processor, such as the vision processing systems of the type commercially available from, for example, Cognex Corporation. The image analysis system 225 can comprise a conventional microcomputer or other exemplary computing device. Other forms of interfaces can be utilized, including, e.g., personal digital assistants (PDAs), etc. In alternative embodiments, the capturing device can include processing capabilities to perform the functions of the image analysis system. In such embodiments, there is not a need for a separate image analysis system. In further alternative embodiments, a capturing device can be operatively interconnected with an image analysis system for training purposes. Once training has occurred, an appropriate model or models can be stored in the capturing device for use during run time.
The image analysis system 225 can be programmed in accordance with the teachings of the present invention to find similar features among a plurality of images to generate appropriate recognition and registration information for training a machine vision system. The image analysis system 225 can have one or more central processing units (processors) 230, main memory 235, input/output systems 245 and one or more disk drives or other form of mass storage 240. Illustratively, the input/output system 245 interconnects with the communications path 220 between the capturing device 205 and the image analysis system 225. The system 225 can be configured by programming instructions in accordance with the teachings of the present invention to perform the novel multi-image trained pattern recognition and registration of the present invention. As will be appreciated by those skilled in the art, alternative hardware and/or software configurations can be utilized to implement the principles of the present invention. Specifically, the teachings of the present invention can be implemented in software, hardware, firmware and/or any combination thereof. Furthermore, during run-time, as opposed to training time, additional components can be included in the machine vision system 200. For example, objects 215 can be transported by a conveyor belt or other assembly line apparatus, etc.
In accordance with an illustrative embodiment of the present invention, the machine vision system 200 can be utilized to generate the training model for a run-time machine vision system. Thus, the machine vision system 200 can be utilized to generate a training model that can be utilized in a plurality of machine vision systems utilizing similar components.
Moreover, it should be noted that the pattern element (or pattern recognition and registration element) as shown and described herein, and their associated models, generally reside within the image analysis system 225. However, the placement and storage of the elements and models are highly variable within ordinary skill.
It should be noted that while the present invention is described in terms of a machine vision system 200, the principles of the present invention can be utilized in a variety of differing embodiments. As such, the term machine vision system should be taken to include alternative systems. More generally, the principles of the present invention can be implemented on any system that registers subpatterns in images. For example, one embodiment can involve a conventional machine vision system comprising of a stand alone camera operatively interconnected with a stand alone computer programmed to process images, etc. However, the principles of the present invention can be utilized in other devices and/or systems that register subpatterns in images. For example, a vision sensor, such as the Checker product available from Cognex Corporation, or other device that comprises illumination sources, image acquisition capabilities and/or processing capabilities. Such vision sensors can be trained and/or configured via separate modules, such as a Cognex Vision View. In such embodiments, the user can train the vision sensor using a plurality of parts, instead of a single part. The user can select a first part, place it in front of the sensor and indicate to the system that the training part is positioned. A second (third, etc.) part can be similarly trained. The user can control the training step using, e.g., a graphical user interface (GUI) and/or buttons or other control surfaces located on either the training module and/or the vision sensor itself. Furthermore, the functionality of the present invention can be incorporated into handheld devices, wireless compatible devices, etc. As such, the term machine vision system should be interpreted broadly to encompass all such systems and devices that can utilize one or more of the teachings of the present invention.
Training a Single Pattern Recognition and Registration Model
In accordance with the illustrative embodiments, a pattern recognition and registration model is trained from multiple images. Refer, for example, to U.S. Pat. No. 8,315,457, the disclosure of which is incorporated by reference as useful background information, for a more detailed description of training a single pattern recognition and registration model. Composite models can be used to either improve robustness over standard pattern models, or to model small differences in appearance of a target region. A training element implemented herein trains a set of pattern recognition and registration models that span the entire range of appearances of a target pattern in a set of training images. The set of models can be a single pattern recognition and registration model, or a collection of models termed herein a pattern “multi-model” element. The multi-model element is intended for use in modeling targets those appearance varies significantly. The multi-model can be run in various modes to take advantage of prior knowledge of the likely temporal sequence model appearances.
As used herein, the term “training element” (or training module) refers to the non-transitory embodiment of the steps carried out in generating a training model. The training element is part of a non-transitory computer program that contains one (or several) routines or functions that are dedicated to perform a particular task. Each element (or module) as shown and described herein, can be used alone or combined with other modules within the machine vision system. The training element creates the training model by training a set of models that span the entire range of training images contained in the database. Additionally, as used herein, the term “pattern recognition and registration model” or “pattern model” refers generally to the pattern models disclosed in the '457 patent, unless otherwise noted.
Reference is now made to FIG. 3 showing a flow chart of a procedure 300 performed by a training element for training a single pattern recognition and registration model, in accordance with the illustrative embodiments. At step 310, the initial input to the algorithm (which can be user-provided or computer-provided) is an initial training image and a region specifying the pattern to be trained (a “region of interest”) that can also be user-provided or computer-provided. The procedure 300 takes this input and at step 320 trains a first (initial) pattern recognition and registration (“PatMax”) model (P0) using training parameters at 325. Next, at step 330, the system iterates over the image set (at least a portion, or subset, of the remaining training images) running the pattern model P0, with the image set being provided by the user or by a computer having been previously stored in a database. The system can iterate the model over the entire remaining training image set or a portion of the remaining image set and stores the result scores, poses and matching region data. At step 340 the results are sorted in order of score (and if a ground truth data is available, in order of accuracy). The ground truth can be user-supplied or computer-generated. At step 350, the procedure inputs the top image (NC−1) (where NC is a parameter specifying the number of images should be input to the composite model training) and at step 360, trains a composite model using the pose and region information from the results previously generated in the running of P0.
As described in greater detail in U.S. Pat. No. 8,315,457, incorporated herein by reference as useful background information, multi-image training is performed for pattern recognition and registration. A machine vision system obtains a plurality of (“N”) training images. One image is selected and the other (N−1) images are then substantially registered to the selected image. The selection and registration is iterated so that each of the N images is utilized as the baseline image. By iterating for each of the N images as a baseline image, the procedure builds up a database of corresponded features that can be utilized in building a model of features that are stable among the images. Then features that represent a set of corresponding image features are added to the model. To build the database of corresponded features, each of the features can be corresponded using a boundary inspection tool or other conventional techniques to correspond contours in machine vision systems. Illustratively, those features selected for the model are those that minimize the maximum distance among the corresponding features in each of the images in which the feature appears. The feature to be added to the model can comprise an average of the features from each of the images in which the feature appears. The process continues until every feature that meets a threshold requirement is accounted for. The model that results from this process represents those stable features that are found in at least the threshold number of the N training images. This process (described in the '457 patent) identifies those features that are sufficiently supported by the evidence of the training images that they are stable features. The model can then be used to train an alignment, search or inspection tool with the set of features.
Referring back to FIG. 3, the user can supply additional composite model training parameters 355 that specify what fraction of the NC training images must contain a particular feature for it to be included in the output model. Illustratively, the fraction can be a percentage, such as 80% to 90%, but is highly variable within ordinary skill and depending upon the particular application. The user can also specify a proximity threshold for features from different training images to be considered a match.
Training a Pattern Recognition and Registration Multi-Model
Reference is now made to FIG. 4 showing a flow chart of a procedure 400 for training a pattern recognition and registration multi-model, and measuring performance of a currently trained output model, in accordance with the illustrative embodiments. At step 410, the initial inputs to the procedure (generally from a user, but can also be computer-provided) are: a training image (I0), a region R0 specifying the extent of a pattern within the image I0, the origin of the pattern (O0) within the training image I0 and a set of training images {I1, I2, . . . , IN} showing the range of appearances of the pattern of interest.
The procedure uses these inputs at step 420 to train a first “PatMax” pattern composite model (PCMOUT0) using the above-described procedure for training a single pattern recognition and registration model, shown in FIG. 3, according to composite model parameters 422. The training parameters 424 are used in training the output model (TPOUT), and are restrictive enough to ensure that the trained model will not produce high scoring false finds in a search over the full set of training images. If using the pattern recognition and registration multi-model framework, then PCMOUT0 will be added to the output multi-model, PMMOUT. If not using the multi-model framework, then it will be stored as the first pattern recognition and registration model of the output set (this is also called PMMOUT0 for descriptive purposes).
Next, at step 430, the procedure uses the same inputs (from 410) to train a different (second) pattern recognition and registration model PCMCAND0 using the previously described algorithm shown in FIG. 3 for a single pattern recognition and registration model. The pattern training parameters TPCAND 434 used in this process will also be those for training a model used exclusively for finding candidates for training further output composite models. These training parameters 434 should be more relaxed than those used to produce the output models. The governing premise is that PCMCAND0 is able to propose a more diverse range of training candidates than would be possible using the more restrictively trained PCMOUT0 but any false finds can be rejected by the user, or automatically based on known ground truths. As for the output model, PCMCAND0 can either be added to a pattern recognition multi-model PMMCAND or added to or stored in some other type of model collection.
Performance Measurement
At step 440, prior to commencing the process of finding pattern candidates and training those that are considered the “best” (highest score or match), the system must first measure the performance of the currently trained output model, i.e. PMMOUT. To measure the performance, the procedure runs the model over the entire test set of images and calculates a combined score which is initialized to 0. If PMMOUT finds the pattern in an image with a score (the score range is between 0 and 1) greater than a user-defined confidence threshold, then that score is added to the combined score. However, if PMMOUT fails to find the pattern in an image with a score greater than a user defined confidence threshold, then 1 is subtracted from the combined score. Other similar scoring functions can be implemented by those having ordinary skill and may incorporate a measure of alignment accuracy if ground truth data is available.
After performance measurement, the remaining steps of the procedure can be repeated iteratively, and are thus denoted with the variable ‘t’. Reference is now made to FIGS. 5 and 6, showing flow charts of procedures for proposing candidate models in accordance with the illustrative embodiments. With reference to FIG. 5, the procedure 500 is for proposing and ranking candidates for addition to the output model collection, PMMOUT(T). At 510, the inputs to iteration (t) include candidate and output multi-models, PMMCAND(t), PMMOUT(t) where

PMMCAND(t) contains {PCMCAND(0),PCMCAND(1), . . . ,PCMCAND(t)}

and

PMMOUT(t) contains {PCMOUT(0),PCMOUT(1), . . . ,PCMOUT(t)}

At step 520 of the procedure, the candidate multi-model PMMCAND proposes and ranks candidates for addition to the output model collection PMMOUT(t). To accomplish this, the candidate pattern multi-mode, PMMCAND(t), is run on each training image Ii. If an acceptable result is returned (i.e., a location is found where the model scores higher than a user defined accept threshold), then at step 520 the matching region Ri and origin Oi, are used to train a candidate pattern composite model PCMOUT(i) (as described hereinabove regarding training a single model for PMMOUT(t). The candidate composite model is therefore trained from the candidate region Ri, of the image Ii and the corresponding regions of the best matching Nc−1 images of that candidate image region (Ri of the image Ii).
At step 530 the procedure iterates through the set of candidate pattern composite models, and for each, first adds it to the output collection PMMOUT(t)→PMMOUT(t)′, then measures its performance in an identical way to that described hereinabove in Performance Measurement. After obtaining the score for the proposed expansion to the output multi-model, PMMOUT(t)′, PCMOUT(i) is removed from PMMOUT(t)′→PMMOUT(t). At step 534, the candidates are sorted (i.e. the PCMOUT(i)) according to these scores.
At the end of the procedure 500, the system has a collection of candidate pattern composite models at step 540 that cover all training images where PMMCAND (t) could find an acceptable result. The procedure ranks these models according to how much improvement in coverage each provides to the output pattern model collection (or multi-model) PMMOUT(t). If no candidates are found to improve the score by more than a user-defined amount, then a stopping criterion can be deemed to have been met.
Reference is now made to FIG. 6 showing a procedure 600 for proposing candidate models and outputting pattern multi-models, according to the illustrative embodiments. At step 620, the procedure proposes the highest scoring candidate to the user (for example, by displaying the region of interest of the candidate within the candidate image Ii). At step 622, the user can accept or reject the candidate, or equivalently the computer may be presented with a highest scoring candidate and the computer accepts or rejects the candidate based on a known ground truth. If the candidate is accepted, then at step 630 the user can be given the opportunity to adjust the origin of the new model, in case of slight alignment errors in the output of PMMCAND(t). If the candidate is rejected at step 624, the top candidate PCMOUT(top) is discarded and the system proposes the next candidate in the ordered list.
If the candidate is accepted, then at step 640 the accepted candidate model PCMOUT(accepted) is added to the current output model collection PMMOUT(T)→PMMOUT(t+1). The candidate finder model collection (or multi-model) now should desirably be updated with a similar model. At step 650, the candidate model PCMCAND(accepted) is trained from the region Raccepted, of the image Iaccepted, using training parameters TPCAND. PCMCAND(accepted) is now added to PMMCAND(t)→PMMCAND(t+1) at step 660. The outputs to iteration (t) at step 670 are the candidate multi-model PMMCAND(t+1) and the output multi-model PMMOUT(t+1).
The various illustrative embodiments provide for generation of a pattern recognition and registration model that is iterated over each training image of a plurality of training images to provide a model that spans (i.e. is valid over) the entire database of training images. This improves robustness and efficiency of the run-time system.
The foregoing has been a detailed description of illustrative embodiments of the invention. Various modifications and additions can be made without departing from the spirit and scope of this invention. Features of each of the various embodiments described above can be combined with features of other described embodiments as appropriate in order to provide a multiplicity of feature combinations in associated new embodiments. Furthermore, while the foregoing describes a number of separate embodiments of the apparatus and method of the present invention, what has been described herein is merely illustrative of the application of the principles of the present invention. For example, as used herein the terms “process” and/or “processor” should be taken broadly to include a variety of electronic hardware and/or software based functions and components. Also, as used herein various directional and orientational terms such as “vertical”, “horizontal”, “up”, “down”, “bottom”, “top”, “side”, “front”, “rear”, “left”, “right”, and the like, are used only as relative conventions and not as absolute orientations with respect to a fixed coordinate system, such as gravity. Moreover, a depicted process or processor can be combined with other processes and/or processors or divided into various sub-processes or processors. Such sub-processes and/or sub-processors can be variously combined according to embodiments herein. Likewise, it is expressly contemplated that any function, process and/or processor herein can be implemented using electronic hardware, software consisting of a non-transitory computer-readable medium of program instructions, or a combination of hardware and software. Moreover, it is contemplated that some or all vision system processing tasks can be carried out either in the main module or in a remote processor (e.g. a server or PC) that is operatively connected through the interface module to the main module via a wired or wireless communication (network) link. Accordingly, this description is meant to be taken only by way of example, and not to otherwise limit the scope of this invention.

## Claims

1. A method for training a pattern recognition and registration multi-model, the method comprising the steps of:
providing at least one initial training image having a region specifying a pattern to be trained, the at least one initial training image being provided from a database containing a plurality of training images;
training a first pattern model from the at least one initial training image and the region and adding the first pattern model to an output multi-model;
iterating over the remaining training images of the plurality of training images so that for each training image,
(i) an additional pattern model may be trained,
(ii) a metric for the combination of the first and additional model may be scored over the remaining training images in the database;
adding the high scoring additional pattern model or models to the output multi-model.

2. The method as set forth in claim 1 wherein the training of the first pattern model is performed according to a first set of pattern recognition and registration training parameters and the training of the additional pattern model is performed according to a second set of pattern recognition and registration training parameters.

3. The method as set forth in claim 1 wherein the first and/or the additional pattern model comprises a composite model.

4. The method as set forth in claim 1 wherein the additional pattern model is trained by relaxing the degrees-of-freedom when generating candidate regions using the first model to train, and then tightening the degrees-of-freedom when the second pattern model is run, to determine if a metric improves.

5. The method as set forth in claim 4 wherein the metric comprises the score or the number of instances of features.

6. The method as set forth in claim 4 wherein the additional pattern model is trained from the initial training image and specified region but with different training parameters so that the additional pattern model will be more likely to find distorted, noisy or in some way modified instances of the original pattern;
proposing candidate regions using a second pattern model, for use in training additional pattern models.

7. The method as set forth in claim 1 wherein a pattern origin is an additional input to pattern model training.

8. The method set forth in claim 1 wherein the high scoring additional pattern model is first presented to a user to accept, reject or rescore, before possible addition to the output multi-model.

9. The method set forth in claim 1 wherein a user may modify the additional pattern origin before its addition to the output multi-model.

10. The method set forth in claim 1 wherein the training process for the additional pattern model is repeatedly iteratively, thus allowing the multi-model to expand to contain greater than 2 pattern models.

11. The method set forth in claim 10 wherein a stopping condition is applied; the stopping condition being derived from the relative improvement in the metric.

12. The method set forth in claim 1 but where supplied ground truths for the each of the plurality of images in the training image database may be used to accept or reject and/or correct the poses of candidate models for addition to the multi-model.