The present invention relates to an abnormal area detecting apparatus and an abnormal area detecting method for capturing an image to automatically detect an area which is different from normal areas.
Conventionally, in a test of a film on, for example, a flexible wiring board for defects, a broken line can be detected through electric conduction, but a reduction in thickness of a line, which can cause a defective product, cannot be detected through electric conduction. It is therefore necessary to detect abnormalities such as reduction in thickness through visual inspection or using an image.
For the visual inspection, a visual testing apparatus or the like must be utilized for enlarging an image because lines are fines. In addition, the coordinates and degree of defects must be output in order to provide feedback of the defects to manufacturing processes. Since this involves considerable efforts, a problem arises in that difficulties are encountered in fully testing a large amount of products.
Today, an abnormality test is therefore automated using images in many product tests. A testing approach employed therefor may be a pattern matching approach which involves matching with a reference image which has been registered for each product, by way of example.
On the other hand, a variety of techniques have been proposed for detecting a particular figure or the like from image data, and determining matching/unmatching with a registered image. The following Patent Document 1, filed by the present inventors, discloses a learning adaptive image recognition/measurement system which employs higher-order local auto-correlation features (hereinafter also referred to as “HLAC data”) for two-dimensional image.
Non-Patent Document 1: Juyang Weng, Yilu Zhang and Wey-Shiuan Hwang, “Candid Covariance-Free Incremental Principal component Analysis IEEE Transactions on Pattern Analysis and Machine Intelligence,” Vol. 25, No. 8, pp.1034-1040, 2003.
Non-Patent Document 2: Dorin Comaniciu and Peter Meer, Mean sift: A robust approach toward feature space analysis, IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 24, No. 5, pp. 603-619, 2002.
The pattern matching approach, which is a conventional abnormal area detecting approach, has such problems as the lack of flexibility and learning effects for objects, requirements for matching position and direction, a long processing time, and a low accuracy. Also, since conductors on a flexible wiring board are made of granular resin printed on a film, a problem arises in that difficulties are experienced in detecting a figure such as an edge of a line from an image, leading to difficulties in detecting defects.
On the other hand, a learning adaptive image recognition system using the higher-order local auto-correlation feature has a problem in that it cannot be applied to defect test because it cannot locate an object (defective area) due to position invariance which provides the same detection result wherever the object (defective area) is present on an image.
It is an object of the present invention to solve the problems of the conventional examples as described above, and to provide a high-speed and general-purpose abnormal area detecting apparatus and abnormal area detecting method which are capable of detecting the presence or absence of abnormalities as well as the positions thereof with high accuracy using the higher-order local auto-correlation feature.
An abnormal area detecting apparatus of the present invention is mainly characterized by comprising feature data extracting means for extracting feature data from image data on a pixel-by-pixel basis through higher-order local auto-correlation, pixel-by-pixel feature data generating means for adding the feature data extracted by the feature data extracting means for pixels within a predetermined range including each of pixels spaced apart by a predetermined distance, index calculating means for calculating an index indicative of abnormality of feature data generated by the pixel-by-pixel feature data generating means with respect to a subspace indicative of a normal area, abnormality determining means for determining an abnormality when the index is larger than a predetermined value, and outputting means for outputting the result of the determination which declares an abnormality for a pixel position for which the abnormality determining means determines as abnormal.
Also, the abnormal area detecting apparatus is characterized in that the feature data extracting means extracts a plurality of higher-order local auto-correlation feature data which differ in displacement width. Further, the abnormal area detecting apparatus is characterize in that the index indicative of an abnormality to a subspace includes information on either a distance or an angle between feature data and the subspace.
Also, the abnormal area detecting apparatus is characterized by further comprising principal component subspace generating means for finding a subspace indicative of a normal area based on a principal component vector from feature data extracted by the feature data extracting means in accordance with a principal component analysis approach. Also, the abnormal area detecting apparatus is characterized in that the principal component subspace generating means finds a subspace based on a principal component vector in accordance with an incremental principal component analysis approach.
Also, the abnormal area detecting apparatus is characterized by further comprising classifying means for finding an index of similarity based on a canonical angle of a subspace found from pixel-by-pixel feature data generated by the pixel-by-pixel feature data generating means to the subspace, and classifying each pixel using a clustering approach, wherein the principal component subspace generating means adds the feature data on a class-by-class basis to calculate a class-by-class subspace, and the index calculating means calculates an index indicative of abnormality of the feature data generated by the pixel-by-pixel feature data generating means with respect to the class-by-class subspace.
An abnormal area detecting method of the present invention is mainly characterized by including the steps of extracting feature data from image data on a pixel-by-pixel basis through higher-order local auto-correlation, adding the feature data for pixels within a predetermined range including each of pixels spaced apart by a predetermined distance, calculating an index indicative of abnormality of the feature data with respect to a subspace indicative of a normal area, determining an abnormality when the index is larger than a predetermined value, and outputting the result of the determination which declares an abnormality for a pixel position at which an abnormality is determined.
According to the present invention, effects are produced as follows.
(1) An abnormality can be determined on a pixel-by-pixel basis, and the position of an abnormal area can be correctly detected.
(2) Conventionally, the abnormality detection accuracy becomes lower if a large number of objects exist, but by appropriately selecting a predetermined area centered at a pixel, even a large number of objects under detection will not cause a lower determination accuracy for an abnormal area.
(3) Since a small amount of calculations is sufficient for feature extraction and abnormality determination, and the calculation amount is fixed irrespective of objects, fast processing can be performed.
(4) Since normal areas are statistically learned without positively defining them, it is not necessary to define what the normal area is at the stage of designing, and a detection can be made in conformity to an object under monitoring. Further, no supposition is required for an object under monitoring, and a variety of objects under monitoring can be determined to be normal or abnormal, and a high flexibility can be provided. Also, by updating a subspace of normal areas simultaneously with the abnormal determination, changes in normal areas can be followed.
(5) Even if there are a plurality of classes in objects, the objects is classified according to the position, thereby further improving the detection accuracy. Also, the classification may be previously processed, or the classification can be automatically updated simultaneously with the abnormality determination.
10 . . . Digital Camera
11 . . . Computer
12 . . . Monitor Device
13 . . . Keyboard
14 . . . Mouse
In this specification, an abnormal area is defined to be “one which is not a normal area.” Assuming that the normal area is, when considering statistical distributions of areal features, an area in which the distribution concentrates, it can be learned as a statistical distribution without a teacher. Then, the abnormal area refers to an area which largely deviates from the distribution.
As a specific approach for abnormal area detection, a subspace of normal areal features is generated within an areal feature space of higher-order local auto-correlation features, and an abnormal area is detected using the distance or angle from that subspace as an index. A principal component analysis approach, for example, is used for generating a normal area subspace, and a main component subspace is configured by main component vectors having a cumulative contribution rate of 0.99, for example.
Here, the higher-order local auto-correlation features have the nature of not requiring the extraction of an object, and exhibiting the additivity on a screen. Due to this additivity, in a configured normal area subspace, a feature vector falls within the normal area subspace irrespective of how many normal lines are present within the screen, but when even one abnormal area exists therein, the feature vector extends beyond the subspace, and can be detected as an abnormal value. Since lines need not be individually tracked and extracted, the amount of calculations is constant, not proportional to the number of lines, making it possible to perform calculations at high speeds.
Also, in the present invention, in order to detect the position of an object, for each pixel spaced away by a predetermined distance (arbitrary distance equal to or more than one pixel), HLAC data in a predetermined area including (centered at) this pixel is accumulated to find pixel-by-pixel HLAC feature data, and an abnormality determination is made using this data and the distance or angle to the normal area subspace. With this processing, each pixel can be determined to be normal/abnormal.
For extraction of a areal feature from image data, a higher-order local auto-correlation (HLAC) feature is used. A k-th component of the HLAC feature is given by the following Equation 1:
h(BNk)=∫W×HI(r)I(r+alk). . . I(r+aNk)dr, BNk=[alk, . . . aNk] [Equation 1]
where I(r) represents an image, and a variable r (reference point) and N local displacements ank are a two-dimensional vector which have coordinates x, y within the screen as components. BNk is a local displacement matrix which has N local displacements as column components. Further, the integration range is defined in an image area of W×H, where W and H represents the width and height of the image.
Also, in the present invention, HLAC features in a wider area are also extracted, not limiting a neighboring area to 3×3. Accordingly, consider a cubic higher-order local auto-correlation feature formulated in the following manner, using a matrix R.
This feature has a feature amount proportional to a feature amount extracted from an image Iamp(r,R)=I(Rr) which has a scale within the image plane reduced by a factor of λX in the horizontal direction and by a factor of λy in the vertical direction, with respect to an image I(r). Specifically, a CHLAC feature hamp(Br,R) extracted for Iamp(r,R) is given as follows:
It is therefore understood that a feature amount correlated in a wider area using the matrix R is larger than an HLAC feature amount extracted from an image reduced from an original image by a factor of λXλy. Actually, when considering that correlation features as many as possible will be extracted from a certain object, the scale of an image must be appropriately changed in accordance with the object and image, where, using these parameters, the scale can be adjusted such that an intended feature can be well extracted.
Thus, in order to be robust to the scale, a feature (λX, λy) of a different scale is added to vector components, and is used as a new feature. For example, a robust feature is provided for a scale of 35×2 dimensions by combining a feature extracted at (λX, λy)=(1,1) with a feature extracted at (λX, λy)=(2,2).
A monitor device 12 is a known output device of the computer 11, and is used to display to the operator, for example, that an abnormal area is detected. A keyboard 13 and a mouse 14 are known input devices used by the operator for inputting. The digital camera 10 may be connected to the computer 11 through an arbitrary communication network, or data may be transferred to the computer 11 through a memory card.
Next, the HLAC data (c) is added for each displacement width (g) to find a set of feature data which is designated as whole HLAC feature data (h). Then, a principal component subspace is found from the whole HLAC feature data (h) through a principal component analysis or a incremental principal component analysis (i). In general, most areas in an image are normal, so that this principal component subspace represents features of normal areas.
On the other hand, processing is performed to add HLAC data of a predetermined area (for example, 10×10) centered at a target pixel while the target pixel is moved, for each displacement width, from the pixel-by-pixel HLAC data (c) for each displacement width (e) to derive pixel-by-pixel HLAC feature data (f). Finally, an abnormality determination is made in accordance with the distance or angle between the normal subspace and the pixel-by-pixel HLAC feature data on a pixel-by-pixel basis (j), and a pixel position determined as abnormal is displayed and output as an abnormal area (k).
In this regard, in the present invention, the normal area subspace generation processing (g), (i) may be previously executed for the entire area of the image or for a randomly or regularly sampled partial area, and the abnormality determination processing (i) may be performed on the basis of resulting normal area subspace information.
In the following, details of the processing will be described.
At S12, HLAC data of a predetermined area centered at the target pixel, for example, a 10×10 area is added, while the target pixel is moved, to generate λ-corresponding pixel-by-pixel HLAC feature data. Details of this processing will be later described. At S13, all pixel-by-pixel HLAC data are added to preserve λ-based total HLAC feature data.
At step S14, one is added to λ. At S15, it is determined whether or not λ exceeds the highest value (for example, three). The processing transitions to SS11 when the determination result is negative, whereas the processing transitions to SS16 when the result is positive. At S16, the λ-based pixel-by-pixel HLAC feature data and λ-based total HLAC feature data are respectively grouped for all λ's. Therefore, when λ has the highest value of three, the pixel-by-pixel HLAC feature data and total HLAC feature data have 105 dimensions (=35×3).
At S17, principal vector components are found from the total HLAC feature data by a principal component analysis approach or an incremental principal component analysis approach to define a subspace for normal areas. The principal component analysis approach per se is well known, and will therefore be described in brief. First, for configuring the subspace of normal areas, principal component vectors are found from the total HLAC feature data by a principal component analysis. An M-dimensional HLAC feature vector x is expressed in the following manner:
x
i
εV
M(i=1, . . . ,N) [Equation 4]
where M=35. Also, the principal component vectors (eigenvectors) are arranged in a column to generate a matrix U expressed in the following manner:
U=[u
l
, . . . u
M
],u
j
εV
M(j=1, . . . ,M) [Equation 5]
The matrix U which has the principal component vectors arranged in a column is derived in the following manner. An auto-correlation matrix RX is expressed by the following equation:
The matrix U is derived from an eigenvalue problem expressed by the following equation using the auto-correlation matrix RX.
RXU=UΛ [Equation 7]
An eigenvalue matrix A is expressed by the following equation:
Λ=diag(λl, . . . ,λM) [Equation 8]
A cumulative contribution ratio αk up to a K-th eigenvalue is expressed in the following manner:
Now, a space defined by eigenvectors u1, . . . , uk up to a dimension in which the cumulative contribution ratio αk reaches a predetermined value (for example, αk=0.99) is applied as the subspace of normal areas. It should be noted that an optimal value for the cumulative contribution ratio αk is determined by an experiment or the like because it may depend on an object under monitoring and a detection accuracy. The subspace corresponding to normal areas is generated by performing the foregoing calculations.
Next, a description will be given of the incremental principal component analysis approach which incrementally finds subspaces without solving an eigenvalue problem or finding a covariance matrix. Since a large amount of data is treated in applications to the real world, it is difficult to keep all data stored. As such, subspaces of normal areas are incrementally learned and updated.
An approach considered suitable for the incremental principal component analysis may first solve an eigenvalue problem at each step. An auto-correlation matrix RX required for the eigenvalue problem is updated in the following manner.
where RX(n) is an auto-correlation matrix at an n-th step, and x(n) is an input vector at the n-th step. Though faithful to the principal component analysis approach described above, the incremental principal component analysis has a disadvantage of a large amount of calculations because the eigenvalue problem must be solved at each step. Thus, CCIPCA is applied. This is an approach for incrementally updating an eigenvector without solving the eigenvalue problem or finding a correlation matrix. The contents of CCIPCA is disclosed in Non-Patent Document 1.
This algorithm is a very fast approach because it need not solve the eigenvalue problem at each step. Also, in this approach, while the engenvalue does not so well converge, the eigenvector characteristically converges fast. A first eigenvector and a first eigenvalue are updated in the following manner:
where the eigenvector is represented by v/∥v∥, and the eigenvalue by ∥v∥. In this update rule, it has been proved that v(n)>±λ1e1 when n is infinite, where λ1 is a maximum eigenvalue of the correlation matrix R of a sample, and e1 is an eigenvector corresponding thereto. It has been shown that an n-th eigenvector and an n-th eigenvalue are gradually updated in conformity to Gram-Schmidt's orthogonarization from the first eigenvector and first eigenvalue, and converge to a true eigenvalue and eigenvector, respectively. An updating algorithm is shown below in detail.
[Equation 12]
K principal eigenvectors v1(n), . . . , vk(n) are calculated from x(n). The following processing is performed for n=1, 2, . . . :
1. u1(n)=x(n), and
2. the following processing is performed up to i=1,2, . . . min(k,n):
(a) if i=n, an i-th vector is initialized to vi(n)=ui(n); and
(b) otherwise, the following processing is performed:
The present invention determines an upper limit value, rather than finding M, which is the number of all dimensions, for an eigenvector which is intended by CCIPCA to solve. While solving an eigenvalue problem involves finding engenvalues before finding a cumulative contribution ratio, and taking dimensions until the cumulative contribution ratio exceeds, for example, 0.99999, CCIPCA defines the upper limit value for the following two reasons. First, the conventional method requires a large amount of calculations. All eigenvalues must be estimated for finding the contribution ratio, and a personal computer requires a time of as long as several tens of seconds for calculations in estimating all eigenvalues even excluding a calculation time for extracting features. On the other hand, when the number of dimensions is limited to a constant value, for example, four in the foregoing calculations, a personal computer can carry out the calculations in several milliseconds.
A second reason is that the eigenvalue slowly converges in the CCIPCA approach. When the CCIPCA approach is employed for a number of data included in several thousands of frames, subspaces of normal areas will eventually have approximately 200 dimensions, from which it can be seen that they do not at all converge to four to which they should essentially converge. For these reasons, the dimension of the subspaces is defined as constant. An approximate value for this parameter can be found by once solving an eigenvalue problem for an input vector which extends over a certain time width.
At S18, the distance d⊥ is found between the pixel-by-pixel HLAC feature data calculated at S16 and the subspace calculated at S17.
A normal area subspace S found by a principal component analysis exists in the vicinity in such a form that it contains HLAC feature data of normal areas. On the other hand, HLAC feature data A of an abnormal area presents a larger vertical distance d⊥ to the normal area subspace S. Accordingly, an abnormal area can be readily detected by measuring the vertical distance d⊥ between the HLAC feature data and the subspace of the normal area.
The distance d⊥ is calculated in the following manner. A projector P to the normal subspace defined by a resulting principal component orthogonal base Uk=[u1, . . . , uk], and a projector P⊥ to an ortho-complement space to that are expressed in the following manner:
P=UKU′K
P105 =IM-P [Equation 13]
where U′ is a transposed matrix of the matrix U, and IM is a M-th order unit matrix. A square distance in the ortho-complement space, i.e., a square distance d2⊥ of a perpendicular to the subspace U can be expressed in the following manner:
In this embodiment, this vertical distance d⊥ can be used as an index indicative of whether or not an area is normal. However, the aforementioned vertical distance d⊥ is an index which varies depending on the scale (norm of the feature vector). Therefore, the result of the determination can differ from one scale to another. Accordingly, another more scale robust index may be employed as shown below.
Consider first a scenario where the angle to a subspace S, i.e., sin θ is used as an index. This index, however, is not very appropriate because it presents a very large value even to a feature such as noise which has a very small scale. To cope with this inconvenience, this index is modified in the following manner such that the index presents a small value even when the scale is small:
where c is a positive constant. This index corrects an abnormality determination value for the scale, so that the index works out to be robust to noise. This index means that the angle is measured from a point shifted from the origin by −c in the horizontal axis direction on the graph of
At step S19, it is determined whether or not the distance d⊥ is larger than a predetermined threshold. The processing goes to S20 when the determination result is negative, whereas the processing goes to S21 when affirmative. At S20, the pixel position is determined to represent a normal area. On the other hand, at S21, the pixel position is determined to represent an abnormal area. At S22, it is determined whether or not the determination processing has been completed for all pixels. The processing goes to S18 when the determination result is negative, whereas the processing goes to S23 when affirmative. At S23, the determination result is output.
At S34, the correlation values are preserved in correspondence to the correlation patterns. At S35, it is determined whether or not the processing has been completed for all patterns. The processing transitions to S32 when the determination result is negative, whereas the processing transitions to S36 when affirmative. At S36, the correlation values are preserved on a pixel-by-pixel basis. At S37, it is determined whether or not the processing has been completed for all pixels. The processing transitions to S31 when the determination result is negative, whereas the processing transitions to step S38 when affirmative. At S38, a set of correlation values is output as pixel-by-pixel HLAC data.
At S41, pixel-by-pixel HLAC data are added in a predetermined area centered at the reference point. The predetermined area may be, for example, in a range of 10×10 including (centered at) a target pixel. For reference, this processing is comparable to the integration in Equation 1 above which involves adding correlation values one by one (adding the correlation values on a dimension-by-dimension basis) by moving (scanning) the target pixel over a desired range.
At S42, the added data are preserved in correspondence to pixels. At step 43, it is determined whether or not the processing has been completed for all pixels. The processing transitions to S40 when the determination result is negative, whereas the processing transitions to S44 when affirmative. At S44, a set of feature added values is output as pixel-by-pixel HLAC feature data.
In Embodiment 1, a subspace of normal areas is found from a whole image, whereas in Embodiment 2, when an area which includes linear line segments is mixed with an area in which a number of circular patterns exist, by way of example, the areas are classified into an area which includes linear line segments and an area in which a number of circular patterns exist, and a subspace of normal areas is found for each class to make an abnormality determination. In this way, a determination accuracy is improved.
First, principal component vectors are found from the total HLAC data and pixel-by-pixel HLAC feature data, respectively, by a principal component analysis approach or an incremental principal component analysis approach. Next, a canonical angle is calculated for the two found principal component vectors, and pixels are classified according to a similarity based on the canonical angle.
The canonical angle means the angle formed by two subspaces in the statistics, and N (=M) canonical angles can be defined between an M-dimensional subspace and an N-dimensional subspace. A second canonical angle θ2 is a minimum angle measured in a direction orthogonal to a minimum canonical angle θ1. Likewise, a third canonical angle θ3 is a minimum angle measured in a direction orthogonal to θ1 and θ2. An F×F projection matrix is shown below:
which is calculated from base vectors Φi, Ψi of subspaces L1 and L2 in an F-dimensional feature space.
The i-th largest eigenvalue λi of P1P2 or P2P1 is cos2θi. The relationship between the M-dimensional subspace L1 and N-dimensional subspace L2 are completely defined by N canonical angles. When the two subspaces completely match with each other, the N canonical angles are all zero. As the two subspaces move away from each other, lower canonical angles increase, and all the canonical angles reach 90 degrees when the two subspaces are completely orthogonal to each other. In this way, a plurality of canonical angles represent a structural similarity of two subspaces. Bearing this in mind, n (=N) canonical angles are used to define a similarity S[n] in the following manner, and the defined similarity S[n] is used as an index:
Next, index values found based on the similarity of the canonical angles are clustered using a Mean Shift method. The contents of the Mean Shift method are disclosed in the following Non-Patent Document 2. The Mean Shift method is a clustering approach which does not give the number of classes, and must set a scale parameter for defining the degree of vicinity. In this embodiment, since the index is the similarity of the canonical angles which simply has a value between zero and one, the scale parameter is set at approximately 0.1.
Finally, the pixel-by-pixel HLAC feature data are added on a class-by-class basis, and a principal component vector is found on a class-by-class basis from the added HLAC feature data using the principal component analysis approach or incremental principal component analysis approach as mentioned above. The resulting principal component vector represents a subspace of normal area in each class. Then, an abnormality determination is made according to the pixel-by-pixel HLAC feature data and the distance between the determined class and a corresponding subspace of normal area.
While the embodiment has been described in connection with the detection of abnormal areas, the following variations can be contemplated in the present invention. While the embodiment has disclosed an example in which abnormal areas are detected while updating the subspace of normal areas, the subspace of the normal areas may have been previously generated by a learning phase, such that a fixed subspace may be used to detect abnormal areas until the next update. Further, a small amount of data may be previously learned through random sampling or the like.
While the foregoing embodiment has disclosed an example of generating feature data on a pixel-by-pixel basis, the feature data are more similar at positions closer to each other. Accordingly, when the process illustrated in
While the foregoing embodiment has disclosed an example in which a value of an integer multiple of pixels is used as λ which is a parameter for controlling the scale, an arbitrary real value including a decimal fraction can be employed for λ. However, an interpolation of pixel values is required for a real value. Alternatively, features may be extracted after an image is scaled up or down at an arbitrary scaling factor including a decimal fraction.
Number | Date | Country | Kind |
---|---|---|---|
167961/2006 | Jun 2006 | JP | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP2007/061871 | 6/13/2007 | WO | 00 | 6/3/2009 |