Method and device for detecting anomalies in two-dimensional digital images of products

ES3084499T3Undetermined Publication Date: 2026-11-13WIPOTEC GMBH (100 00)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
ES2023166616T
Authority / Receiving Office
ES · ES
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-04-12
Filing Date
2023-04-04
Publication Date
2026-11-13
Estimated Expiration
2043-04-04

Smart Images

  • Figure 00000022_0000
    Figure 00000022_0000
  • Figure 00000023_0000
    Figure 00000023_0000
  • Figure 00000024_0000
    Figure 00000024_0000
Patent Text Reader

Abstract

The invention relates to a method for detecting anomalies in digital product images, wherein a region of a digital image is detected as having a maximum anomaly if the value of a property in the region is greater than a predetermined maximum threshold, and / or wherein a region is detected as having a minimum anomaly if the value of the property in the region is less than a predetermined minimum threshold. According to the invention, the maximum threshold and / or the minimum threshold are determined in a training process in which the following steps are performed: (a) generating a predetermined number, or a number to be determined during the training process, of digital images of good products that do not contain anomalies;(b) for each of the digital images, define the region or regions and determine the property value of each region and determine the maximum value of these values ​​as the maximum value of the sample and / or determine the minimum value of these values ​​as the minimum value of the sample; (c) using a statistical estimation method, determine estimates for all free parameters of a specified probability density function to describe the maximum or minimum value of the sample;d) determining the maximum threshold using the parameterized probability density function, such that the probability of a maximum value greater than or equal to the maximum threshold occurs corresponds to a predetermined rate of misdetection of a maximum anomaly in the images under investigation, and / or determining the minimum threshold using the parameterized probability density function, such that the probability of a minimum value less than or equal to the minimum threshold occurs corresponds to a predetermined rate of misdetection of a minimum anomaly in the images under investigation. The invention also relates to an analogous method in which the thresholds are determined in a training process using defective products. Finally, the invention relates to a corresponding device and computer program for carrying out the method.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] The invention relates to a method for detecting anomalies in digital images of products with the features of the preambles of claims 1 and 2. The invention further relates to a device and a computer program product for carrying out the method.

[0002] In product manufacturing, there is often a desire or necessity to subsequently inspect the finished products for anomalies, particularly defects, foreign bodies, or the like. For example, in the food industry, during the production of yogurt or cheese, the task may arise of examining the finished product to determine whether unwanted foreign bodies or other undesirable material components are present. To solve this problem, inspection devices are used in practice that irradiate the product with electromagnetic radiation, especially radiation in the X-ray spectrum. This generates a digital image of the product, which contains information not only about its external geometric dimensions and surface but also about its internal structure.Depending on their attenuation, detectable anomalies can, when transmitted through the image, result in image areas that exhibit a higher or lower "gray value," i.e., pixel value, compared to image areas without anomalies (hereinafter referred to as "areas"). In this description, the term "gray value" is used to describe the information generated by the detector based on the radiant power incident on the individual pixels, or the corresponding radiant energy detected during the relevant exposure time, regardless of the color or manner in which the pixel values ​​can be represented in the digital image in question.

[0003] Devices and methods for such product inspection are also known in which the product under inspection is not completely irradiated (i.e., the radiation source and the detector are located on opposite sides of the product), but in which the radiation penetrates the product under inspection deeply enough and is "reflected" within the product, this "reflection" being physically caused by scattering of the radiation penetrating a volume region or by generating fluorescence radiation within that volume region. In such inspection devices, the radiation source and the detector can also be located on the same side of the product under inspection.

[0004] The product to be examined can be in the form of a piece item of any kind or as bulk material, which is conveyed through the inspection device by means of a conveying device.

[0005] In production lines where the products to be inspected move along a conveyor, line detectors are frequently used as radiation detectors. These detectors have one or more lines, each with a predetermined number of pixels. The digital images are moved through such a scanning device, usually at a constant speed, and a digital image is composed of a multitude of detected lines. However, it is also possible to use an area scanner instead of a line scanner. In this case, the digital image of the product to be inspected can be captured by a single detection process (i.e., a single "exposure process").

[0006] Digital images generated in this way are typically automatically examined to check for anomalies within the product in question. The image generated directly by the scanning process can be processed or enhanced before such an examination. For example, the original image can be digitally filtered, with the filter used potentially improving contrast.

[0007] It is also possible to implement measures to improve contrast during image generation, particularly with regard to anomaly detection. For example, a dual-energy method could be used, where the two spectra are selected such that superimposing the relevant partial images results in improved contrast.

[0008] It is still possible to use spectrally resolved detectors that generate multiple images, each image composed of pixels whose gray value corresponds to the radiation energy in a specific spectral range of the detected radiation. For anomaly detection, an image generated from all or selected sub-images of such a spectrally resolved detector can be used, for example, by weighted addition of the relevant pixel values. Alternatively, each sub-image can be examined separately to determine whether an anomaly is present.

[0009] Methods are known for the automated examination of a product's digital image in which a threshold is set, and an anomaly is present if the gray value of at least one pixel exceeds this threshold. For this purpose, a predetermined number of good products (i.e., products without anomalies) of the same product type are typically scanned in a learning process to obtain information about the maximum gray values ​​usually found in such good products. Based on this information, the threshold is then set to ensure that a predefined value for the false rejection rate (e.g., one percent or one per mille) is met. The false rejection rate is the probability that a good product is identified as a "bad product." This (theoretical) false rejection rate can be verified by determining the empirical frequency with which a good product is identified as a bad product.For this purpose, a sufficient number of digital images of good products can be generated and checked using the defined threshold, whereby the empirical rejection rate is determined as the quotient of the good products identified as defective products by the total number of good products.

[0010] Determining such a threshold therefore requires a complex learning process in which a relatively large number of digital images of good products must be generated. This is disadvantageous, however, because such a large number of good products must first be produced using the production line in question, meaning that production time is lost. Furthermore, it is almost impossible to predict how many good products will be required for the learning process in order to reliably set the threshold in such a way as to maintain the desired rejection rate.

[0011] From US patent 2007 / 0098245 A1, it is known to create and analyze images of surfaces for the detection of surface defects. A threshold value is used for defect detection, which can be determined by specifying a false-positive rate. For this purpose, sample images are used from which a distribution of pixel intensity values ​​or a distribution of corresponding residual values ​​is generated. The area under the distribution corresponding to a false-positive rate is used to determine the threshold value.

[0012] US Patent 7,844,100 B2 describes a method for inspecting a sample, particularly a wafer during wafer manufacturing. In this method, images are used during a training phase and displayed to an operator after preprocessing. The operator can initially modify predefined thresholds for various defect characteristics so that only truly relevant defects are recognized. According to a further embodiment, thresholds can also be automatically calculated from the number of defects classified by the operator, namely the number of defects classified as truly relevant and the number of defects classified as false alarms.

[0013] Based on this prior art, the invention aims to provide a method for detecting anomalies in digital images of scanned products, in which an automated process for setting a threshold value used for anomaly detection can be carried out quickly and reliably with a smaller number of digital images. Furthermore, the invention aims to provide a device and a computer program for carrying out the method.

[0014] The invention solves this problem with the features of claims 1 and 2 or 16 and 17.

[0015] The invention is based on the understanding that a threshold for detecting anomalies in digital images of products can be reliably determined in a training process with relatively few digital images if an assumption is made about the statistical distribution of the largest and smallest values ​​(hereinafter referred to as extreme values) of a specific quantity used for anomaly detection in the digital images under investigation. According to the invention, the distribution of the extreme values ​​can be adequately described by a predetermined, parameterizable probability density function (in this description, "parameterizing" refers to determining or setting values ​​for parameters of the probability density function). In other words, it is assumed that the elements of the sample (i.e.,The set of the respective maxima or minima of the given probability density function must satisfy the parameters, or their probability of occurrence must be well described by this probability density function. Using the elements of the sample, estimates are determined for all parameters to be calculated (i.e., for all parameters not already given) of the probability density function. Probability density functions often have two parameters; in the case of a normal distribution, for example, the expected value µ and the standard deviation σ or the variance σ².

[0016] According to the invention, a generalized extremum distribution, in particular a predefined variant, i.e., a Weibull distribution, a Fréchet distribution, or a Gumbel distribution, is used to describe the distribution of the maximum or minimum values ​​of the specific quantity. Of course, the generalized extremum distribution itself with its three parameters can also be used.

[0017] The invention is not limited to the case described at the outset, in which the pixel values, in particular each individual pixel value, in conjunction with a threshold value for the pixel values ​​are used to decide whether the digital image to be examined contains an anomaly.

[0018] Rather, the invention generalizes the principle underlying this procedure. The image to be examined is divided into one or more regions, with each region being assigned at least the same one property or the same set of properties. Each region comprises either exactly one or more pixels, with multiple pixels being assigned to the same region only if they are adjacent (i.e., each pixel in the region has at least one immediately adjacent pixel in the same region). Any pixel adjacent to a pixel under consideration can be any pixel that is adjacent to an edge of an edge of the pixel under consideration (i.e., the pixels above, below, left, and right of the pixel under consideration), or (additionally) any pixel that is adjacent to a corner of a corner of the pixel under consideration (i.e., the pixels extending along the diagonal of the pixel under consideration).For each property of the previously defined regions, a value is determined that describes the respective property. If multiple properties are assigned to the regions, either separate values ​​can be determined for each property, or the values ​​of two or more properties can be combined into a single value, for example, through an arithmetic operation (e.g., multiplication, division, or weighted addition).

[0019] In this generalization, anomaly detection is achieved by determining a threshold value for each property or for each combination of several properties.

[0020] In an extreme case, the entire image can be considered or defined as a single region. If, in addition, the pixel value of each pixel is examined as a specific parameter for anomaly detection to determine whether the value exceeds or falls below a predefined threshold, this leads to the same result as if each pixel were considered or defined as a region containing exactly one pixel. In this case, the generalization described above, using predefined regions and assigned arbitrary properties, leads back to the previously established procedure, whereby the individual pixels are examined with respect to their pixel values ​​to determine whether they exceed or fall below a predefined threshold.

[0021] According to the invention, the threshold value for a property or the threshold value for a combination of properties is determined in a training process. The images required for determining the threshold value can be generated in advance in a sufficient, predetermined number, or as needed, i.e., one or more new digital images are successively generated until a sufficient number is reached. It should be noted that the training process can be carried out at any time and, in particular, does not have to be performed before the (productive) commissioning of a corresponding device or system. In particular, the process can also be carried out during the productive operation of a system, especially if good products or at least good process products are being produced (see below). In a preferred embodiment of the invention, the training process is carried out automatically.However, it is also possible to perform certain steps of the process, such as the generation of digital images (including the processing of originally detected digital images), entirely manually or with manual assistance.

[0022] In one variant of the method according to the invention, the training process or the automated process for determining the threshold value for at least one property is carried out using digital images of good products that do not exhibit anomalies. As mentioned above, the images, which may be a direct result of a scanning process, can first be processed or prepared for the detection method. A suitable section of the overall image can also be generated, encompassing the entire product or predefined sub-areas. The section thus generated, or even the entire captured digital image, can also be subjected to digital filtering, for example, to improve contrast in order to further highlight anomalies.If a continuously produced product or a bulk product is to be examined for anomalies, digital images of sections of such a product can be generated and processed and examined in the same way as images of individual products (or sections of such products).

[0023] It should be noted here that it is not strictly necessary to carry out the automated process exclusively with good products. Rather, the automated process can also be carried out with images of products as they are produced on a production line, without ensuring that none of the products are defective. Instead of good products, products referred to as "good process products" can also be used, whereby a number of good process products consist predominantly of good products and only a small proportion of defective products. In practice, it can be assumed that the proportion of defective products in a number of good process products is small, in particular less than 25%, preferably less than 10%, and most preferably less than 5%.

[0024] As part of the automated process, either a fixed number of digital images or a number of images of good products or good process products to be determined during the course of the automated process are generated or used.

[0025] For each of the digital images, one or more regions are defined, and for each region, the value of at least one property or the combined value for the multiple properties is determined. The maximum value of these values ​​is defined as the maximum sample value of a maximum value sample, and / or the minimum value of these values ​​is defined as the minimum sample value of a minimum value sample.

[0026] This allows for the exclusion of extreme values ​​that are implausible or clearly indicate an error. For example, when determining extreme values, pixel values ​​that exhibit an absolute maximum or minimum value of the grayscale used can be excluded, since a corresponding minimum value, such as 0, could indicate a defective pixel of the detector, and a maximum value an overdriven pixel of the detector.

[0027] The extreme values ​​determined in this way represent the sample mentioned above and can be stored, for example in a list (possibly separately for the minimum and maximum values).

[0028] Subsequently, using the maximum sample values, estimates are determined for all free, unspecified parameters of the probability density function used to describe the maximum sample, and / or using the minimum sample values, estimates are determined for all free, unspecified parameters of a probability density function used to describe the minimum sample. A statistical estimation method is used for this purpose.

[0029] Since a meaningful result of a statistical estimation procedure, especially using an estimator function (also called a statistical estimator), can only be expected if the sample includes a minimum number of values, such a minimum number is usually specified, which in turn requires a corresponding minimum number of digital images.

[0030] A key aspect of the invention is that a rate is specified at which a maximum anomaly is falsely detected in the images under investigation (when carrying out the method using the threshold), or a rate at which a maximum anomaly is correctly not detected in the images under investigation (when carrying out the method using the threshold), and / or that a rate is specified at which a minimum anomaly is falsely detected in the images under investigation (when carrying out the method using the threshold), or a rate at which a minimum anomaly is correctly not detected in the images under investigation (when carrying out the method using the threshold). The maximum or minimum threshold to be determined can thus be set in such a way that the specified rate is maintained.

[0031] The term "rate" is understood as the quotient of the number of good products that meet the relevant rate criterion when the test is applied, and a predetermined total number of good products or process products. The rate at which a maximum or minimum anomaly is falsely detected in the images under examination thus corresponds to the term "false rejection rate," which is often used in practice. The rate at which a maximum or minimum anomaly is falsely detected in the images under examination, and the rate at which no maximum or minimum anomaly is correctly detected in an image under examination, each sum to 1. In plant operation, these rates can also be determined as a moving average, for example, based on the number N of the most recently inspected products.

[0032] If the given probability density function is parameterized using the estimation method, the maximum threshold can be determined using the previously parameterized probability density function or a corresponding distribution function such that the probability of a maximum value occurring that is greater than or equal to the maximum threshold corresponds to the given rate at which a maximum anomaly is falsely detected in images under investigation, or that the probability of a maximum value occurring that is less than or equal to the maximum threshold corresponds to the given rate at which no maximum anomaly is correctly detected in an image under investigation. In other words, the maximum threshold can be determined such that the area under the probability density function above the maximum threshold is equal to the given rate at which no maximum anomaly is correctly detected.the area under the probability density function below the maximum threshold of the relevant given rate.

[0033] Similarly, the minimum threshold can be determined using the previously parameterized probability density function or a corresponding distribution function such that the probability of a minimum value occurring that is less than or equal to the minimum threshold corresponds to a predetermined rate at which a minimum anomaly is falsely detected in the images under investigation, or that the probability of a minimum value occurring that is greater than or equal to the minimum threshold corresponds to a predetermined rate at which no minimum anomaly is correctly detected in a product of good results. In other words, the minimum threshold can be determined such that the area under the relevant probability density function below the minimum threshold is equal to the probability of a minimum value occurring that is greater than or equal to the minimum threshold.the area under the probability density function above the minimum threshold of the relevant given rate.

[0034] To determine the area, the integral of the probability density function can of course be used, whereby the integral is to be formed from the relevant threshold value up to an upper limit of the definition interval of the probability density function (e.g. infinity or a given upper limit above which the value of the integral, i.e. the area, changes only less than a given error limit) or from a lower limit of the definition interval (e.g. minus infinity or a given lower limit below which the value of the integral, i.e. the area, changes only less than a given error limit) up to the threshold value.

[0035] Of course, instead of calculating the integral as described above, one can also use the cumulative distribution function of the relevant probability density function, since the cumulative distribution function represents the value of the integral over the probability density function from negative infinity or the lower limit of the domain of the probability density function up to the relevant threshold. The relevant area under the probability density function, i.e., the value of the integral or the value of the cumulative distribution function, thus corresponds to the (theoretical) probability with which a maximum or minimum value of a property of the regions of an image of a good product is less than or equal to the relevant threshold. If the probability with which a maximum or minimum value of a property of the regions of an image of a good product is to be calculated is to use the cumulative distribution function.If the minimum value is greater than or equal to the threshold, then the calculated probability simply needs to be subtracted from 1.

[0036] Since the value of the area, the integral, or the distribution function is specified for these calculations, the corresponding inverse function must be used. These calculations can be performed either analytically or using a numerical method. According to a further variant of the method according to the invention, the automated process can also be carried out using digital images of defective products. Each (deliberately) generated defective product contains at least one such anomaly as can actually occur in the product type for which the inventive method for anomaly detection is to be used. The generated anomalies should cover a spectrum that can occur in practice.

[0037] If the nature of such anomalies in the digital images to be examined is known, in particular the maximum and minimum values ​​that the properties of regions to be recognized as anomalies can assume, then it is also possible to artificially generate digital images for the training process, whereby corresponding anomalies can also be digitally superimposed onto images of good products. However, to arrive at meaningful threshold values, sufficient knowledge of the anomalies that occur in practice is required.

[0038] As already indicated above, it is possible that a digital image of a defective product for the training process may contain not just a single anomaly, but several. In this case, according to the invention, it is advantageous to divide such a digital image into several images, each containing only a single anomaly. The division must be carried out with knowledge of the spatial information, i.e., the information about which anomaly is located at which position on the surface or within the product and thus—taking into account the information about how the image was acquired (viewing angle, type of acquisition such as photography, radiographic scan, etc.)—at which position within the image each anomaly is located.

[0039] The digital images of defective products generated in this way, each containing an anomaly, can then be used to carry out the training process described above in an analogous manner, so that only the key differences will be discussed below.

[0040] Instead of exclusively using defective products, products can also be used that predominantly consist of defective products, i.e., also include a smaller proportion of good products. Such products are referred to below as defective process products. As explained below, both good products encompassed by good process products, or extreme values ​​derived from them, and good products encompassed by defective process products, or extreme values ​​derived from them, can be sorted out from the relevant samples using suitable methods.

[0041] Since the digital images of defective products exhibit maximum or minimum values ​​of properties in regions caused by the anomalies, the corresponding probability density functions describe only the anomalies and not the good regions of the product. This information therefore cannot be used to specify or achieve a rejection rate. Instead, this information can be used to determine when, or under what conditions, defective products are incorrectly no longer recognized as such.

[0042] If the training process is carried out with bad products or process bad products, a rate is specified with which a maximum or minimum anomaly should be correctly detected in an image to be examined, or a rate with which no maximum or minimum anomaly should be incorrectly detected in images to be examined.

[0043] Determining the maximum threshold using the parameterized probability density function or a corresponding distribution function is then carried out such that the probability of a maximum value occurring that is less than or equal to the maximum threshold corresponds to the predetermined rate at which a maximum anomaly is falsely not detected in an image under investigation, or that the probability of a maximum value occurring that is greater than or equal to the maximum threshold corresponds to the predetermined rate at which a maximum or minimum anomaly is correctly detected in an image under investigation.

[0044] If a minimum threshold is to be determined using the parameterized probability density function or a corresponding distribution function, this is done analogously such that the probability of a minimum value occurring that is greater than or equal to the minimum threshold corresponds to the relevant predefined rate at which a minimum anomaly is falsely not detected in an image under investigation, or that the probability of a minimum value occurring that is less than or equal to the minimum threshold corresponds to the relevant predefined rate at which a minimum anomaly is correctly detected in an image under investigation.

[0045] According to one embodiment of the invention, the estimated values ​​for the parameters of the given probability density function can be determined using a statistical estimator (also referred to as an estimator function), for example, the maximum likelihood method or the method of moments. It is also possible to assign the sample elements to "within," i.e., adjacent, intervals of a given width, thereby creating an empirical frequency distribution. The selected probability density function to be parameterized can then be fitted to this frequency distribution. For this purpose, the least squares method can be used, for example. However, a more advantageous statistical estimator, such as the maximum likelihood method or the method of moments, is usually employed.

[0046] The result is a set of values ​​for the parameters of the given probability density function. It should be noted here that in certain cases it is also possible to specify one or more values ​​for certain parameters of the probability density function and determine only the remaining "free" parameters in the manner described above.

[0047] In another embodiment, the regions can be defined using a base threshold, with neighboring pixels whose pixel value is greater than (or equal to) the base threshold forming a first group of regions, and neighboring pixels whose pixel value is less than the base threshold forming a second group of regions. The first and second groups of regions can also be combined into a single group. Another way to define the regions is to use a predefined (geometric) mask. For example, a matrix-like mask can be used that overlays, for example, a square grid (i.e., a checkerboard grid) onto the digital image, with all pixels within a square forming a region. Of course, the mask can also create other subdivisions, and it is not necessary to divide the entire image into regions.

[0048] According to the invention, each region is assigned a property that can be described by a value. This can be, in particular, a geometric property, such as the area, perimeter, or diameter of the regions (if they are at least approximately circular), or a pixel value property, which is described by a value derived from the pixel values ​​of the region in question, such as the maximum or minimum value of a region, the average value, or the variance of the pixel values.

[0049] Multiple properties can be combined and described by a single combined value. For example, the mean and standard deviation can be added, with this information representing a kind of confidence interval for the pixel values. The difference between the maxima and minima can also be used as a combined value, describing the brightness difference of the region. Since this measure is sensitive to outliers, quantiles can be used instead, such as the 10% and 90% quantiles. Furthermore, the ratio of perimeter to area can be used to infer how circular the region is or how far it deviates from circularity. Geometric and pixel-value properties can also be combined.

[0050] As mentioned above, the number of elements in the sample, i.e., the number of extreme values ​​(maximum or minimum gray values), cannot be predetermined. Specifically, the number of digital images of good products or good-process products, or bad products or bad-process products, can be determined during the learning process using at least one termination criterion. For this purpose, the current number of digital images can be increased until at least one termination criterion is met. The previously described procedure for determining the relevant threshold is then performed at each step, i.e., after each increase in the number of digital images.

[0051] It is of course possible, as a first step, to evaluate a minimum number of digital images in order to obtain a minimum number of elements from each sample representing maximum and minimum gray values. This minimum number is chosen to be large enough that the estimator used can already generate reasonably meaningful estimates for the parameters of the relevant probability density function with a certain probability.

[0052] According to one embodiment of the invention, the at least one termination criterion can be formed by or derived from a confidence interval for at least one parameter of the relevant probability density function. A confidence level, for example 95% or 99%, can be specified to determine the confidence interval. If the confidence interval has a sufficiently small (predefined) overall width or a sufficiently small (predefined) distance from the estimated value to the upper or lower limit of the confidence interval at the specified confidence level, the termination criterion can be considered fulfilled. However, this variant will only be chosen if there is already experience regarding how a corresponding uncertainty of the parameter(s) of the relevant probability density function affects the threshold to be determined.

[0053] According to another embodiment, at least one termination criterion is formed by a threshold confidence interval for the minimum threshold or the maximum threshold, wherein the threshold confidence interval is determined by determining a confidence interval for each parameter and determining the effect of these confidence intervals on the threshold confidence interval, in particular using the error propagation method, especially the Gaussian error propagation method. This has the advantage that the uncertainty for the threshold becomes immediately apparent. For error propagation, the left and right limits of the confidence interval for the relevant parameter are determined, and from these, the difference between the estimated value and the relevant limit is calculated. These differences can then be used for error propagation.

[0054] It is also possible to use a threshold confidence interval for the minimum or maximum threshold as at least one termination criterion. This threshold confidence interval is determined using a statistical procedure, particularly bootstrapping. In this method, a large number of additional samples, typically of the same size, are generated from the existing sample of maximum or minimum gray values. These additional samples are created by repeatedly drawing with replacement (using the same selection probability) from the existing sample. The threshold is then recalculated using the relevant estimator function for each of these generated samples. This results in a distribution of threshold values ​​within an interval, and this distribution is used to determine the confidence interval.

[0055] Similarly, a confidence interval can be specified for the given rate(s) in question.

[0056] In general, when specifying confidence intervals, if both minimum and maximum thresholds are to be determined in one and the same learning process, termination only occurs when both termination criteria are met.

[0057] According to a further embodiment, using the relevant parameterized probability density function and the relevant parameters, for each detected maximum sample value or minimum sample value, the probability is determined with which values ​​occur that are less than or equal to the relevant detected maximum sample value or minimum sample value, and the probability with which values ​​occur that are greater than or equal to the relevant detected maximum sample value or minimum sample value.The parameters for the probability density function are recalculated using these results if, for at least one of the detected maximum sample values ​​or minimum sample values, one of the two probabilities determined in this way is smaller than a predetermined outlier limit, whereby these maximum sample values ​​or minimum sample values ​​are disregarded during the recalculation.

[0058] This achieves outlier detection, whereby elements of the sample (i.e., extreme values) with an extremely low probability of occurrence are disregarded when determining the probability density function. This makes it possible, in particular, to use the method according to the invention even when it is not guaranteed that the training process is carried out exclusively with good products or exclusively with defective products. For example, a training phase can be carried out when starting up a production line (or even during ongoing production), in which the products being produced or fed into the system are used to determine (or redetermine) the respective threshold value. If a defective product (i.e., good process products) is among these products, the relevant maximum orMinimal gray values, which then characterize a defective product, are excluded.

[0059] This approach can also be performed recursively, since excluding samples results in a new, modified parameterized probability density function, which then leads to altered probabilities of occurrence with respect to the remaining sample values. The maximum number of recursions can, of course, be limited. Likewise, this outlier detection can only be used if the sample in question contains a minimum number of values.

[0060] It should be mentioned at this point that the probabilities of occurrence can of course be determined again using the corresponding distribution function, without requiring a new calculation process for the integration of the probability density function in each case.

[0061] According to a further embodiment of the invention, a statistical test can be performed which provides a statement as to whether the respective predetermined probability density function, using the estimated values ​​for the parameters determined for this purpose, describes the empirical distribution in the form of the respective detected maximum and / or minimum gray values ​​with sufficient accuracy. Examples of possible statistical tests include the chi-square goodness-of-fit test, the Kolmogorov-Smirnov goodness-of-fit test, the Anderson-Darling goodness-of-fit test, the Jarque-Bera goodness-of-fit test, or the Lilliefors goodness-of-fit test.

[0062] This ensures that a sufficient number of sample elements are used to estimate the parameters of the probability density function, which also characterize the probability density function with sufficient accuracy, or whether the chosen type of probability density function is suitable to characterize the empirical distribution density of the sample in question.

[0063] The parameter estimation can be performed, preferably after detecting a predetermined minimum number of maximum or minimum sample values, for a plurality of predefined, different probability density functions. For each of the parameterized probability density functions thus defined, the statistical test is performed, and for the subsequent procedure, the probability density function for which the statistical test yields the most accurate result is used as the predetermined probability density function. This allows the most suitable type of probability density function to be selected from a predetermined number of types during the training process, depending on the nature or characteristics (in particular, the geometry and material of the products under investigation and the anomalies that occur).

[0064] According to one embodiment of the invention, a confidence interval and / or at least one error limit for the relevant predetermined rate can be determined from the limits of the confidence interval for the maximum threshold and / or the minimum threshold. This can, of course, be done by integrating the probability density function or by using the associated distribution function.

[0065] The values ​​determined in this way can then be output after completion of the learning process, i.e., when the procedure is carried out with the correspondingly determined threshold, for monitoring and / or controlling devices or an entire production line used for the manufacture, processing, or testing of the products. For example, the current rate can be monitored and / or displayed, perhaps also depending on the production time. Of particular importance here is the upper error limit in the case of predefined rates, at which a maximum or minimum anomaly is to be falsely detected in an image under investigation, and the lower error limit in the case of predefined rates, at which a minimum or maximum anomaly is to be correctly detected in an image under investigation.

[0066] It is also possible to output the maximum and / or minimum threshold values ​​for monitoring and / or controlling devices or an entire production line used for manufacturing, processing, or inspecting the scanned products. In particular, the power of a radiation source in an inspection device used to generate the digital images (for example, an X-ray source) could be reduced until the desired (low) preset rate is still achieved.

[0067] According to a further embodiment of the invention, a secondary maximum threshold can be determined based on the determined maximum threshold, wherein the secondary maximum threshold is selected within the limits of a confidence interval defined for the maximum threshold or equal to a limit of this confidence interval. Similarly, a secondary minimum threshold can be determined based on the determined minimum threshold, wherein the secondary minimum threshold is selected within the limits of a confidence interval defined for the minimum threshold or equal to a limit of this confidence interval. This allows the detection of maximum or minimum anomalies to be optimized either towards an improved (reduced) false positive rate or towards improved sensitivity of anomaly detection.In practice, the most relevant reduction in the false ejection rate can be seen as setting the secondary maximum threshold to the upper limit of the confidence interval for the maximum threshold or setting the secondary minimum threshold to the lower limit of the confidence interval for the minimum threshold.

[0068] The device according to the invention for carrying out the aforementioned method according to the invention comprises a data processing device configured to obtain digital image data representing the digital images of products to be examined for anomalies. The entire device can, for example, be a device for generating the digital images, such as an inspection device configured as an X-ray inspection device that also generates information about the interior of a product in the form of a digital image, or as an inspection device with one or more cameras that generate a 2D or 3D image of a product.

[0069] A data processing unit suitable for a device according to the invention can, in the usual manner, comprise a processor with suitable input and output interfaces. The processor can, for example, be designed as a special processor for industrial image processing. Of course, the processor can also be implemented by a combination of a conventional processor and a special image processing processor. The entire data processing unit can also be implemented as a standalone CPU unit with corresponding interfaces, for example, as a slot CPU.

[0070] Further embodiments of the invention are set out in the dependent claims.

[0071] The invention is explained in more detail below with reference to exemplary embodiments shown in the drawing. The drawing shows: Fig. 1 a schematic representation of an X-ray inspection device with a device for carrying out the method according to the invention; Fig. 2 a diagram showing the empirical frequency distribution of a sample of maximum values ​​of a property from previously determined regions in digital images of good products, as well as a probability density function fitted to this distribution; Fig. 3 a diagram showing, respectively, a probability density function for minimum and maximum values ​​of a property determined using digital images of good products (or good-process products); Fig. 4 a diagram showing, respectively, a probability density function for minimum and maximum values ​​of a property determined using digital images of defective products (or defective-process products); Fig. 5 a simplified flowchart to illustrate the method for determining the threshold value; Fig.6. A diagram showing the ejection rate as a function of time, as it occurs during the operation of an X-ray inspection device according to . Fig. 1 This can occur, whereby a predetermined upper confidence limit is maintained, at least when considering a moving average; Fig. 7 shows a diagram similar to this. Fig. 6 , where the upper confidence limit is exceeded; Fig. 8 a diagram similar to the Fig. 6 and 7, where the upper confidence limit is met and a lower confidence limit is still undercut; Fig. 9 a diagram showing a first probability density function (curve (a)) for maximum values ​​of a property determined using digital images of good products (or good process products), and a second probability density function (curve (b)) for maximum values ​​of a property determined using digital images of bad products (or bad process products), where the threshold X determined from curve (a) is greater than the threshold Y determined from curve (b) , and Fig. 10 a diagram analogous Fig. 9 , however, the threshold X determined from curve (a) is smaller than the threshold Y determined from curve (b) .

[0072] In Fig. 1 A schematic representation shows an X-ray inspection device 100 with a device 102 for detecting anomalies in digital images, which is configured to carry out the method described below. The X-ray inspection device 100 is merely one possible example of how digital images containing anomalies can be generated. The method according to the invention can be applied to any digital images that are to be examined for the presence of anomalies.

[0073] As stated above, the digital images will typically depict products that themselves exhibit the anomalies to be detected. In the case of the in Fig. 1 The X-ray inspection device shown is used, as an example, to examine products 104 in the form of individual items. However, it is equally possible to generate digital images of any other products, such as bulk products. In this case, it is advantageous to generate digital images that each depict a section of the bulk product.

[0074] At the in Fig. 1 In the depicted X-ray inspection device 100, the products 104 to be examined are transported by means of a conveyor 106 along a predetermined conveying path (indicated by arrow F). The conveyor 106 has several conveyor belts 108, 110, 112, 114. Conveyor belt 108 serves to feed the products 104 in, and conveyor belt 114 serves to convey the products out. The inspection device 100 has a shielding housing 116 in which the conveyor belts 110 and 112 are arranged, as well as an X-ray source 118 and an X-ray detector 120. The X-ray source 118 generates an X-ray beam 121, which has a fan-like shape perpendicular to the plane of the drawing and a narrow width in the conveying direction. The X-ray beam 121 passes through a slit or...The free space between the facing end faces of the conveyor belts 110 and 112 passes through and then hits the X-ray detector 120, which is located in . Fig. 1 In the illustrated embodiment of the X-ray inspection device 100, the X-ray detector 120 is arranged below the conveyor belts 110 and 112. The X-ray detector 120 has a width that, in the direction perpendicular to the plane of the drawing, corresponds to the maximum width of the products to be inspected. Typically, the width of the X-ray detector is chosen to be approximately the same as the width of the conveyor belts 110 and 112. The X-ray detector 120 can be configured as a line detector, which has one or more detector lines in the direction perpendicular to the plane of the drawing, each detector line having a predetermined number of pixels.

[0075] The anomaly detection device 102 includes an image processing unit 122, to which the signal from the X-ray detector 120 is supplied. The image processing unit 122 can be configured as a conventional computer unit with one or more processors, main memory, and optionally hard disk or SSD storage, as well as suitable interfaces for supplying the signal from the X-ray detector 120 and for supplying, receiving, and transmitting further data. Furthermore, the device 102 can include a display unit 124 on which information generated by or supplied to the image processing unit 122 can be displayed.

[0076] As in Fig. 1 In schematic representation, the products 104 to be examined are moved by the fan-shaped X-ray beam 121, whereby a corresponding digital image signal is generated by the X-ray detector 120, which is designed as a line detector, and fed to the image processing unit 122. The image processing unit 122 can be configured such that a digital image is first generated from the image signal, which, in the case of a single item, includes the entire product 104 or at least a predefined section. The section can be selected using conventional image processing or pattern recognition methods.The image processing unit 122 can subject the resulting digital image, which is to be examined for anomalies using the method described below, to further image processing, such as digital filtering. This filtering is selected to make the anomalies more easily detectable, particularly to make them stand out more clearly against the rest of the image. Such image preprocessing can also include any further image processing steps, such as noise reduction or the like. The end result of this (not mandatory) image preprocessing is the digital image that is then to be examined for anomalies.

[0077] As mentioned earlier, it is known to use a threshold value for pixel values ​​to detect anomalies. In this case, an anomaly is detected when a pixel value, or a group of neighboring pixels with a predefined minimum number of pixels, exceeds this threshold. If one or more anomalies are detected in a digital image, this information can be used to trigger an action regarding the associated product, for example, removing the product from a stream of products. Alternatively, or in addition, the product in question can also be marked physically or virtually, i.e., by assigning appropriate data.

[0078] The display unit 124 can be used to show desired information, such as the digital images to be examined, including any anomalies detected, the threshold used, the type of probability density function selected and its associated parameters, the goodness of fit of the probability density function to the sample, confidence intervals for the thresholds, parameters, or rates (especially the false positive rate), and the like. The output can, of course, be in the form of data (numerical values) and / or graphs. When performing detection in the device's normal operating mode, a diagram similar to or identical to the one shown may also be displayed. Fig. 6 bis 7 The display will show, in particular, the current ejection rate during the (normal) operation of device 102 (but also during the learning process) over time, including the specified rate (e.g., the false ejection rate) and the confidence interval for the specified rate. Furthermore, a list of the sample values ​​and / or a similar graph can also be displayed. Fig. 2 The data can be displayed. The relevant data can, of course, also be output to a higher-level unit and / or stored.

[0079] The image processing unit 122 can also be supplied with one or more start thresholds that have already been determined for a product type currently under investigation using the procedure described below, or with further information required for carrying out the procedure described below, for example, information concerning the type of specified probability density function(s) to be used or information on how regions are defined in a digital image under investigation (see below).

[0080] As explained above, the procedure for detecting anomalies in digital images described below is not limited to checking whether one or more pixel values ​​exceed a predefined maximum threshold or fall below a predefined minimum threshold. Rather, the procedure described below for setting or determining a maximum or minimum threshold can be generalized to determine a maximum and / or minimum threshold for any properties of previously defined regions in the digital images under investigation.

[0081] To do this, the regions to be analyzed must first be defined in the digital image to be examined, each of which can be assigned the value of a predefined property. The regions can be defined, for example, by using a base threshold, where all pixel values ​​equal to or exceeding the threshold form a first group of regions, and the remaining pixel values ​​form a second group. Depending on the property being examined, it may be sufficient to process only the first or only the second group. This is the case, for example, if only the maximum, minimum, or average pixel value of the regions is evaluated for anomaly detection.

[0082] However, it is also possible to assign one or more properties to regions that cannot be described solely by individual pixel values. For example, geometric properties such as area, perimeter, diameter (in the case of at least approximately circular regions), or deviation from a circular shape can be assigned to a region. In such a case, an anomaly is detected when the value of the relevant property exceeds a predefined maximum threshold or falls below a predefined minimum threshold. Even in this general case, the necessary maximum and minimum thresholds can be determined using the procedure described below.

[0083] Another way to determine the regions in a digital image under investigation is to use a predefined geometric mask that is overlaid on the image. This could, for example, be a mask consisting of equally sized adjacent squares of a predetermined size.

[0084] Here too, one or more properties can be assigned to each region defined in this way, for example the variance or standard deviation of the pixel values ​​encompassed by the regions, the relevant average value, or the maximum or minimum value contained therein.

[0085] It is also possible to determine combined values ​​for each region, derived from two or more values ​​for different properties. For example, a value for the variance or standard deviation of the pixel values ​​and an average value can be combined into a single value, particularly through an arithmetic operation such as (weighted) addition. In this specific case, this represents a kind of confidence interval if the pixel values ​​in that region are reasonably normally distributed. Another example of a combined value, or the combination of properties of the regions, is the use of the difference between the maximum and minimum pixel values ​​contained within each region. To be more robust against outliers, quantiles can also be used, for example, 90th and 10th percentiles instead of the maximum and minimum values.

[0086] The following describes how a corresponding maximum and minimum threshold can be determined using a small number of digital images. As mentioned above, such a training process can be performed with both good products and defective products. The training process can be carried out, for example, during the commissioning of a plant for the manufacture or processing of products that includes such an inspection device. In general, it will be necessary to determine the thresholds for each product type.

[0087] Naturally, the threshold values ​​for specific product types can be saved, so that the learning process does not have to be repeated every time the type of product being examined is changed.

[0088] It is still possible to perform the learning process during the ongoing operation of a plant, at least if it can be assumed that the plant produces good process products, i.e., products that are predominantly good products (which do not contain any anomalies). In this case, as explained below, the bad products contained within the good process products can be filtered out as outliers when creating the required sample.

[0089] A key feature of the inventive method for determining threshold values ​​described below is that, in the case of using good products, a rate is specified with which a maximum anomaly is to be falsely detected in an image to be examined (hereinafter also referred to as false positive rate) or with which no maximum anomaly is correctly detected in an image to be examined (hereinafter also referred to as true negative rate), and / or that, in the case of using defective products, a rate is specified with which a maximum anomaly is correctly detected in an image to be examined (hereinafter also referred to as true positive rate) or with which no maximum anomaly is incorrectly detected in an image to be examined (hereinafter also referred to as false negative rate).It is therefore no longer necessary to determine a threshold in a first step and then check in a second step whether using the threshold in question results in a correspondingly acceptable rate.

[0090] The method according to the invention ensures that a threshold value can be determined with a relatively small number of digital images.

[0091] The required number of digital images, i.e., the number of good products or good process products, can be predetermined. However, this number must then be chosen high enough to establish a threshold with the desired reliability. Alternatively, the required number of digital images can be determined during the training process (regardless of whether the images are generated during the training process or are already available before it begins). In this case, it is advisable to start with a minimum number of digital images and gradually increase this minimum by one or more images until the determined threshold is sufficiently reliable, i.e., the specified rate is maintained with sufficient reliability. This can be verified by determining a confidence interval.

[0092] In the next step, as with anomaly detection in normal operating mode (i.e., outside the learning process), the regions are defined for each digital image, and for each region, the value of at least one property assigned to that region is determined. For each digital image, the maximum and / or minimum value of the property(ies) in question, or the combined value for several properties, is then determined and assigned to a corresponding sample. This can be done, for example, by storing all minimum values ​​in a minimum value list and all maximum values ​​in a maximum value list. It should be noted that, of course, both alternatives of the procedure do not have to be used simultaneously. If only maximum anomalies are to be detected in normal operation, i.e.,For anomalies that are only detected when a maximum threshold is exceeded, only a maximum threshold needs to be defined. The same applies if only minimal anomalies are to be detected.

[0093] Once a sufficient number of sample elements (maximum and minimum values ​​for at least one property or combined property) have been determined, a probability density function can be parameterized for the respective maximum and minimum value lists using a statistical estimation procedure. This corresponds to fitting the probability density function to the empirical frequency distribution of the sample in question.

[0094] For this purpose, the sample can be binned, meaning that the sample elements are each assigned to equally wide, adjacent intervals within the corresponding range of values. The relevant predefined probability density function can then be fitted to this empirical (relative) frequency distribution, for example, by using the least-squares method. However, a more advantageous statistical estimator is usually used, such as the maximum likelihood method or the method of moments.

[0095] The probability density function required for the procedure should be of a type that, once parameterized, is expected to accurately describe the sample. Since, in this case, extreme values ​​for the relevant property are selected to form the sample, a generalized extremum distribution or the generalized extremum distribution (with its three parameters) is often chosen, which combines the Gumbel, Weibull, and Fréchet distributions. The commonly used Gumbel distribution has the form: f x = exp − exp − x − μ β

[0096] Here, f denotes the value of the probability density function of the random variable x. The value x of the respective random variable, in this case, denotes the value of the relevant property or the combined value. The parameters µ and βare determined by the chosen statistical method.

[0097] Fig. 2 The diagram schematically illustrates the fitting of a probability density function f(x) to a relative empirical frequency distribution of maximum pixel values, where x denotes the pixel value. The pixel values ​​are plotted on the abscissa, and the values ​​for the probability density and the relative frequency are plotted on the ordinate.

[0098] Using the parameterized probability density function, the desired threshold (for the specified rate at which a maximum anomaly is falsely detected in the images under investigation, or at which a maximum anomaly is correctly not detected in the images under investigation) can be determined in a further step. For this purpose, the threshold is set such that the area under the parameterized probability density function above the threshold is equal to the specified rate at which a maximum anomaly is falsely detected in the images under investigation, or the area under the parameterized probability density function below the threshold is equal to the specified rate at which a maximum anomaly is correctly not detected in the images under investigation.This area corresponds to the probability of a maximum value of the relevant property occurring in a digital image, which is greater than or equal to the threshold. The threshold can be determined by rearranging the equation to find the inverse function of the distribution function associated with the parameterizing probability density function, provided a closed-form solution for the inverse function exists. Otherwise, the threshold can be calculated using known and suitable numerical methods.

[0099] In Fig. 2 Threshold values ​​X so,1 , X so,2 and X so,3 are shown, corresponding to a false positive rate of 1.0%, 0.6% and 0.1%, i.e. the areas under the probability density function to the right of these threshold values ​​give the values ​​0.01, 0.006 and 0.001.

[0100] If the true negative rate is specified instead of the desired false positive rate, the area under the probability density function below the upper threshold X s must be used accordingly for calculating the maximum threshold.

[0101] In Fig. 3 is a similar diagram to the one in Fig. 2 The diagram shows, however, only the shape of the already fitted probability density function. In this example, both a maximum threshold Xso and a minimum threshold Xsu are determined using the parameterized probability density function. Here, the same false positive rate Rfp is specified in both cases, i.e., for determining the maximum threshold as well as for determining the minimum threshold. For determining the minimum threshold Xsu, the false positive rate Rfp is equal to the area under the probability density function below the minimum threshold Xsu. Similarly, the true negative rate Rrn is equal to the area under the probability density function above the minimum threshold Xsu. This is because a minimal anomaly is detected when the value of the relevant property falls below the threshold.the combined value for several properties is smaller than the relevant minimum threshold X su .

[0102] In the case of parameterized probability density functions according to Fig. 3 A digital image would then be detected as containing an anomaly if, for at least one region, a value of the considered property or a combined value for the properties in question is found to be outside the acceptable range between the minimum threshold and the maximum threshold (or in other words, if the value in question is less than or equal to the minimum threshold Xsu or greater than or equal to the maximum threshold Xso).

[0103] Furthermore, in Fig. 3 A confidence interval for the maximum threshold X is plotted, where, for simplicity, a symmetrical confidence interval with the limits X so - ΔX so and X so + ΔX so is assumed. To reduce the false rejection rate to the desired predefined value with even greater certainty, a secondary maximum threshold can be used when detecting anomalies. This secondary maximum threshold is greater than the determined threshold X so by ΔX so. Similarly, a secondary minimum threshold can be used. This secondary minimum threshold is smaller than the determined threshold X su by the width of a confidence interval ΔX su for the lower threshold X su. In other words, the secondary maximum threshold corresponds to the upper limit of the confidence interval for the maximum threshold, and the secondary minimum threshold corresponds to the lower limit of the confidence interval for the minimum threshold.

[0104] Fig. 4 shows a diagram similar to the diagram in Fig. 3 , wherein in the relevant embodiment bad products are used to determine one or the two thresholds Xsu and Xso. In this case, however, the information contained in the bad product anomalies is used in the method for determining the threshold. Instead of a false positive rate, a true positive rate f or a false negative rate is specified here, as explained above.

[0105] In this case, the two thresholds are designated as Ysu and Yso for differentiation. The minimum threshold Ysu must be chosen such that the area under the probability density function above the minimum threshold Ysu corresponds to the desired false negative rate (or the area under the probability density function below the minimum threshold Ysu corresponds to the desired true positive rate). Similarly, the maximum threshold Yso must be chosen such that the area under the probability density function below the maximum threshold Yso corresponds to the desired false negative rate (or the area under the probability density function above the maximum threshold Yso corresponds to the desired true positive rate). Accordingly, the diagram in Fig. 4 a non-bad range between the two thresholds Y su and Y so .

[0106] As explained above, the number of digital images used to determine the threshold(s) (maximum or minimum threshold) can be fixed. However, this number must be chosen to be large enough to determine a sufficiently reliable threshold.

[0107] However, according to another embodiment, the number of required digital images can also be determined during the learning process. For this purpose, at least one termination criterion is defined. Starting with a predetermined minimum number of digital images, a loop of the learning process is executed until at least one termination criterion is met. After each iteration of the loop, the number of digital images can be increased by one or more images. The loop continues to execute until the termination criterion is met or a predetermined maximum number of digital images is reached.

[0108] A confidence interval for one or more of the parameters of the probability density function determined during parameterization can be defined as a termination criterion. However, for this approach to be meaningful, sufficient experience would be required to understand how errors or uncertainties in these parameters affect the threshold to be determined.

[0109] A more advantageous approach is to determine a confidence interval for the relevant threshold. For this purpose, a confidence interval can be determined for each parameter, and then the effect of this uncertainty on the threshold can be calculated. For example, a method for determining error propagation, such as Gaussian error propagation, can be used to determine the effect of the error in parameter determination (using the upper and lower limits of the confidence interval for the thresholds) on the calculation of the relevant threshold.

[0110] Instead of an error propagation method, another suitable statistical procedure can be used to determine a confidence interval for the relevant threshold or for the given rate. Bootstrapping is one example. However, since these are well-known mathematical procedures, a more detailed explanation will be omitted.

[0111] As mentioned above, when using good process products to create the required digital images, it is advantageous to disregard those images based on bad products contained within the good process products when determining the threshold(s). This can be achieved by examining the probability of occurrence of the extreme values ​​in a sample. For this purpose, a parameterized probability density function—initially using all extreme values ​​in a sample—can be employed. For each sample value in the relevant sample, the probability of values ​​occurring that are less than or equal to the respective detected sample value, and the probability of values ​​occurring that are greater than or equal to the respective detected sample value, are determined.If one of the probabilities determined for a sample value is smaller than a predetermined outlier threshold, then this sample value is recognized as an outlier.

[0112] Subsequently, the relevant probability density function can be re-parameterized, whereby sample values ​​identified as outliers are not taken into account (for example, deleted from the relevant list).

[0113] This procedure can also be performed iteratively, whereby the number of iterations can be limited to a maximum number.

[0114] The same applies, of course, to the use of defective process products to determine the threshold value(s). However, this method will likely play a minor role in practice, as defective products are usually produced intentionally, and it is therefore rather unlikely that a good product, which should be sorted out as an outlier, will be found among the defective products.

[0115] Finally, a statistical test can be performed to determine how well the given (parameterized) probability density function describes the empirical distribution of the sample value in question. Examples of possible statistical tests include the chi-square goodness-of-fit test, the Kolmogorov-Smirnov goodness-of-fit test, the Anderson-Darling goodness-of-fit test, the Jarque-Bera goodness-of-fit test, and the Lilliefors goodness-of-fit test. If the test does not yield a satisfactory result for the parameterized probability density function determined—that is, if a value describing the test's performance lies outside a predefined range—an error message can be generated.

[0116] It is also possible to specify several (different types of) probability density functions and perform the statistical test with two or more specified and parameterized probability density functions. The probability density function that yields the best result in the statistical test can then be used to determine the final threshold.

[0117] The basic procedure for determining the threshold value is briefly summarized below using the example in Fig. 5 The simplified flowchart shown explains the process. In the first step, the type of probability density function, for example, a specific type of generalized extremum distribution, is selected. In the next step, an initial image of a good or bad process product is chosen. This image can also be generated in this step, i.e., captured and, if necessary, processed. Subsequently, in a further step, the regions are defined according to previously specified criteria, and the value of the relevant property of each region is determined, for example, the maximum pixel value within each region. Finally, the desired extremum(s) (maximum and / or minimum value) of these region property values ​​are determined.

[0118] Then, it is checked whether the number of extreme values ​​determined in this way (each type, i.e., minimum or maximum value), which corresponds to the number of digital images, is sufficient. For example, this test can be performed to determine whether a predetermined minimum number of maximum values ​​has been reached.

[0119] In a further step, the parameters of the probability density function are then determined in one of the ways described above. From the parameterized probability density function or the associated distribution function, the relevant threshold (for the maximum and / or minimum values) can then be determined in the prescribed manner, using a predetermined rate, such as a false positive rate. The threshold is thus determined in such a way that, when the anomaly detection procedure is applied using the threshold to be determined, the predetermined rate, for example, the false positive rate, is adhered to.

[0120] Once determined, the threshold can be applied during the execution of the procedure. It can, of course, also be stored, output, or used in other ways.

[0121] After determining the parameters of the probability density function, a test can be performed, as explained above, to determine whether the fit of the probability density function to the sample of extreme values ​​or maximum values ​​is sufficient. If not, the number of maximum values ​​(digital images) can be increased and / or a different type of probability density function can be chosen. Furthermore, a confidence interval for the threshold can be determined in the prescribed manner (either during or after the threshold determination step) and tested to see if the width of the confidence interval is sufficiently small. If not, the number of sample values ​​(maximum values ​​or extreme values) can be increased further.

[0122] Fig. 6 The graph shows the rejection rate (in the case of good process products) as a percentage over time, i.e., the ratio of images in which an anomaly was detected divided by a fixed number (or within a fixed time period) of images (or products) examined in the immediate past. The graph includes the predetermined false-positive rate of 0.6%, used to determine the relevant threshold—which was established using good products or good process products—as well as the boundaries of the confidence interval, with the upper limit of the confidence interval at 0.85% and the lower limit at 0.45%. As can be seen from the graph, the rejection rate fluctuates essentially within the confidence interval around the predetermined false-positive rate over a period of 120 hours.The smoother curve represents an ejection rate determined over 24 hours, and the more turbulent curve represents an ejection rate determined over one hour (each calculated as a moving average).

[0123] Fig. 7 shows a diagram analogous to Fig. 6 Even the smoother curve leaves the upper limit of the confidence interval for the false positive rate in a range between approximately 60 and 100 hours. However, this curve does not allow us to determine whether the anomalies are correctly detected or false positives. Regardless, the increase could indicate a problem or change in the manufacturing or processing of the products underlying the digital images under investigation.

[0124] Fig. 8 also shows a diagram analogous to the Fig. 6 and 7However, both curves (ejection rate determined over one hour and 24 hours, respectively) are significantly below the specified false-positive rate, even well below the lower limit of the relevant confidence interval. This information can be used to increase the specified false-positive rate (when repeating the learning process) in order to improve the detection of actual anomalies; in other words, the detection method is made more sensitive.

[0125] This information could also be interpreted as indicating an improvement in production quality compared to the time of initial training. Therefore, the training process could be repeated with the same false-positive rate, resulting in improved sensitivity while maintaining (but no longer significantly falling below) the target false-positive rate.

[0126] The invention thus provides a method for detecting anomalies using a threshold value, wherein a rate can be specified for determining the threshold value at which a maximum or minimum anomaly is to be falsely detected in images to be examined, or a rate at which no maximum or minimum anomaly is to be correctly detected in images to be examined (case of threshold determination using images of good products or good process products), or a rate at which a maximum or minimum anomaly is to be correctly detected in images to be examined, or a rate at which no maximum or minimum anomaly is to be falsely detected in images to be examined (case of threshold determination using images of defective products or defective process products).

[0127] This method is suitable for detecting anomalies in images of products, which can be generated in any way and represent any product properties. In particular, the method is suitable for analyzing images acquired by inspection devices that use X-rays or terahertz radiation and can thus generate information about the interior of a product. The method can be implemented in an inspection device, especially via software. The result of the detection method can be used to control other devices, such as a sorting machine.

[0128] The rate to be specified can be fixed (e.g. in the software) or specified by a user of the method or of a device in which the method is implemented.

[0129] The same applies to the probability density function and its corresponding distribution function. In appropriate software, several of these functions can be integrated for user selection.

[0130] The relevant rate can be specified not only for individual machines or systems, but also for multiple machines or systems. For example, it can be defined that a rate should apply as the overall rate for several identical (or even dissimilar) systems. The value of the rate specified for a machine or system can also be determined from the number of images / products detected within a given time unit according to the specifications, provided that the throughput (total number of images / products per time unit) is also known.

[0131] This value for the number of images / products detected per unit of time according to the specification (e.g., the number of incorrect rejections per hour) can, in turn, result from practical conditions. For example, two people might be assigned to inspect rejected products, rework them if necessary, and then reintroduce them into the process downstream of detection. If each of these operations (inspection and rework, if necessary) takes five minutes, then a maximum of 24 products may be detected and rejected per hour according to the relevant specification. With a throughput of, for example, 1200 / h, the current rejection rate should therefore not exceed 2%. The specified incorrect rejection rate must therefore not exceed 2% under any circumstances so that inspection and rework can take place without a backlog of products requiring inspection and rework.

[0132] Furthermore, it is possible to compare the current ejection rate between two identical detection devices or systems that are fed from the same source. Significantly different current ejection rates indicate a detection error.

[0133] Finally, it should be mentioned that the two methods by which the relevant thresholds X su and / or X so or Y su and / or Y so are determined can also be applied simultaneously, for example to check whether the rate specified for determining the thresholds provides an acceptable threshold.

[0134] Such a verification method is described below with reference to Fig. 9 explained. Fig. 9 Figure 1 shows curve (a) representing the probability density function for maximum values ​​of a property determined using digital images of good products (or good process products), and a second probability density function (curve (b)) representing maximum values ​​of a property determined using digital images of defective products (or defective process products). From the probability density function defining curve (a), the relevant upper threshold X was determined using the associated false positive rate (which can also be called the false rejection rate) or the associated false negative rate.Furthermore, the relevant upper threshold Y was determined from the probability density function that defines curve (b) using the associated false negative rate (which can also be called the false detection rate) or the associated true positive rate.

[0135] Normally, the two threshold values ​​X and Y will not be identical. This is as described in... Fig. 9 If it were shown that the threshold Xxo, determined from the given false ejection rate, is greater than the threshold Yso, determined from the given false detection rate, this would indicate a contradiction: For when using the threshold Xso, the false detection rate resulting from curve (b) (i.e., the value of the integral over curve (b) from negative infinity to the threshold Xso) would be greater than the given value for the false detection rate. Conversely, when using the threshold Yso, the false ejection rate resulting from curve (a) (i.e., the value of the integral over curve (b) from negative infinity to the threshold Xso) would also be greater than the given value for the false detection rate.

[0136] When considering the situation for minimal anomalies, an analogous (but inverted) picture emerges: If the threshold Xsu is smaller than the threshold Ysu, this would mean that using the threshold Xsu would result in a false detection rate (i.e., a value of the integral over the probability density function for the minimal anomalies from Xsu to plus infinity, determined by the other probability density function) that is higher than the false detection rate specified for determining the threshold Ysu. Similarly, in this case, the false rejection rate resulting from the other probability density function for the false products would be greater than the specified false rejection rate if the threshold Ysu is used to calculate it.

[0137] In such a contradictory case, a decision would ultimately have to be made, taking economic conditions into account, as to whether the higher false detection rate (i.e., the probability that a product with a maximum anomaly is not identified as a defective product) or the false rejection rate (i.e., the probability that a good product is identified as a defective product) is of greater importance. In response to such a contradiction, the relevant predetermined rate, which is considered less important, would then have to be modified to produce a corresponding threshold that is no longer considered contradictory.

[0138] Fig. 10This shows a situation where no such contradiction arises. The threshold X is smaller than the threshold Y, so that both specified rates can be met simultaneously, since the false rejection rate and the false detection rate each represent upper limits. In other words, in this case, if the threshold calculated using the respective probability density function and the rate in question were used to calculate the other rate from the other probability density function, it would turn out that the rate thus determined is less than or equal to the rate specified for determining the other probability density function, and is therefore within an acceptable range.

[0139] In such a case, one or both of the given rates can be varied so that the resulting thresholds are closer together or, in extreme cases, even identical. Reference symbol list

[0140] 100 X-ray inspection device 102 Anomaly detection device 104 Product 106 Conveyor device 108 Conveyor belt 110 Conveyor belt 112 Conveyor belt 114 Conveyor belt 116 Shielding housing 118 X-ray source 120 X-ray detector 121 X-ray beam 122 Image processing unit 124 Display unit F_direction X_su lower threshold (determination of the threshold using good products or good process products) Y_su lower threshold (determination of the threshold using bad products or bad process products) X_so upper threshold (determination of the threshold using good products or good process products) Y_so upper threshold (determination of the threshold using bad products or bad process products) ΔX_so width of the confidence interval for the maximum threshold ΔX_su width of the confidence interval for the minimum threshold R fp False positive rate R rn True negative rate R rp True positive rate R fn False negative rate

Claims

1. Computer-implemented method for detecting anomalies in digital images of products, wherein each digital image is formed by a plurality of pixels, and wherein each pixel represents an associated location within the respective image and has a value characterizing the respective location, (a) wherein each image to be examined is regarded as one region or is divided into two or more regions, each consisting of one or more adjacent pixels, (b) and wherein for each region a value for at least one property or a combined value for multiple properties of the region is determined, (c) wherein a region is detected as a maximum anomaly if the value of the at least one property, or a combined value for multiple properties, of the region is greater than a predetermined maximum threshold value or a secondary maximum threshold value derived therefrom, and / or wherein a region is detected as a minimum anomaly if the value of the at least one property, or a combined value for multiple properties, of the region is smaller than a predetermined minimum threshold value or a secondary minimum threshold value derived therefrom, characterized in that (d) the maximum threshold value and / or the minimum threshold value are determined in a learning process in which the following steps are carried out: (i) generating or using a number of digital images of good products which contain no anomaly, or of good process products which predominantly contain no anomaly, wherein the number of images is predetermined or is determined in the course of the learning process; (ii) for each of the digital images, defining the region or regions and determining the value of the at least one property, or the combined value for multiple properties, of each region, and determining the maximum value of these values as the maximum sample value of a maximum value sample, and / or determining the minimum value of these values as the minimum sample value of a minimum value sample; (iii) using a statistical estimation method, determining estimated values for all free, non-predetermined parameters of a probability density function predetermined for describing the maximum value sample, using the maximum sample values, and / or determining estimated values for all free, non-predetermined parameters of a probability density function predetermined for describing the minimum value sample, using the minimum sample values; (iv) wherein the predetermined probability density function is the generalized extreme value distribution; (v) presetting a first rate at which a maximum anomaly is incorrectly detected in images to be examined, or a second rate at which no maximum anomaly is correctly detected in images to be examined, and / or predetermining a third rate at which a minimum anomaly is incorrectly detected in images to be examined, or a fourth rate at which no minimum anomaly is correctly detected in images to be examined; (vi) determining the maximum threshold value using the probability density function parameterized according to (iii), or a distribution function corresponding thereto, such that the probability of occurrence of a maximum value greater than or equal to the maximum threshold value corresponds to the predetermined first rate, or such that the probability of occurrence of a maximum value less than or equal to the maximum threshold value corresponds to the predetermined second rate, and / or (vii) determining the minimum threshold value using the probability density function parameterized according to (iii), or a distribution function corresponding thereto, such that the probability of occurrence of a minimum value less than or equal to the minimum threshold value corresponds to the predetermined third rate, or such that the probability of occurrence of a minimum value greater than or equal to the minimum threshold value corresponds to the predetermined fourth rate.

2. Computer-implemented method for detecting anomalies in digital images of products, wherein each digital image is formed by a plurality of pixels, and wherein each pixel represents an associated location within the respective image and has a value characterizing the respective location, (a) wherein each image to be examined is regarded as one region or is divided into two or more regions, each consisting of one or more adjacent pixels, (b) and wherein for each region a value for at least one property or a combined value for multiple properties of the region is determined, (c) wherein a region is detected as a maximum anomaly if the value of the at least one property, or a combined value for multiple properties, of the region is greater than a predetermined maximum threshold value or a secondary maximum threshold value derived therefrom, and / or wherein a region is detected as a minimum anomaly if the value of the at least one property, or a combined value for multiple properties, of the region is smaller than a predetermined minimum threshold value or a secondary minimum threshold value derived therefrom, characterized in that (d) the maximum threshold value and / or the minimum threshold value are determined in a learning process in which the following steps are carried out: (i) generating or using a number of digital images of bad products which each contain at least one anomaly, or of bad process products which predominantly contain an anomaly, wherein the number of images is predetermined or is determined in the course of the learning process; (ii) for each of the digital images, defining the region or regions and determining the value of the at least one property, or the combined value for multiple properties, of each region, and determining the maximum value of these values as the maximum sample value of a maximum value sample, and / or determining the minimum value of these values as the minimum sample value of a minimum value sample; (iii) using a statistical estimation method, determining estimated values for all free, non-predetermined parameters of a probability density function predetermined for describing the maximum value sample, using the maximum sample values, and / or determining estimated values for all free, non-predetermined parameters of a probability density function predetermined for describing the minimum value sample, using the minimum sample values; (iv) wherein the predetermined probability density function is the generalized extreme value distribution; (v) presetting a fifth rate at which a maximum anomaly is correctly detected in images to be examined, or a sixth rate at which no maximum anomaly is incorrectly detected in images to be examined, and / or predetermining a seventh rate at which a minimum anomaly is correctly detected in images to be examined, or an eighth rate at which no minimum anomaly is incorrectly detected in images to be examined; (vi) determining the maximum threshold value using the probability density function parameterized according to (iii), or a distribution function corresponding thereto, such that the probability of occurrence of a maximum value less than or equal to the maximum threshold value corresponds to the predetermined sixth rate, or such that the probability of occurrence of a maximum value greater than or equal to the maximum threshold value corresponds to the predetermined fifth rate, and / or (vii) determining the minimum threshold value using the probability density function parameterized according to (iii), or a distribution function corresponding thereto, such that the probability of occurrence of a minimum value greater than or equal to the minimum threshold value corresponds to the predetermined eighth rate, or such that the probability of occurrence of a minimum value less than or equal to the minimum threshold value corresponds to the predetermined seventh rate.

3. Method according to claim 1 or 2, characterized in that (a) the region or regions are defined using a base threshold value, wherein each isolated pixel and each group of adjacent pixels whose pixel value is in each case greater than the base threshold value are each assigned to a region of a first group of regions, and / or wherein each isolated pixel and each group of adjacent pixels whose pixel value is in each case less than or equal to the base threshold value are each assigned to a region of a second group of regions, or (b) the region or regions are defined using a geometric mask, in particular a fixed predetermined mask or a mask generated from the respective image by means of image processing.

4. Method according to any one of the preceding claims, characterized in that a geometric property of a region, determined from the location information of the pixels of the region, in particular the area, the circumference or the diameter, is used as the property of a region, or in that a pixel-value property of a region, determined from the values of the pixels of the region, in particular the maximum value or the minimum value of all pixels of the region, the mean value, the variance or the standard deviation, is used as the property of a region.

5. Method according to any one of the preceding claims, characterized in that the number of digital images of good products, good process products, bad products or bad process products to be determined in the course of the learning process is determined using at least one termination criterion, wherein the current number of digital images is increased until the at least one termination criterion is fulfilled.

6. Method according to claim 5, characterised in that the at least one termination criterion is formed by, or derived from, a confidence interval for at least one parameter of the respective probability density function.

7. Method according to claim 5, characterized in that the at least one termination criterion is formed by a threshold-value confidence interval for the minimum threshold value or the maximum threshold value, wherein the threshold-value confidence interval is determined by determining a confidence interval for each parameter and determining the effect of these confidence intervals on the threshold-value confidence interval, in particular using the method of error propagation, in particular the Gaussian error propagation method.

8. Method according to claim 5, characterized in that the at least one termination criterion is formed by a threshold-value confidence interval for the minimum threshold value or maximum threshold value, wherein the respective confidence interval is determined by means of a statistical method, in particular using the bootstrapping method.

9. Method according to any one of the preceding claims, characterized in that, using the respective probability density function and the respective parameters, for each detected maximum sample value and / or minimum sample value the probability is determined with which values occur that are less than or equal to the respective detected maximum sample value or minimum sample value, and the probability with which values occur that are greater than or equal to the respective detected maximum sample value or minimum sample value, and in that the parameters for the probability density function are redetermined if, for at least one of the detected maximum sample values or minimum sample values, one of the two respective probabilities determined in this way is smaller than a predetermined outlier limit, wherein these maximum sample values or minimum sample values remain disregarded in the redetermination.

10. Method according to any one of the preceding claims, characterized in that a statistical test is carried out which provides an indication as to whether the respective predetermined probability density function, using the estimated values determined for its parameters, describes the empirical distribution in the form of the respective detected maximum sample values or minimum sample values with sufficient accuracy.

11. Method according to claim 10, characterized in that the estimation of the parameters, preferably after detection of a predetermined minimum number of maximum sample values or minimum sample values, is carried out for a plurality of predetermined different probability density functions, in that the statistical test is carried out for each of the probability density functions so determined, and in that, for the further method, that probability density function is used as the predetermined probability density function for which the statistical test gives the most appropriate result.

12. Method according to any one of claims 7 to 11, characterized in that a confidence interval or an error limit for the respective predetermined rate is determined from the limits of the confidence interval for the maximum threshold value and / or the minimum threshold value.

13. Method according to claim 12, characterized in that the confidence interval and / or the error limit for the respective predetermined rate are output for monitoring and / or controlling devices, or an entire production line, used for manufacturing, processing or testing the products.

14. Method according to any one of the preceding claims, characterized in that a secondary maximum threshold value is determined, wherein the secondary maximum threshold value is selected within the limits of a confidence interval determined for the maximum threshold value, or equal to a limit of this confidence interval, and / or in that a secondary minimum threshold value is determined, wherein the secondary minimum threshold value is selected within the limits of a confidence interval determined for the minimum threshold value, or equal to a limit of this confidence interval.

15. Method according to any one of the preceding claims, characterized in that the predetermined probability density function is in the form of the generalized extreme value distribution, the Gumbel distribution, the Weibull distribution or the Fréchet distribution.

16. Apparatus for detecting anomalies in digital images of products, comprising a data processing device which is adapted to obtain and process digital image data of digital images of products, wherein the data processing device is adapted to carry out the method according to any one of the preceding claims.

17. Computer program product for detecting anomalies in digital images of products, comprising instructions which, when executed by a data processing device, cause the device to carry out the method according to any one of claims 1 to 15.