Abnormal score graph binaryzation method and device based on connected domain number stability

By adopting an abnormal fraction graph binarization method based on the number stability of the connectivity domain in industrial anomaly detection, the threshold value is adaptively determined and the threshold value is estimated, and the problem of missed detection of binarized results in the prior art is solved, achieving more accurate and Reliable defect positioning and segmentation effects.

CN119027384AActive Publication Date: 2024-11-26HUAZHONG UNIV OF SCI & TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411093690.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-11-26
Estimated Expiration
2044-08-09

AI Technical Summary

Technical Problem

In the existing industrial anomaly detection scenarios, it is difficult for the binary method to achieve the effect of low defect error detection, and the fixed threshold method and the Otsu method have problems of large labor costs and poor universality.

Method used

The abnormal fraction graph binarization method based on the stability of the number of connected domains is adopted, and the threshold search space is adaptively determined, the number of connected domains is exhausted, the threshold is estimated according to the threshold change, and the binarization process is performed to improve the robustness of the results.

Benefits of technology

This method can accurately locate defect locations, reduce error missed detection, enhance the robustness and reliability of binarized results, and is suitable for industrial abnormality detection scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119027384A_ABST
    Figure CN119027384A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer vision, and provides an abnormal score graph binaryzation method and device based on connected domain number stability. The method comprises the following steps: counting a total graph abnormal score corresponding to each abnormal score graph, and adaptively determining a search space of a threshold value; for the abnormal score graph, performing equal-interval exhaustive search in a threshold search space, and counting the number of connected domains in a binarization result under each threshold; and adaptively estimating a corresponding threshold value according to the change condition of the number of the connected domains of the binarization result when the threshold value changes, and carrying out binarization. According to the method, the threshold search space is adaptively determined, and the binarization threshold of each abnormal score image is adaptively obtained according to the change condition of the number of the connected domains of the binarization result when the threshold changes, so that the position of the defect in the original image is relatively accurately positioned, and the method has relatively strong inhibition capability on false detection and missing detection of the defect; and the robustness and reliability of the binarization result are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to an anomaly score based on the stability of the number of connected domains. Figure 2 Value method and device. Background Art

[0002] In the field of industrial automation and quality control, industrial anomaly detection technology plays a vital role. It can automatically detect defects of products on the production line to ensure that product quality meets high standards. Industrial anomaly detection technology involves detecting images containing surface defects and the location of defects in the corresponding images from a large amount of industrial product image data. The existing industrial anomaly detection method generally quantifies the probability of abnormality for each pixel of the input image, and then constructs an abnormal score map of the same size as the original image. This is an effective means of evaluating product surface defects. However, the anomaly score map can only show the probability value of each pixel being abnormal, and cannot determine which pixels are abnormal, so it needs to be binarized to obtain the segmentation result of the abnormal area in the image. In addition, binarization is also an indispensable preprocessing step for many downstream tasks. For example, in the task of discovering new categories of industrial anomalies, the anomaly score map is binarized in advance to segment the abnormal area to guide the network to learn more about the abnormal part; in the defect generation task, the abnormal image and its binarized segmentation result can be used to train the generation model to generate more abnormal images and corresponding annotations, saving the cost of manual annotation. It can be seen that binarization of the anomaly score map is a necessary task in the actual industrial production line and has great application prospects.

[0003] The existing methods for binarizing the abnormal score map of industrial scenes include the fixed threshold method and the Otsu's method. The fixed threshold method artificially takes a unified threshold for all abnormal score images for binarization, that is, the grayscale value of pixels with abnormal scores lower than the threshold is set to 0, and vice versa. This method requires artificial selection of thresholds, and it is necessary to try as many thresholds as possible and evaluate them to select a threshold with fewer false defect omissions corresponding to the binarization results. Moreover, the same threshold may not be applicable to the abnormal score maps output by different abnormal detection models. Changing the abnormal detection method or data set requires re-selection of the threshold, which requires a lot of manual labor and the universality of the threshold is general. The Otsu's method assumes that each grayscale image to be binarized has a foreground and a background (corresponding to defects and normal areas in the industrial abnormality detection scenario, respectively) and presents a bimodal distribution (that is, the pixel groups of the foreground and background each obey different distributions, and the corresponding means of the two distributions are far apart, that is, the two distributions have a certain degree of separability). The threshold that maximizes the difference between the foreground and background after image segmentation (that is, maximizes the inter-class variance) is selected as the threshold. In the industrial anomaly detection scenario, the main disadvantage of Otsu's method is that most of the images in actual industrial production are normal images, with no distinction between foreground and background. Its assumption that "each grayscale image to be binarized has a foreground and background" is no longer valid, which will lead to a large number of false detections in the binarization results of these large numbers of normal images.

[0004] In summary, in the industrial anomaly detection scenario, both the fixed threshold method and the Otsu method have obvious drawbacks, and it is difficult to achieve the corresponding binary results with low false positives and negative detections.

[0005] In view of this, overcoming the defects of the prior art is an urgent problem to be solved in the field of this technology. Summary of the invention

[0006] The technical problem to be solved by the present invention is that in industrial anomaly detection scenarios, it is difficult for the existing technology to achieve the effect of low false positive and missed defect detection in the corresponding binary results.

[0007] The present invention adopts the following technical solution:

[0008] In a first aspect, the present invention provides an anomaly score based on the stability of the number of connected domains. Figure 2 Value methods include:

[0009] In step 201, the whole-image anomaly score corresponding to each anomaly score map is counted, and the search space of the threshold is adaptively determined;

[0010] In step 202, for the anomaly score graph A i , perform an exhaustive search at equal intervals in the threshold search space, and count the number of A under each threshold iThe number of connected domains in the binarization result;

[0011] In step 203, for the anomaly score graph A i , according to the change in the number of connected domains of the binary result when the threshold changes, A is adaptively estimated i The corresponding threshold is then binarized;

[0012] In step 204, all anomaly score graphs {A i |i∈[1,N]} repeat steps 202 and 203 to obtain the corresponding binarization result {M i |i∈[1,N]}.

[0013] Preferably, the method of counting the whole-image anomaly scores corresponding to each anomaly score map and adaptively determining the search space of the threshold specifically includes:

[0014] Calculate {A i The anomaly score {s i |i∈[1,N]}, where s i is the anomaly score map A i Pixel value A i The maximum value of (p);

[0015] Further calculate the maximum value of the anomaly score corresponding to this batch of anomaly score maps: s max =max(s1,s2,…,s N ), s min =min(s1,s2,…,s N );

[0016] The search space for determining the threshold is [s min ,s max ].

[0017] Preferably, the exhaustive search is performed at equal intervals in the threshold search space, and the A under each threshold is counted. i The number of connected domains in the binarization result, including:

[0018] From the threshold interval [s min ,s max ] uniformly sample 64 thresholds to obtain {ε j |j∈[1,64]};

[0019] The interval between two adjacent thresholds is Using the threshold ε j A i Binarize and set the j The pixel value is set to 1, which is less than the threshold ε j The pixel value is set to 0, thus obtaining a binary image

[0020] right Perform image erosion to remove noise and count the number of connected domains in the erosion result graph

[0021] Use {ε j Repeat the above operation for all thresholds in |j∈[1,64]} to obtain the sequence of the number of connected domains in the binarization result corresponding to the increasing threshold

[0022] Preferably, the size of the corrosion kernel used in the corrosion operation is 6×6.

[0023] Preferably, the adaptive estimation of A is performed according to the change in the number of connected domains of the binarization result when the threshold changes. i The corresponding threshold is then binarized, including:

[0024] Take A i The number of connected domains corresponding to the binarization result The mode of the number of connected domains that are not zero in A is taken as i Corresponding estimated value of the number of defective areas

[0025] Finding the sequence of connected domain numbers middle All corresponding subsequences with the same value are used to determine A based on the subsequences with the same value. i The corresponding threshold value;

[0026] Estimated value based on threshold For the anomaly score graph A i Binarize and get image I i The corresponding binarization result M i .

[0027] Preferably, the method for finding the number of connected domains is middle All corresponding subsequences with the same value are used to determine A based on the subsequences with the same value. i The corresponding thresholds include:

[0028] If not present If the length of the corresponding subsequences with the same value or all subsequences with the same value is less than 4, change A i Corresponding estimated value of the number of defective areas is 0, take A i The corresponding threshold estimate is 1;

[0029] If exists For subsequences with the same value whose length is greater than or equal to 4, the longest sequence is selected to represent the sequence with the best regional quantity stability, and then the minimum threshold among all thresholds corresponding to the sequence is selected as A. i The corresponding threshold estimate

[0030] Preferably, before counting the whole-image anomaly score corresponding to each anomaly score map, the method further includes:

[0031] For a batch of product images {I i |i∈[1,N]}, N is the number of images, and the anomaly detection model is used to generate the corresponding anomaly score map {A i |i∈[1,N]}; where A i For image I i Corresponding predicted anomaly score map.

[0032] Preferably, the anomaly detection model is a MuSc model or a CPR model.

[0033] In a second aspect, the present invention also provides an anomaly score based on the stability of the number of connected domains. Figure 2 A value conversion device for realizing the anomaly score based on the stability of the number of connected domains as described in the first aspect Figure 2 A method for valuing a product, the device comprising:

[0034] At least one processor; and a memory in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions are executed by the processor to perform the anomaly score based on the stability of the number of connected domains described in the first aspect. Figure 2 Value method.

[0035] In a third aspect, the present invention further provides a non-volatile computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are executed by one or more processors to complete the method described in the first aspect.

[0036] In a fourth aspect, a chip is provided, comprising: a processor and an interface, for calling and running a computer program stored in the memory from a memory, and executing the method of the first aspect.

[0037] According to a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed on a computer or a processor, the computer or the processor executes the method according to the first aspect.

[0038] The present invention adaptively determines the threshold search space and adaptively obtains the binarization threshold of each abnormal score image according to the change in the number of connected domains of the binarization result when the threshold changes, thereby more accurately locating the position of the defect in the original image, having a strong ability to suppress false omissions of defects, and thereby enhancing the robustness and reliability of the binarization result. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0040] Figure 1 This is the first anomaly score based on the stability of the number of connected domains provided by the embodiment of the present invention. Figure 2 Schematic diagram of the process of valuing method;

[0041] Figure 2 The second abnormal score based on the stability of the number of connected domains provided by the embodiment of the present invention is Figure 2 Schematic diagram of the process of valuing method;

[0042] Figure 3 The third abnormal score based on the stability of the number of connected domains provided by the embodiment of the present invention is Figure 2 Schematic diagram of the process of valuing method;

[0043] Figure 4 This is the fourth anomaly score based on the stability of the number of connected domains provided by the embodiment of the present invention. Figure 2 Schematic diagram of the process of valuing method;

[0044] Figure 5 An abnormal score based on the stability of the number of connected domains provided by the embodiment of the present invention is Figure 2 Schematic diagram of the value method;

[0045] Figure 6 An abnormal score based on the stability of the number of connected domains provided by the embodiment of the present invention is Figure 2 Schematic diagram of the architecture of the value-added device. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0047] Unless the context requires otherwise, throughout the specification and claims, the term "including" is to be interpreted as open inclusion, that is, "including, but not limited to". In the description of the specification, the terms "one embodiment", "some embodiments", "exemplary embodiments", "examples", "specific examples" or "some examples" and the like are intended to indicate that specific features, structures, materials or characteristics associated with the embodiment or example are included in at least one embodiment or example of the present disclosure. The schematic representation of the above terms does not necessarily refer to the same embodiment or example. In addition, the specific features, structures, materials or characteristics may be included in any one or more embodiments or examples in any appropriate manner, that is, although they may be carried in the embodiments or examples of the above terms due to reasons such as the order and position of appearance, it is not limited to that they can be carried in combination by one embodiment or example.

[0048] In the description of the present invention, the terms "first" and "second" are used only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, the meaning of "multiple" is two or more. In addition, for example, the same type of nouns may be described as two independent individuals by adding "A" and "B" at the end. In this case, the corresponding features defined as "A" and "B" are only used to distinguish the same type of individuals for description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features.

[0049] In the description of the present invention, the expression "A and / or B" (where A and B are used to formally represent specific characteristic contents) will be involved, and the corresponding expressions include the following three combinations: only A, only B, and a combination of A and B.

[0050] As used herein, "about," "substantially," or "approximately" includes the stated value and an average value that is within an acceptable range of deviation from the particular value as determined by one of ordinary skill in the art taking into account the measurements in question and the errors associated with the measurement of the particular quantity (i.e., the limitations of the measurement system).

[0051] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0052] Embodiment 1:

[0053] Embodiment 1 of the present invention provides an anomaly score based on the stability of the number of connected domains Figure 2 Value methods, such as Figure 1 As shown, including:

[0054] In step 201, the whole-image anomaly score corresponding to each anomaly score map (ie, the maximum value of the anomaly score in the map) is counted, and the search space of the threshold is adaptively determined.

[0055] In step 202, for the anomaly score graph A i , perform an exhaustive search at equal intervals in the threshold search space (i.e., the search space of the above threshold), and count the number of A under each threshold i The number of connected components in the binarization result.

[0056] In step 203, for the anomaly score graph A i , according to the change in the number of connected domains of the binary result when the threshold changes, A is adaptively estimated i The corresponding threshold is used and binarized.

[0057] In step 204, all anomaly score graphs {A i |i∈[1,N]} repeat steps 202 and 203 to obtain the corresponding binarization result {M i |i∈[1,N]}.

[0058] This embodiment adaptively determines the threshold search space and adaptively obtains the binarization threshold of each abnormal score image according to the change in the number of connected domains of the binarization result when the threshold changes, thereby more accurately locating the position of the defect in the original image, having a strong ability to suppress false omissions of defects, and thus enhancing the robustness and reliability of the binarization result.

[0059] In one embodiment, the whole-image anomaly score corresponding to each anomaly score map is counted to adaptively determine the search space of the threshold, such as Figure 2 As shown, specifically including:

[0060] In step 301, calculate {A i The anomaly score {s i |i∈[1,N]}, where s i is the anomaly score map A i Pixel value A i (p) maximum value; p represents the p-th pixel value.

[0061] In step 302, the maximum value of the anomaly score corresponding to this batch of anomaly score graphs is further calculated: s max =max(s1,s2,…,s N ), s min =min(s1,s2,…,s N ); the maximum value includes the maximum value smax and the minimum value s min .

[0062] In step 303, the search space for determining the threshold is [s min ,s max ].

[0063] In an optional implementation, the exhaustive search is performed at equal intervals in the threshold search space, and the number of A under each threshold is counted. i The number of connected domains in the binarization result, such as Figure 3 As shown, specifically including:

[0064] In step 401, from the threshold interval [s min ,s max ] uniformly sample 64 thresholds to obtain {ε j |j∈[1,64]}, the interval between two adjacent thresholds is

[0065] In step 402, using the threshold ε j A i Binarize and set the j The pixel value is set to 1, which is less than the threshold ε j The pixel value is set to 0, thus obtaining a binary image

[0066] In step 403, Perform image corrosion operation to remove noise, obtain the corrosion result map, and count the number of connected domains in the corrosion result map

[0067] In step 404, use {ε j Repeat the above operation for all thresholds in |j∈[1,64]} to obtain the sequence of the number of connected domains in the binarization result corresponding to the increasing threshold Each connected domain represents a possible defect area.

[0068] The size of the corrosion kernel used in the corrosion operation is 6×6.

[0069] In a specific application scenario, the adaptive estimation of A is performed based on the change in the number of connected domains of the binarization result when the threshold changes. i The corresponding threshold is binarized, such as Figure 4 As shown, specifically including:

[0070] In step 501, take A i The number of connected domains corresponding to the binarization result The mode of the number of connected domains that are not zero in A is taken as iCorresponding estimated value of the number of defective areas

[0071] In step 502, find the number sequence of connected domains middle All corresponding subsequences with the same value are used to determine A based on the subsequences with the same value. i The corresponding threshold.

[0072] In step 503, the threshold value is estimated based on For the anomaly score graph A i Binarize and get image I i The corresponding binarization result M i .

[0073] Wherein, the sequence of finding the number of connected domains middle All corresponding subsequences with the same value are used to determine A based on the subsequences with the same value. i The corresponding thresholds include:

[0074] If not present If all corresponding subsequences with the same value or the length of all subsequences with the same value is less than 4, then change A i Corresponding estimated value of the number of defective areas is 0, take A i The corresponding threshold estimate is 1.

[0075] If exists For subsequences with the same value whose length is greater than or equal to 4, the longest sequence is selected to represent the sequence with the best regional quantity stability, and then the minimum threshold among all thresholds corresponding to the sequence is selected as A. i The corresponding threshold estimate

[0076] In actual use, before calculating the anomaly score of the entire image corresponding to each anomaly score image, the method further includes:

[0077] For a batch of product images {I i |i∈[1,N]}, N is the number of images, and the anomaly detection model is used to generate the corresponding anomaly score map {A i |i∈[1,N]}; where A i For image I i Corresponding predicted anomaly score map.

[0078] Any anomaly detection model can be used to generate the corresponding anomaly score map {A i |i∈[1,N]}, in an optional implementation, the anomaly detection model is a MuSc model or a CPR model.

[0079] Embodiment 2:

[0080] The present invention is based on the method described in Example 1, combined with specific application scenarios, and uses technical descriptions in related scenarios to illustrate the implementation process of the present invention in characteristic scenarios.

[0081] This embodiment provides an anomaly score based on the stability of the number of connected domains. Figure 2 Value method.

[0082] This embodiment takes a batch of anomaly score maps output by any anomaly detection model as an example of input, and the operation steps of this method are as follows:

[0083] 1. Adaptively determine the search space of the threshold.

[0084] 2. Perform an exhaustive search at fixed intervals in the search space and count the number of connected domains corresponding to the binarization results for each threshold.

[0085] 3. According to the change in the number of connected domains of the binarization result when the threshold changes, the threshold corresponding to the anomaly score map is adaptively estimated and binarized.

[0086] The result of step 1 is applicable to all given anomaly score maps. There is no need to repeat this step for different anomaly score maps. Steps 2 to 3 are sufficient. The present invention can greatly reduce the number of anomaly score maps. Figure 2 The false detection and omission of defects in the binarization results can be improved to improve the accuracy and reliability of the binarization effect.

[0087] The following defines the tasks and the symbols involved: For a batch of product images {I i |i∈[1,N]}, N is the number of images, and any anomaly detection model (such as MuSc model or CPR model, etc.) is used to generate the corresponding anomaly score map {A i |i∈[1,N]}, where A i For image I i The task goal is to transform the anomaly score map {A i |i∈[1,N]} is binarized to ensure that the number of false detections of defects in the binarization results is as small as possible.

[0088] To achieve the above object, the present invention provides the following technical solutions: Figure 5 As shown, the following steps are included:

[0089] In step S1, the whole-image anomaly score corresponding to each anomaly score map (the maximum value of the anomaly score in the map) is counted, and the search space of the threshold is adaptively determined:

[0090] Calculate {Ai The anomaly score {s i |i∈[1,N]}, where s i is the anomaly score map A i Pixel value A i (p), and further calculate the maximum value of the anomaly score corresponding to this batch of anomaly score maps: s max =max(s1,s2,…,s N ), s min =min(s1,s2,…,s N ), the search space for determining the threshold is [s min ,s max ].

[0091] In step S2, for the anomaly score map A i , perform an exhaustive search at equal intervals in the threshold search space, and count the number of A under each threshold i The number of connected domains in the binarization result:

[0092] From the threshold interval [s min ,s max ] uniformly sample 64 thresholds to obtain {ε j |j∈[1,64]}, the interval between two adjacent thresholds is Using the threshold ε j A i Binarize and set the j The pixel value is set to 1, which is less than the threshold ε j The pixel value is set to 0, thus obtaining a binary image right Perform image erosion (the erosion kernel size is 6×6) to remove noise, and then count the number of connected domains in the erosion result image. Use {ε j Repeat the above operation for all thresholds in |j∈[1,64]} to obtain the sequence of the number of connected domains in the binarization result corresponding to the increasing threshold Each connected domain represents a possible defect area.

[0093] In step S3, for the anomaly score map A i , according to the change in the number of connected domains of the binary result when the threshold changes, A is adaptively estimated i The corresponding threshold is binarized, wherein step S3 includes step S3-1, step S3-2 and step S3-3:

[0094] In step S3-1, take A i The number of connected domains corresponding to the binarization result The mode of the number of connected domains that are not zero in A is taken as i Corresponding estimated value of the number of defective areas

[0095] In step S3-2, find the number of connected domains middle All corresponding subsequences with the same value (i.e., consecutive subsequences with the same value) subsequence): 1. If it does not exist If the length of the corresponding subsequences with the same value or all subsequences with the same value is less than 4, change A i Corresponding estimated value of the number of defective areas is 0, take A i The corresponding threshold estimate 1; 2. If it exists For subsequences with the same value whose length is greater than or equal to 4, the longest sequence is selected to represent the sequence with the best regional quantity stability, and then the minimum threshold among all thresholds corresponding to the sequence is selected as A. i The corresponding threshold estimate

[0096] In step S3-3, the threshold value is estimated based on For the anomaly score map A i Binarize and get image I i The corresponding binarization result M i .

[0097] In step S4, for all anomaly score maps {A i |i∈[1,N]} Repeat steps S2 and S3 to obtain the corresponding binarization result {M i |i∈[1,N]}.

[0098] In general, the above technical solution conceived by the present invention has the following advantages compared with the existing method:

[0099] Beneficial effects:

[0100] This embodiment proposes a novel binarization method for anomaly score images, which can adaptively determine the threshold search space and adaptively obtain the binarization threshold of each anomaly score image according to the change in the number of connected domains of the binarization result when the threshold changes, so as to more accurately locate the position of the defect in the original image, have a strong ability to suppress false omissions of defects, and thus enhance the robustness and reliability of the binarization result.

[0101] Embodiment 3:

[0102] like Figure 6 As shown, it is an abnormal score based on the stability of the number of connected domains according to an embodiment of the present invention. Figure 2Schematic diagram of the architecture of the value-based device. Anomaly score based on the stability of the number of connected domains in this embodiment Figure 2 The valuing device includes one or more processors 21 and a memory 22. Figure 6 A processor 21 is taken as an example.

[0103] The processor 21 and the memory 22 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0104] The memory 22 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs and non-volatile computer executable programs, such as the abnormality score based on the stability of the number of connected domains in Example 1. Figure 2 The processor 21 executes the anomaly score based on the stability of the number of connected domains by running the non-volatile software program and instructions stored in the memory 22. Figure 2 Value method.

[0105] The memory 22 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 22 may optionally include a memory remotely arranged relative to the processor 21, and these remote memories may be connected to the processor 21 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0106] The program instructions / modules are stored in the memory 22, and when executed by the one or more processors 21, the abnormal score based on the stability of the number of connected domains in the above embodiment 1 is performed. Figure 2 Value method.

[0107] It is worth noting that the information interaction, execution process, etc. between the modules and units within the above-mentioned devices and systems are based on the same concept as the processing method embodiment of the present invention. The specific contents can be found in the description of the method embodiment of the present invention and will not be repeated here.

[0108] A person skilled in the art may understand that all or part of the steps in the various methods of the embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0109] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for binarizing anomaly score graphs based on the stability of the number of connected domains. It is characterized in that include: In step 201, the whole-image anomaly score corresponding to each anomaly score map is counted, and the search space of the threshold is adaptively determined; In step 202, for the anomaly score graph A i , perform an exhaustive search at equal intervals in the threshold search space, and count the number of A under each threshold i The number of connected domains in the binarization result; In step 203, for the anomaly score graph A i , according to the change in the number of connected domains of the binary result when the threshold changes, A is adaptively estimated i The corresponding threshold is then binarized; In step 204, all anomaly score graphs {A i |i∈[1,N]} Repeat steps 202 and 203 to obtain the corresponding binarization result {M i |i∈[1,N]}.

2. The method for binarizing anomaly score graphs based on the stability of the number of connected domains according to claim 1, It is characterized in that The method of counting the anomaly scores of the entire image corresponding to each anomaly score image and adaptively determining the search space of the threshold specifically includes: Calculate {A i The anomaly score {s i |i∈[1,N]}, where s i is the anomaly score map A i Pixel value A i The maximum value of (p); Further calculate the maximum value of the anomaly score corresponding to this batch of anomaly score maps: s max =max(s 1 ,s 2 ,…,s N ), s min =min(s 1 ,s 2 ,…,s N ); The search space for determining the threshold is [s min ,s max ].

3. The method for binarizing anomaly score graphs based on the stability of the number of connected domains according to claim 1, It is characterized in that The exhaustive search is performed at equal intervals in the threshold search space, and the A under each threshold is counted. i The number of connected domains in the binarization result, including: From the threshold interval [s min ,s max ] uniformly sample 64 thresholds to obtain {ε j |j∈[1,64]}, the interval between two adjacent thresholds is Using the threshold ε j A i Binarize and set the j The pixel value is set to 1, which is less than the threshold ε j The pixel value is set to 0, thus obtaining a binary image right Perform image erosion to remove noise and count the number of connected domains in the erosion result graph Use {ε j Repeat the above operation for all thresholds in |j∈[1,64]} to obtain the sequence of the number of connected domains in the binarization result corresponding to the increasing threshold 4. The method for binarizing anomaly score graphs based on the stability of the number of connected domains according to claim 3, It is characterized in that The size of the corrosion kernel used in the corrosion operation is 6×6.

5. The method for binarizing anomaly score graphs based on the stability of the number of connected domains according to claim 1, It is characterized in that The adaptive estimation of A is performed according to the change in the number of connected domains of the binarization result when the threshold changes. i The corresponding threshold is then binarized, including: Take A i The number of connected domains corresponding to the binarization result The mode of the number of connected domains that are not zero in A is taken as i Corresponding estimated value of the number of defective areas Finding the sequence of connected domain numbers middle All corresponding subsequences with the same value are used to determine A based on the subsequences with the same value i The corresponding threshold value; Estimated value based on threshold For the anomaly score map A i Binarize and get image I i The corresponding binarization result M i .

6. The method for binarizing anomaly score graphs based on the stability of the number of connected domains according to claim 5, It is characterized in that The method of finding the number sequence of connected domains middle All corresponding subsequences with the same value are used to determine A based on the subsequences with the same value i The corresponding thresholds include: If not present If the length of the corresponding subsequences with the same value or all subsequences with the same value is less than 4, change A i Corresponding estimated value of the number of defective areas is 0, take A i The corresponding threshold estimate is 1; If exists For subsequences with the same value whose length is greater than or equal to 4, the longest sequence is selected to represent the sequence with the best regional quantity stability, and then the minimum threshold among all thresholds corresponding to the sequence is selected as A. i The corresponding threshold estimate 7. The method for binarizing anomaly score graphs based on the stability of the number of connected domains according to claim 1, It is characterized in that Before counting the whole-image anomaly scores corresponding to each anomaly score map, the method further includes: For a batch of product images {I i |i∈[1,N]}, N is the number of images, and the anomaly detection model is used to generate the corresponding anomaly score map {A i |i∈[1,N]}; where A i For image I i Corresponding predicted anomaly score map.

8. The method for binarizing anomaly score graphs based on the stability of the number of connected domains according to claim 7, It is characterized in that The anomaly detection model is a MuSc model or a CPR model.

9. A non-volatile computer storage medium, It is characterized in that The computer storage medium stores computer executable instructions, which are executed by one or more processors to complete the method for binarizing anomaly score graphs based on the stability of the number of connected domains as described in any one of claims 1-8.

10. A device for binarizing anomaly score graph based on the stability of the number of connected domains. It is characterized in that include: at least one processor; And, a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor to execute the method for binarizing anomaly score graphs based on the stability of the number of connected domains as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Method and system for detecting hairline defect in steel plate rolling process

    CN115294099A

  • Self-adaptive multi-black-spot detection and removal method for manuscript image

    CN116935402A

  • Method for rapidly marking binary connected domain of three-dimensional image

    CN117635647A

  • Wafer defect detection method, device and equipment and readable storage medium

    CN118115447A

  • Contrast enhancement and reduction of noise in images from cameras

    US20190188835A1