A surface defect detection method, device and electronic equipment
By adjusting the filtering direction of the initial filter to generate the target filter, the problem of low applicability of defect detection in the existing technology is solved, and efficient and accurate defect detection of different material surfaces is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-26
- Publication Date
- 2026-03-17
AI Technical Summary
In existing technologies, filter-based defect detection methods are usually designed for detecting the surface texture of a certain material, which has low applicability and cannot meet the needs of different scenarios.
The initial filter adjusts its direction based on the defect detection results of the marked sample to generate a target filter, which is used to detect defects on the surface of different materials.
It enables the detection of surface defects in a wide range of applications, improves the accuracy and efficiency of detection, reduces false detections of textured areas, and is applicable to a variety of material surfaces.
Smart Images

Figure CN115294041B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus and electronic device for detecting surface defects. Background Technology
[0002] In related technologies, filter-based defect detection methods for material surfaces are usually designed specifically for detecting the texture of a certain material surface, which cannot meet the needs of different scenarios and has low applicability. Summary of the Invention
[0003] The purpose of this invention is to provide a surface defect detection method, apparatus, and electronic device, thereby offering a widely applicable surface defect detection method. The specific technical solution is as follows:
[0004] A first aspect of the present invention provides a surface defect detection method, the method comprising:
[0005] Obtain the sample to be tested;
[0006] The sample to be detected is input into a target filter for filtering and detection to obtain the defect detection result;
[0007] The target filter is a filter obtained by adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with defective regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each of the initial filtering directions.
[0008] In one possible embodiment, the initial defect detection result includes the filter response values of each pixel in the defect region of the marked sample in each of the initial filter directions.
[0009] The step of adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with marked defective regions includes:
[0010] Based on the filter response value of each pixel in the defect region in the initial filter direction in the initial defect detection result, a first filter direction is determined, wherein the filter response value of each pixel in the defect region in the first filter direction is greater than a first preset threshold.
[0011] Adjust the initial filtering direction to the first filtering direction.
[0012] In one possible embodiment, the filter response values of each pixel in the defective region in each of the initial filtering directions are obtained by:
[0013] The initial filter is used to filter each pixel in the marked sample in each initial filtering direction to obtain the original filtered value of each pixel in the defect region in each initial filtering direction.
[0014] For each pixel in the defect region and each initial filtering direction, the original filtered value of the pixel in the initial filtering direction and the original filtered value of the pixel in the adjacent filtering direction are statistically analyzed to obtain the filtered response value of the pixel in the initial filtering direction. The adjacent filtering direction is other initial filtering directions that are adjacent to the initial filtering direction.
[0015] In one possible embodiment, determining the first filtering direction based on the filter response values of each pixel in the defect region in the initial filtering direction in the initial defect detection result includes:
[0016] For each pixel in the defect region, a pixel filtering direction is determined in each of the initial filtering directions, wherein the filtering response value of the pixel in the pixel filtering direction is greater than a second preset threshold.
[0017] For each initial filtering direction, the filter response values of all pixels whose pixel filtering direction is the initial filtering direction are superimposed on the initial filtering direction to obtain the superimposed filter value of the initial filtering direction;
[0018] An initial filtering direction is determined when the superimposed filter value is greater than a first preset threshold, and this direction is taken as the first filtering direction.
[0019] In one possible embodiment, the method further includes:
[0020] Multiple filtering directions are selected from the neighborhood of the first filtering direction as the updated filtering directions;
[0021] The defective regions in the labeled samples are filtered and detected in each of the updated filtering directions using the initial filter to obtain updated defect detection results.
[0022] Until the preset loop termination condition is met, the updated filtering direction is used as the new initial filtering direction, and the updated defect detection result is used as the new initial defect detection result. Then, the process returns to the step of determining the first filtering direction based on the filtering response value of each pixel in the defect region in the initial defect detection result in the initial filtering direction.
[0023] In one possible embodiment, the method further includes:
[0024] A first weight is determined for each of the first filtering directions, wherein the first weight is positively correlated with the superimposed filter value of the first filtering direction.
[0025] In one possible embodiment, the target filter is obtained by adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with defective regions, and adjusting the initial weights corresponding to the initial filtering directions of the initial filter based on the detection results of the non-defective regions in the initial defect detection results of the marked samples with non-defective regions.
[0026] In a second aspect of the invention, a surface defect detection method is also provided, the method comprising:
[0027] Obtain the sample to be tested;
[0028] The sample to be detected is input into a target filter for filtering and detection to obtain the defect detection result;
[0029] The target filter is an initial filter obtained by adjusting the initial weights corresponding to each initial filtering direction of the initial filter based on the detection results of the non-defect regions in the initial defect detection results of the marked samples with marked non-defect regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each of the initial filtering directions.
[0030] In one possible embodiment, the initial defect detection result includes the filter response values of each pixel in the non-defect region of the marked sample in each of the initial filter directions.
[0031] The step of adjusting the initial weights corresponding to each initial filtering direction of the initial filter based on the detection results of the non-defect regions in the initial defect detection results of the marked samples with marked non-defect regions includes:
[0032] Based on the filter response value of each pixel in the non-defect region in the initial defect detection result in the initial filter direction, a first filter direction is determined, wherein the filter response value of each pixel in the non-defect region in the first filter direction is greater than a first preset threshold.
[0033] The initial weight corresponding to the first filtering direction is adjusted to a first weight based on the filtering response value of each pixel in the non-defect region in the first filtering direction. The first weight is negatively correlated with the filtering response value of each pixel in the non-defect region in the first filtering direction.
[0034] In one possible embodiment, adjusting the initial weight corresponding to the first filtering direction to a first weight based on the filtering response value of each pixel in the non-defect region in the first filtering direction includes:
[0035] For each first filtering direction, the filtering response values of all pixels in the non-defect region in the first filtering direction are superimposed to obtain the superimposed filtering value in the first filtering direction;
[0036] The initial weight corresponding to each of the first filtering directions is adjusted to a first weight based on the superimposed filter value in each of the first filtering directions. The first weight corresponding to the first filtering direction is negatively correlated with the superimposed filter value in the first filtering direction.
[0037] In one possible embodiment, adjusting the initial weight corresponding to the first filtering direction to a first weight based on the superimposed filter value in each of the first filtering directions includes:
[0038] The quotient of the superimposed filter value and the area of the non-defect region in each of the first filtering directions is obtained to obtain the weight difference corresponding to each of the first filtering directions;
[0039] The first weight corresponding to each of the first filtering directions is obtained by subtracting the initial weight corresponding to each of the first filtering directions from the weight difference corresponding to each of the first filtering directions.
[0040] In a third aspect of the invention, a surface defect detection device is also provided, the device comprising:
[0041] The sample acquisition module is used to acquire the sample to be tested;
[0042] The sample detection module is used to input the sample to be detected into the target filter for filtering and detection, and to obtain the defect detection result.
[0043] The target filter is a filter obtained by adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with defective regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each of the initial filtering directions.
[0044] In one possible embodiment, a first direction determination module is further included, configured to adjust the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with marked defective regions, by means of:
[0045] Based on the filter response value of each pixel in the defect region in the initial filter direction in the initial defect detection result, a first filter direction is determined, wherein the filter response value of each pixel in the defect region in the first filter direction is greater than a first preset threshold.
[0046] Adjust the initial filtering direction to the first filtering direction;
[0047] The filter response acquisition module is used to obtain the filter response value of each pixel in the defect region in each of the initial filter directions in the following manner:
[0048] The initial filter is used to filter each pixel in the marked sample in each initial filtering direction to obtain the original filtered value of each pixel in the defect region in each initial filtering direction.
[0049] For each pixel in the defect region and each initial filtering direction, the original filtered value of the pixel in the initial filtering direction and the original filtered value of the pixel in the adjacent filtering direction are statistically analyzed to obtain the filtered response value of the pixel in the initial filtering direction. The adjacent filtering direction is other initial filtering directions that are adjacent to the initial filtering direction.
[0050] The update filtering module is used to select multiple filtering directions from the neighborhood of the first filtering direction as the update filtering directions;
[0051] The update detection module is used to perform filter detection on the defect region in the marked sample in each of the update filter directions through the initial filter to obtain the update defect detection result;
[0052] The return module is used to return to the execution of the step "determine the first filtering direction based on the filtering response value of each pixel in the defect region in the initial filtering direction" until the preset loop termination condition is met, taking the updated filtering direction as the new initial filtering direction and the updated defect detection result as the new initial defect detection result.
[0053] The weight determination module is used to determine a first weight for each of the first filtering directions, wherein the first weight is positively correlated with the superimposed filter value of the first filtering direction;
[0054] The first direction determination module includes:
[0055] A threshold determination submodule is used to determine the pixel filtering direction of each pixel in the defect region in each of the initial filtering directions, wherein the filtering response value of the pixel in the pixel filtering direction is greater than a second preset threshold.
[0056] The superposition filtering determination submodule is used to superimpose the filter response values of all pixels with the initial filtering direction as the pixel filtering direction on the initial filtering direction for each initial filtering direction, so as to obtain the superposition filtering value of the initial filtering direction.
[0057] The first filtering determination submodule is used to determine the initial filtering direction when the superimposed filtering value is greater than the first preset threshold, and use it as the first filtering direction;
[0058] The initial defect detection result includes the filtering response value of each pixel in the defect region of the marked sample in each of the initial filtering directions; the target filter is obtained by adjusting each initial filtering direction of the initial filter according to the detection result of the defect region in the initial defect detection result of the marked sample with defect region, and adjusting each initial weight corresponding to each initial filtering direction of the initial filter according to the detection result of the non-defect region in the initial defect detection result of the marked sample with non-defect region.
[0059] In a fourth aspect of the invention, a surface defect detection apparatus is also provided, the apparatus comprising:
[0060] The acquisition module is used to acquire the sample to be tested;
[0061] The detection module is used to input the sample to be detected into the target filter for filtering and detection, and to obtain the defect detection result;
[0062] The target filter is an initial filter obtained by adjusting the initial weights corresponding to each initial filtering direction of the initial filter based on the detection results of the non-defect regions in the initial defect detection results of the marked samples with marked non-defect regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each of the initial filtering directions.
[0063] In one possible embodiment, the apparatus further includes a first weight determination module, configured to adjust the initial weights corresponding to each initial filtering direction of the initial filter based on the detection results of the non-defect regions in the initial defect detection results of the marked samples labeled with non-defect regions, in the following manner:
[0064] Based on the filter response value of each pixel in the non-defect region in the initial defect detection result in the initial filter direction, a first filter direction is determined, wherein the filter response value of each pixel in the non-defect region in the first filter direction is greater than a first preset threshold.
[0065] The initial weight corresponding to the first filtering direction is adjusted to a first weight based on the filtering response value of each pixel in the non-defect region in the first filtering direction. The first weight is negatively correlated with the filtering response value of each pixel in the non-defect region in the first filtering direction.
[0066] The first weight determination module includes:
[0067] The overlay submodule is used to overlay the filter response values of all pixels in the non-defect region in the first filter direction for each first filter direction, so as to obtain the overlay filter value in the first filter direction.
[0068] The first weighting submodule is used to adjust the initial weight corresponding to the first filtering direction to a first weight according to the superimposed filter value in each of the first filtering directions, wherein the first weight corresponding to the first filtering direction is negatively correlated with the superimposed filter value in the first filtering direction;
[0069] The first weighting submodule includes:
[0070] The weight difference unit is used to obtain the quotient of the superimposed filter value and the area of the non-defect region in each of the first filtering directions, and to obtain the weight difference corresponding to each of the first filtering directions.
[0071] The first weighting unit is used to subtract the initial weight corresponding to each first filtering direction from the weight difference corresponding to each first filtering direction to obtain the first weight corresponding to each first filtering direction.
[0072] The initial defect detection result includes the filter response value of each pixel in the non-defect region of the marked sample in each of the initial filter directions.
[0073] In a fifth aspect of the invention, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.
[0074] Memory, used to store computer programs;
[0075] A processor, when executing a program stored in memory, implements the steps of the method described in either the first or second aspect.
[0076] In a sixth aspect of the invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when executed by a processor, the computer program implements the steps of the method described in either the first or second aspect.
[0077] Beneficial effects of the embodiments of the present invention:
[0078] The surface defect detection method provided in this invention uses a pre-trained target filter to detect the sample to be detected and obtain the defect detection result. The target filter is obtained by adjusting the initial filtering direction of the initial filter according to the initial defect detection result. The initial defect detection result is obtained by the initial filter filtering the marked sample in each initial filtering direction. Since the marked sample has a marked defect area, the initial defect detection result obtained by the initial filter can be verified by the marked defect area. Furthermore, this scheme can make the trained target filter adaptable to the material corresponding to different marked samples by inputting marked samples, and does not specify the surface defect detection of a certain material. Therefore, it can meet the surface defect detection needs of different scenarios, that is, it provides a surface defect detection method with wide applicability.
[0079] Of course, implementing any product or method of the present invention does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0080] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0081] Figure 1 This is a schematic flowchart of a surface defect detection method provided in an embodiment of the present invention;
[0082] Figure 2 A flowchart illustrating a method for adjusting the initial filtering direction provided in an embodiment of the present invention;
[0083] Figure 3 This is a histogram of the filter response values of each pixel in the defect region in each initial filtering direction, provided in an embodiment of the present invention.
[0084] Figure 4 A flowchart illustrating another method for adjusting the initial filtering direction provided in an embodiment of the present invention;
[0085] Figure 5 This is a schematic flowchart of another surface defect detection method provided in an embodiment of the present invention;
[0086] Figure 6 A flowchart illustrating an initial weight adjustment method provided in an embodiment of the present invention;
[0087] Figure 7A schematic flowchart of another method for adjusting initial weights provided in an embodiment of the present invention;
[0088] Figure 8 A schematic flowchart of another method for adjusting initial weights provided in an embodiment of the present invention;
[0089] Figure 9 This is a schematic diagram of the structure of a surface defect detection device provided in an embodiment of the present invention;
[0090] Figure 10 This is a schematic diagram of another surface defect detection device provided in an embodiment of the present invention;
[0091] Figure 11 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0092] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on the present invention are within the scope of protection of the present invention.
[0093] As mentioned above, related defect detection methods typically target the regularly distributed textures on the surface of a specific target object. Therefore, these methods are highly sensitive to material variations. Applying a defect detection method specific to a particular material to other materials may result in inaccurate detection, thus exhibiting low adaptability. Based on this, the present invention provides a surface defect detection method applicable to any electronic device with surface defect detection capabilities. The surface defect detection method provided by the present invention is as follows: Figure 1 As shown, it includes:
[0094] S101, Obtain the sample to be tested.
[0095] S102, the sample to be tested is input into the target filter for filtering and detection to obtain the defect detection result.
[0096] The target filter is a filter obtained by adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with defective regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each initial filtering direction.
[0097] In this embodiment, a pre-trained target filter is used to detect the sample to be detected, and a defect detection result is obtained. The target filter is obtained by adjusting the initial filtering direction of the initial filter based on the initial defect detection result. The initial defect detection result is obtained by filtering the marked sample in each initial filtering direction. Since the defect region is marked in the marked sample, the initial defect detection result obtained by the initial filter on the defect detection of the marked sample can be verified based on the marked defect region. Furthermore, this scheme can make the trained target filter adaptable to the material corresponding to different marked samples by inputting marked samples, and does not specify the surface defect detection of a certain material. Therefore, it can meet the surface defect detection needs in different scenarios, that is, it provides a widely applicable surface defect detection method.
[0098] In S101, the sample to be tested can be obtained by the execution entity through interaction with the user in response to the user selecting or uploading the sample to be tested, or it can be obtained from the sample library that needs to be defect-detected.
[0099] In S102, the initial filtering direction of the initial filter can be multiple, and the number can vary depending on the application scenario. For example, the initial filtering direction of the initial filter can be 2, 3, 4 or more.
[0100] The range of values for each initial filtering direction can be (0°, 360°). Considering that if the angle between two initial filtering directions is an integer multiple of 180°, then the two initial filtering directions are essentially the same filtering direction, in one possible embodiment, the range of values for the initial filtering direction is (0°, 180°).
[0101] The initial filtering directions of the initial filter can be evenly distributed at equal angular intervals. For example, if there are 6 initial filtering directions, the 6 initial filtering directions can be 0°, 30°, 60°, 90°, 120°, and 150° respectively. Furthermore, each initial filtering direction can be distributed with random seed points or based on other rule-based angle distribution methods.
[0102] The purpose of setting the initial filtering direction of the initial filter is to determine the starting direction of the filtering kernel of the initial filter. This invention does not limit the distribution of the directional angles of each initial filtering direction, but it should cover the value range of the initial filtering directions as evenly as possible. Correspondingly, the initial weights corresponding to each initial filtering direction in the initial filter can be the same or randomly distributed; this invention does not limit this. In this paper, the weight of a filtering direction refers to the degree of influence of the response value of that filtering direction on the defect detection result. As an example, the initial filter of this invention can be expressed by the following formula:
[0103]
[0104] Where F is the expression for the initial filter, and f(·) represents any filter kernel function with adjustable initial filter direction, such as the Gabor function. θ i For the i-th initial filtering direction, ω i Let be the initial weights for the i-th initial filtering direction, and n be the number of initial filtering directions.
[0105] Understandably, the labeled samples should be made of the same or similar material as the samples to be detected, so that the initial filter, after being trained on the labeled samples, can subsequently produce a target filter capable of accurately detecting defects in the samples to be detected made of the same or similar material as the labeled samples. The initial filter's defect detection of the labeled samples can be performed by the user interacting with the execution entity to select one or more labeled samples with defective areas, and the execution entity then inputs these labeled samples with defective areas into the initial filter for defect detection.
[0106] The process of detecting defects in marked samples with defective regions using an initial filter is to filter the marked sample in the initial filtering direction and then sum the filter response values in each initial filtering direction according to weights to obtain the initial defect detection result.
[0107] The initial defect detection result obtained by performing defect detection on the entire marked sample using an initial filter necessarily includes the detection results of the marked defect regions in the marked sample. Since the defect regions in the marked sample are clearly marked, the detection results of the defect regions in the initial defect detection result can be determined based on the markings. Furthermore, since the marked defect regions in the marked sample can be used to verify the initial filter's detection results for the defect regions. As an example, the filter response value in the initial defect detection result should be proportional to the visual salience of the defect region in the marked sample. Therefore, the filter response value in the defect region detection result should be large, increasing with the salience of the defect. Based on this, the detection results of the defect regions are verified, and then the initial filter direction is adjusted according to the verification result so that the target filter direction is towards the defect region in the sample to be detected, thereby obtaining an accurate defect detection result. Specifically, by adjusting the θ value of the above initial filter expression, filter kernel functions with different direction specificities can be obtained, thereby obtaining target filters with different direction specificities. That is, when using this filter to filter the sample to be detected, defect regions in the sample to be detected with a gradient distribution similar in direction to the filter kernel will produce larger filter response values.
[0108] The sample to be tested is input into the target filter. The target filter detects the sample through a set of filter kernel functions with different filtering directions. The filter response values of each filtering direction are weighted and superimposed to obtain the defect detection result of the sample.
[0109] In actual defect detection processes, some directions of the sample to be inspected may not have defects, or some directions may have textures that are not considered defects. However, by using the above-mentioned scheme of this invention, the initial filter can adjust its initial filtering direction based on the defect areas of the marked sample and the initial defect detection results. This results in a target filter that is directionally selective for the material of the sample to be inspected, reducing filtering detection of areas without defects and improving defect detection efficiency. Simultaneously, it avoids filtering detection of textured areas, reducing false detections caused by the filter misidentifying high filtering response values in textured areas as defects, thus improving the accuracy of defect detection.
[0110] Furthermore, in the above-described scheme of the present invention, the initial filter only needs to be trained with one or a few labeled samples to enable the initial filter to adaptively adjust its parameters (such as the initial filtering direction), which meets the needs of different scenarios. At the same time, it does not require a large amount of defect sample data for training, and the above scheme can be quickly deployed in various scenarios, providing a simple and efficient surface defect detection method.
[0111] To ensure accurate defect detection results for the sample under test, the filtering direction of the target filter should ideally align with the direction of defect distribution in the sample. Based on this, the present invention provides a method for adjusting the initial filtering direction, such as... Figure 2 As shown, the initial defect detection result includes the filter response values of each pixel in the defect region of the marked sample in each initial filter direction. The method includes:
[0112] S201, determine the first filtering direction based on the filtering response value of each pixel in the defect region in the initial filtering direction in the initial defect detection result.
[0113] S202, adjust the initial filtering direction to the first filtering direction.
[0114] As explained in the preceding description of S102, the initial filter's filtering detection process for the marked sample is the process of filtering in each initial filtering direction and obtaining the filtering response value. Therefore, the initial filtering detection result contains the filtering response value of each pixel of the marked sample in each initial filtering direction, and it must also contain the filtering response value of each pixel of the defect region in each initial filtering direction.
[0115] In S201, the filter response value of each pixel in the defect area in the first filter direction is greater than the first preset threshold.
[0116] Each pixel in the defect region has a corresponding filter response value in each initial filtering direction. The initial filtering direction in which the filter response value of each pixel in the defect region is greater than a first preset threshold is taken as the first filtering direction. It can be understood that there can be one or more first filtering directions. For example, suppose there are four initial filtering directions, denoted as initial filtering directions 1-4. The filter response values of each pixel in the defect region in initial filtering directions 1-4 are 100, 120, 140, and 80, respectively. If the first preset threshold is 110, then the first filtering directions are initial filtering directions 2 and 3. If the first preset threshold is 130, then the first filtering direction is initial filtering direction 3.
[0117] The first preset threshold can be a value set manually according to needs or the experience of those skilled in the art, or it can be the value of the filter response value in a preset ranking order after sorting the filter response values from smallest to largest, or it can be a value calculated based on the filter response values in the ranking order. For example, in one possible embodiment, the filter response value in the second order can be used as the first preset threshold; in another possible embodiment, 80% of the filter response value in the first order can be used as the first preset threshold. The present invention is not limited in this respect.
[0118] For example, suppose the first preset threshold is 80% of the filter response value in the first order, and there are a total of 9 initial filtering directions, namely 0°, 20°, 40°, 60°..., 140°, 160°, and the filter response value of each pixel in the defect area in each initial filtering direction is as follows: Figure 3 As shown, the horizontal axis represents the initial filtering direction, and the vertical axis represents the filtering response value of each pixel in the initial filtering direction.
[0119] In this example, the pixel in the defect area has the largest filter response value at 120°, denoted as max. Therefore, the first preset threshold in this example is 0.8max. Figure 3 As shown, since the filter response values of each pixel in the defect area are greater than 0.8max at 60°, 120° and 140°, while the filter response values are less than 0.8max in other initial filter directions, 60°, 120° and 140° are determined as the first filter directions in this example.
[0120] It is understandable that the labeled samples often contain noise signals, which makes the initial defect detection results of the initial filter output inaccurate. Therefore, if the output of the initial filter is directly used as the filter response value, it will lead to the determination of the wrong first filtering direction based on the inaccurate filter response value, which in turn will cause the trained target filter to be unable to accurately filter and detect the sample to be detected.
[0121] Based on this, in one possible embodiment, the filter response value of each pixel in the defect region in each initial filtering direction is obtained in the following way:
[0122] Each pixel in the marked sample is filtered in each initial filtering direction using an initial filter to obtain the original filtered value of each pixel in the defect region in each initial filtering direction. For each pixel in the defect region and each initial filtering direction, the original filtered value of the pixel in the initial filtering direction and the original filtered value of the pixel in the adjacent filtering direction are statistically analyzed to obtain the filtered response value of the pixel in the initial filtering direction.
[0123] In this context, adjacent filtering directions refer to other initial filtering directions adjacent to the initial filtering direction. In this paper, two initial filtering directions being adjacent means that the number of initial filtering directions between them is less than a preset value. For example, assuming there are a total of 6 initial filtering directions: 0°, 30°, 60°, 90°, 120°, and 150°, if the preset value is 1, then since the number of initial filtering directions between 0° and 30° is 0, which is less than the preset value, 0° and 30° are adjacent. However, the number of initial filtering directions between 0° and 60° is 1 (30°), which is not less than the preset value, so 0° and 60° are not adjacent. If the preset value is 2, then the number of initial filtering directions between 0° and 60° is 1 (30°), which is less than the preset value, so 0° and 60° are adjacent. The preset value can be set based on experience and / or actual needs.
[0124] Statistical methods include, but are not limited to, any one of the following: weighted summation, finding the maximum value, finding the minimum value, finding the average value, and finding the median. For ease of description, the following example uses weighted summation as an illustration:
[0125] Assume that the i-th initial filtering direction is adjacent to the (i-2)-th, (i-1)-th, (i+1)-th, and (i+2)-th initial filtering directions, and denote the original filtered value of each pixel in the defect region in the (i-2)-th initial filtering direction as F. i-2 The original filtered value of each pixel in the defect region in the (i-1)th initial filtering direction is denoted as F. i-1 And so on.
[0126] In this example, the filter response value Filter of each pixel in the defect region in the i-th initial filtering direction. i The following formula is used to calculate:
[0127] Filter i =m1F i-2 +m2F i-1 +m3F i +m4F i+1 +m5F i+2
[0128] Where m1, m2, m3, m4, and m5 can be weights determined according to any rules. For example, in one possible embodiment, m1 = m2 = m3 = m4 = m5 = 0.2. In another possible embodiment, they can also be calculated according to the following formula:
[0129]
[0130] Wherein, σ represents the influence of the surrounding initial filtering directions on the filtering response value of the i-th initial filtering direction. The smaller σ is, the smaller its influence; the larger σ is, the greater its influence. This σ can be a fixed value set by those skilled in the art based on experience, or it can be set according to the noise level of the sample to be detected. When the noise level of the sample to be detected is high, σ can be set larger; conversely, when the noise level of the sample to be detected is low, σ can be set smaller.
[0131] It is understandable that the direction of noise signals has a certain degree of randomness. Therefore, by selecting this embodiment, the influence of noise signals can be reduced or even eliminated by statistically analyzing the original filter values in multiple different initial filter directions, thereby improving the accuracy of the obtained filter response values. This allows the trained target filter to detect the sample to be tested more accurately.
[0132] The filter response value of each pixel in the defect region in the initial filtering direction can refer to the sum of the filter response values of all pixels in the defect region in the initial filtering direction, or it can refer to the sum of the filter response values of some pixels in the defect region in the initial filtering direction.
[0133] For example, in one possible embodiment, the filter response value of each pixel in the defect region in the initial filtering direction refers to the filter response value of the pixel in the defect region with the initial filtering direction as the pixel filtering direction in the initial filtering direction. In this example, for any pixel, if the filter response value of the pixel in an initial filtering direction is greater than a second preset threshold, then the initial filtering direction is the pixel filtering direction of the pixel.
[0134] The second preset threshold can be a value set according to requirements or the experience of those skilled in the art, or it can be the value of the filter response value in a preset ranking order after sorting the filter response values from smallest to largest, or it can be a value calculated based on the filter response values in the ranking order. For example, in one possible embodiment, the filter response value in the second order can be used as the second preset threshold; in another possible embodiment, 80% of the filter response value in the first order can be used as the second preset threshold. The present invention is not limited in this respect.
[0135] In this example, S201 can be implemented as follows:
[0136] S2011, for each pixel in the defective region, determine the pixel filtering direction of that pixel in each initial filtering direction.
[0137] S2012, for each initial filtering direction, superimpose the filter response values of all pixels whose pixel filtering direction is the initial filtering direction to obtain the superimposed filter value of the initial filtering direction.
[0138] For example, suppose the defect region has a total of 3 pixels, denoted as pixels 1-3, and there are 3 initial filtering directions, denoted as initial filtering directions 1-3. Pixel 1 uses initial filtering directions 1 and 2 as its filtering direction, pixel 2 uses initial filtering directions 2 and 3 as its filtering direction, and pixel 3 uses initial filtering directions 3 and 1 as its filtering direction. The filtering response value of pixel 1 in initial filtering direction 1 is F. 11 The filter response value of pixel 1 in the initial filter direction 2 is F. 12 The filter response value of pixel 2 in the initial filter direction 2 is F. 22 The filter response value of pixel 2 in the initial filter direction 3 is F. 23 The filter response value of pixel 3 in the initial filter direction 3 is F. 33 The filter response value of pixel 3 in the initial filter direction 1 is F. 31 Then the superposition filter value of the initial filter direction 1 is F 11 +F 31 The initial filter direction 2 superposition filter value is F 12 +F 22 The initial filter direction 3 has a superposition filter value of F. 23 +F 33 .
[0139] In this embodiment, since the filter response value of each pixel in its own pixel filtering direction is greater than the second preset threshold, it is assumed that the defect of the pixel should be distributed in the pixel filtering direction. Furthermore, it is assumed that the filter response value of the pixel in directions other than the pixel filtering direction is not caused by the defect. When determining the first filtering direction, only the filter response value of each pixel in its own pixel filtering direction is considered, thereby avoiding the influence of non-defect-caused filter response values on the first filtering direction. This allows the determined first filtering direction to more accurately reflect the distribution of defects in each direction within the defect area, thereby improving the accuracy of the trained target filter.
[0140] In step S202, the initial filtering direction of the initial filter is adjusted to the first filtering direction to obtain the target filter. It can be understood that if the filter response value of each pixel in the defect region is greater than a first preset threshold in the first filtering direction, it indicates that the defects in the marked sample are larger and more pronounced in these directions. Furthermore, the test sample, made of the same or similar material as the marked sample, is also more likely to exhibit significant defects in these first filtering directions. Therefore, the first filtering direction not only reflects the direction of the defect region within the marked sample but also the direction in which the defects are more pronounced.
[0141] Understandably, the determined first filtering direction is derived from the initial filtering directions. However, since the direction of the true defect distribution within the labeled sample cannot be predicted when setting the initial filtering direction, the direction of the true defect distribution within the labeled sample may differ significantly from any initial filtering direction. Therefore, the determined first filtering direction will have a large discrepancy with the direction of the true defect distribution within the labeled sample, meaning it cannot accurately reflect the direction of the true defect distribution within the labeled sample, resulting in an inaccurate target filter after training. Furthermore, setting too many initial filtering directions will lead to low efficiency in determining the first filtering direction.
[0142] Based on this, in one possible embodiment, such as Figure 4 As shown, in Figure 2 In addition to the embodiments shown, the following are also included:
[0143] S203: Select multiple filtering directions from the neighborhood of the first filtering direction as the updated filtering directions.
[0144] The neighborhood of the first filtering direction refers to the set of all directions whose difference from the first filtering direction is less than a preset angle difference. The preset angle difference may vary depending on the application scenario, but it should be as close as possible to the difference between the first filtering direction and the adjacent initial filtering direction.
[0145] For example, suppose there are a total of 6 initial filtering directions, namely 0°, 30°, 60°, 90°, 120° and 150°, and 90° is the first filtering direction. Since the difference between 90° and the adjacent initial filtering directions, namely 60° and 120°, is 30°, the preset angle difference should be no less than 30° as much as possible.
[0146] The number of selected update filtering directions can vary depending on the application scenario. It can be that multiple update filtering directions are selected at equal intervals in the neighborhood of the first filtering direction, or multiple update filtering directions are selected from the neighborhood of the first filtering direction according to the rule of random seed point distribution.
[0147] S204, the defect region in the marked sample is filtered and detected in each update filtering direction through the initial filter to obtain the updated defect result.
[0148] The only difference between the updated defect detection results and the aforementioned initial defect detection results is the filtering direction. Therefore, for information on the updated defect results, please refer to the relevant explanation of the aforementioned initial defect detection results, which will not be repeated here.
[0149] S205, until the preset loop termination condition is met, use the updated filtering direction as the new initial filtering direction, update the defect detection result as the new initial defect detection result, and return to execute S201.
[0150] The preset loop termination condition can vary depending on the application scenario. For example, in one possible embodiment, it could be that the number of times S201 is executed reaches a preset threshold, which could be 2 times, 3 times, or more. In another possible embodiment, the preset loop termination condition could be that the accuracy of the determined first filtering direction reaches a preset accuracy threshold, where the accuracy of the first filtering direction refers to the interval between each initial filtering direction when the first filtering direction is determined.
[0151] By using this embodiment, based on the determined first filtering direction, a new initial filtering direction can be reselected within the neighborhood of the first filtering direction, and a new first filtering direction can be determined from the new initial filtering direction, thereby improving the accuracy of the determined first filtering direction. Furthermore, since each time the first filtering direction is re-determined, only a new initial filtering direction needs to be selected from the neighborhood of the previously determined first filtering direction, and the first filtering direction is one or more of the initial filtering directions, the neighborhood of the first filtering direction is a proper subset of the range of values for the initial filtering direction. Therefore, using this embodiment can also narrow the range of initial filtering directions to be selected, effectively reducing the number of initial filtering directions that need to be selected. In other words, using this embodiment can improve both the accuracy and efficiency of determining the first filtering direction.
[0152] As shown in the formula for the initial filter above, the parameters affecting the filter include not only the filtering direction but also the weights of each filtering direction. For the target filter, the filtering direction is the first filtering direction. In one possible embodiment, the same first weight can be set for each first filtering direction. In another possible embodiment, the first weight of each first filtering direction is positively correlated with the superimposed filtering value of the first filtering directions.
[0153] For example, suppose there are three first filtering directions, denoted as first filtering directions 1-3. The superimposed filtering value of first filtering direction 1 is max, the superimposed filtering value of first filtering direction 2 is 0.8max, and the superimposed filtering value of first filtering direction 3 is 0.9max. Then the first weight of first filtering direction 1 is max / (max+0.8max+0.9max) = 0.37, the first weight of first filtering direction 2 is 0.8max / (max+0.8max+0.9max) = 0.30, and the first weight of first filtering direction 3 is max / (max+0.8max+0.9max) = 0.33.
[0154] It is understandable that the larger the superimposed filter value of the first filtering direction, the greater the probability that the distribution direction of the defect in the marked sample is in that first filtering direction. Therefore, the filter value in that first filtering direction in the defect detection result can better reflect the defects present in the sample to be detected, and thus a larger first weight needs to be assigned to that first filtering direction. It is evident that using this embodiment can reasonably set the first weight according to the superimposed filter value of each first filtering direction, thereby improving the efficiency of determining the first filtering direction.
[0155] By using this embodiment, the direction in which the sample to be detected is most likely to have a defect is determined by the filtering response value of the pixels in the defect area in each initial filtering direction, i.e., the first filtering direction. Then, the initial filtering direction is adjusted to the first filtering direction, so that the subsequent target filter can filter and detect the sample to be detected in the first filtering direction, thereby obtaining accurate defect detection results and improving the accuracy of defect detection.
[0156] In one possible embodiment, the target filter is obtained by adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with defective regions, and adjusting the initial weights corresponding to the initial filtering directions of the initial filter based on the detection results of the non-defective regions in the initial defect detection results of the marked samples with non-defective regions.
[0157] Adjusting the initial filtering direction of the initial filter based on the detection results of defective regions aligns it with the distribution of defective regions within the sample to be detected, thereby improving the accuracy of subsequent target filters in detecting the sample. Conversely, adjusting the initial weights corresponding to the initial filtering direction based on the detection results of non-defective regions is beneficial. It's understood that the filter response values in non-defective regions should be relatively small. Adjusting the initial weights ensures that the initial weights corresponding to the initial filtering direction of non-defective regions within the marked sample are smaller, thus preventing false detections caused by large filter response values for textures or other process marks in non-defective regions. This adjustment of initial weights also allows the resulting target filter to suppress non-defect interference such as rough backgrounds and textures in specific directions, further improving defect detection accuracy. Therefore, this embodiment allows for higher accuracy in defect detection with the trained target filter.
[0158] In the defect detection process of samples under test, related technologies typically rely on the continuous spatial regions formed by grayscale anomalies caused by defects, treating these regions as defects. However, due to the material processing and imaging characteristics of the samples under test, there may be regions distributed in one or several fixed directions that resemble the aforementioned defects. These regions are not considered defects in actual material applications, and the defect detection methods in related technologies will identify these regions as defects, leading to false detections. Based on this, the present invention also provides a surface defect detection method, such as... Figure 5 As shown, the method includes:
[0159] S501, Obtain the sample to be tested.
[0160] S502, the sample to be tested is input into the target filter for filtering and detection to obtain the defect detection result.
[0161] The target filter is a filter obtained by adjusting the initial weights corresponding to each initial filtering direction of the initial filter based on the detection results of the non-defect regions in the initial defect detection results of the marked samples with marked non-defect regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting the marked samples in each initial filtering direction.
[0162] In S501, the sample to be tested can be obtained by the execution entity through interaction with the user in response to the user selecting or uploading the sample to be tested, or it can be obtained from the sample library that needs to be defect-detected.
[0163] In S502, the initial filtering direction of the initial filter can be multiple, and the number can vary depending on the application scenario. For example, the initial filtering direction of the initial filter can be 2, 3, 4 or more.
[0164] The range of values for each initial filtering direction can be (0°, 360°). Considering that if the angle between two initial filtering directions is an integer multiple of 180°, then the two initial filtering directions are essentially the same filtering direction, in one possible embodiment, the range of values for the initial filtering direction is (0°, 180°).
[0165] The initial filtering directions of the initial filter can be uniformly distributed at equal angular intervals. For example, taking six initial filtering directions as an example, these six initial filtering directions can be 0°, 30°, 60°, 90°, 120°, and 150° respectively. Furthermore, each initial filtering direction can be randomly distributed using seed points, or it can be distributed based on other rule-based angular distribution methods. Correspondingly, the initial weights corresponding to each initial filtering direction in the initial filter can be the same or randomly distributed; this invention does not limit this. In this paper, the weight of a filtering direction refers to the degree of influence of the response value of that filtering direction on the defect detection result.
[0166] In one possible embodiment, the initial weights corresponding to each initial filtering direction are of the same value. By setting the initial weights corresponding to each initial filtering direction to the same value in the initial filter, filtering and detection of different directions of the labeled sample can be performed without difference. This allows the obtained initial defect detection results to reflect the unweighted filtering response values in each initial filtering direction, so that the initial weights can be adjusted subsequently based on the initial defect detection results.
[0167] As an example, the initial filter of this invention can be expressed by the following formula:
[0168]
[0169] Where F is the expression for the initial filter, and f(·) represents any filter kernel function with adjustable initial filter direction, such as the Gabor function. θ i For the i-th initial filtering direction, ω i Let be the initial weights for the i-th initial filtering direction, and n be the number of initial filtering directions.
[0170] Understandably, the labeled samples should be made of the same or similar material as the samples to be detected, so that the initial filter, after being trained on the labeled samples, can subsequently produce a target filter capable of accurately detecting defects in the samples to be detected made of the same or similar material as the labeled samples. The initial filter's defect detection of the labeled samples can be achieved by the user interacting with the execution entity to select one or more labeled samples with non-defect areas. The execution entity then inputs these labeled samples with non-defect areas into the initial filter for defect detection.
[0171] The process of detecting defects in marked samples with non-defect regions using an initial filter is to filter the marked sample in the initial filtering direction and then sum the filter response values in each initial filtering direction according to the initial weights to obtain the initial defect detection result.
[0172] The initial defect detection result obtained by performing defect detection on the entire marked sample using an initial filter necessarily includes the detection results of the marked non-defect regions in the marked sample. Since the non-defect regions in the marked sample are clearly marked, the detection results of the non-defect regions in the initial defect detection result can be determined based on the markings. Furthermore, since the marked non-defect regions are marked, the detection results of the initial filter on the non-defect regions can be verified based on the marked non-defect regions. As an example, the filter response value in the initial defect detection result should be inversely proportional to the non-defect region of the marked sample; therefore, the filter response value in the detection result of the non-defect region should be small or zero. Based on this, the detection results of the non-defect regions are verified, and then the initial weights corresponding to the initial filter direction are adjusted according to the verification results, so that the weights of the directions corresponding to the non-defect regions are smaller. This results in the target filter obtaining a smaller filter response value when detecting the non-defect regions of the sample to be detected, thereby obtaining an accurate defect detection result. Specifically, by adjusting the initial weights of the above initial filter expression, a target filter with different weights in different filtering directions can be obtained. That is, by using the target filter to filter the sample to be detected, non-defect regions in the sample to be detected that have gradient distributions in directions similar to the filter kernel will produce smaller filter response values, thereby reducing the possibility of incorrectly identifying non-defect regions as defect regions.
[0173] The sample to be tested is input into the target filter. The target filter detects the sample through a set of filter kernel functions with different filtering directions and weights. The filter response values of each filtering direction are weighted and superimposed to obtain the defect detection result of the sample.
[0174] In this embodiment, a pre-trained target filter is used to detect the sample to be detected, and a defect detection result is obtained. The target filter is obtained by adjusting the initial weights corresponding to the initial filtering direction based on the initial defect detection result of the initial filter. The initial defect detection result is obtained by filtering the marked sample in each initial filtering direction before the initial filtering. Since the non-defect areas are marked in the marked sample, the initial defect detection result can be obtained by verifying the initial filter's defect detection of the marked sample based on the marked non-defect areas. Furthermore, this scheme can enable the trained target filter to adapt to different materials through the input marked samples, and does not require surface defect detection of a specific material. Therefore, it can meet the surface defect detection needs of different scenarios, thus providing a widely applicable surface defect detection method.
[0175] Furthermore, this invention adjusts the initial weights of the initial filter in each initial filtering direction based on the detection results of the non-defect region. It is understood that the filter response value in the detection results of the non-defect region should be relatively small. By adjusting the initial weights, the initial weights corresponding to the initial filtering directions of the non-defect region in the marked sample can be made smaller. This avoids false detections of defects caused by the target filter obtaining large filter response values in the non-defect region due to textures or other process marks. By adjusting the initial weights, the obtained target filter has a suppressive effect on non-defect interference such as rough backgrounds and textures in specific directions, further improving the accuracy of defect detection.
[0176] To ensure accurate defect detection results for the sample under test, the filter response value of the target filter in the non-defect region of the sample should be minimized, thereby reducing the weights of the target filter along the filtering direction in the non-defect region. Based on this, the present invention provides a method for adjusting the initial weights, such as... Figure 6 As shown, the initial defect detection result includes the filter response values of each pixel in the non-defect region of the marked sample in each initial filter direction. The method includes:
[0177] S601, determine the first filtering direction based on the filtering response value of each pixel in the non-defect area in the initial filtering direction in the initial defect detection result.
[0178] S602, adjust the initial weight corresponding to the first filtering direction to the first weight based on the filtering response value of each pixel in the non-defect area in the first filtering direction.
[0179] As explained in the preceding description of S502, the initial filter's filtering detection process for the marked sample is the process of filtering in each initial filtering direction and obtaining the filtering response value. Therefore, the initial filtering detection result includes the filtering response value of each pixel of the marked sample in each initial filtering direction, and it must also include the filtering response value of each pixel of the non-defect area in each initial filtering direction.
[0180] In S601, the filter response value of each pixel in the non-defect area in the first filter direction is greater than the first preset threshold.
[0181] Each pixel in the non-defective region has a corresponding filter response value in each initial filtering direction. The initial filtering direction in which the filter response value of each pixel in the non-defective region is greater than a first preset threshold is taken as the first filtering direction. It can be understood that there can be one or more first filtering directions. For example, suppose there are four initial filtering directions, denoted as initial filtering directions 1-4. The filter response values of each pixel in the non-defective region in initial filtering directions 1-4 are 0, 20, 15, and 0, respectively. If the first preset threshold is 15, then the first filtering directions are initial filtering directions 2 and 3. If the first preset threshold is 16, then the first filtering direction is initial filtering direction 2.
[0182] The first preset threshold can be a value set manually based on needs or the experience of those skilled in the art, or it can be the value of the filter response value in a preset ranking order after sorting the filter response values from smallest to largest, or it can be a value calculated based on the filter response values in the preset ranking order. For example, in one possible embodiment, the filter response value in the second order can be used as the first preset threshold; in another possible embodiment, 80% of the filter response value in the first order can be used as the first preset threshold. The present invention is not limited in this respect.
[0183] For example, suppose the first preset threshold is 80% of the filter response value in the first order, and there are a total of 9 initial filtering directions, namely 0°, 20°, 40°, 60°..., 140°, 160°, and the filter response value of each pixel in the non-defect area in each initial filtering direction is as follows: Figure 3 As shown, the horizontal axis represents the initial filtering direction, and the vertical axis represents the filtering response value of each pixel in the initial filtering direction.
[0184] In this example, the pixel in the non-defect area has the largest filter response value at 120°, denoted as max. Therefore, the first preset threshold in this example is 0.8max. Figure 3As shown, since the filter response values of each pixel in the non-defect area are greater than 0.8max at 60°, 120°, and 140°, while the filter response values are less than 0.8max in other initial filter directions, 60°, 120°, and 140° are determined as the first filter directions in this example.
[0185] In S602, the first weight is negatively correlated with the filter response value of each pixel in the non-defect region in the first filter direction.
[0186] It is understandable that, since non-defective regions do not have defects, the filter response values corresponding to each pixel in the defect detection results should be small or zero. If the filter response values of each pixel in a non-defective region in the first filter direction are greater than a first preset threshold, it indicates that the filter response values of the non-defective region in these first filter directions are large, and it may be considered that the non-defective region has a defect in the first filter direction. However, these non-defective regions are actually clearly marked and have been determined to be defect-free. Therefore, it can be said that the marked sample has textures in the first filter direction of the non-defective region that may affect the filter response values. Similarly, the test sample, which is made of the same or similar material as the marked sample, is also likely to have textures in these first filter directions that affect the filter response values. Therefore, if accurate defect detection results are required for the test sample, the initial weights corresponding to these first filter directions need to be adjusted so that the filter response values of the obtained target filter in the first filter direction are smaller when filtering the test sample.
[0187] Therefore, the initial weights of the first filtering direction need to be adjusted based on the filter response values of each pixel in the non-defect region in the first filtering direction. The larger the filter response value of each pixel in the non-defect region in a certain first filtering direction, the more obvious the texture of the non-defect region in that first filtering direction. Therefore, the initial weight corresponding to this first filtering direction should be adjusted to be smaller to balance the unweighted filter response value obtained by the target filter in this first filtering direction. By weighting the unweighted filter response value with a smaller first weight, a smaller filter response value in the first filtering direction is obtained, thereby avoiding false detections of non-defect textures in the sample to be detected. Therefore, the first weight is negatively correlated with its corresponding filter response value in the first filtering direction in the initial defect detection result to obtain an appropriate first weight.
[0188] In this embodiment, the first weight is negatively correlated with the filter response value in the first filtering direction corresponding to the initial defect detection result, so that the target filter that adjusts the initial weight to the first weight in the subsequent process avoids false detection of non-defect textures in the sample to be detected, thereby further improving the accuracy of defect detection.
[0189] In the above scheme, the first weight is determined based on the filter response value of each pixel in the non-defect area in the first filter direction. However, in actual filter detection, noise and other factors may cause the filter response value of some pixels in certain filter directions to be too large or too small, resulting in inaccurate filter response values. Therefore, determining the first weight solely based on the filter response value of each pixel in the first filter direction may not yield a suitable weight. Based on this, the present invention also provides a method for adjusting the initial weight, such as... Figure 7 As shown, the method includes:
[0190] S701, determine the first filtering direction based on the filtering response value of each pixel in the non-defect area in the initial filtering direction in the initial defect detection result.
[0191] In S701, this step is the same as in S601. For details, please refer to the relevant description in S601. It will not be repeated here.
[0192] S702, for each first filtering direction, superimpose the filter response values of all pixels in the non-defect region in the first filtering direction to obtain the superimposed filter value in the first filtering direction.
[0193] S703, adjust the initial weights corresponding to the first filtering directions to the first weights based on the superimposed filtering values in each first filtering direction.
[0194] In S702, if the filter response value of each pixel in the non-defect region is greater than the first preset threshold in any initial filter direction, the initial filter direction can be used as the first filter direction. Since some first filter directions of multiple pixels in a non-defect region may be the same, the filter response values of all pixels in the non-defect region with the same first filter direction can be superimposed in the first filter direction to obtain the sum of the filter response values of all pixels in the non-defect region in each first filter direction, that is, the superimposed filter value.
[0195] For example, suppose there are 3 pixels in the non-defect region, denoted as pixels 1-3, and 4 initial filtering directions, denoted as initial filtering directions 1-4. Pixel 1 uses initial filtering directions 1 and 2 as its first filtering direction, pixel 2 uses initial filtering directions 2 and 3 as its first filtering direction, and pixel 3 uses initial filtering directions 3 and 1 as its first filtering direction. Therefore, there are three first filtering directions among the four initial filtering directions, denoted as first filtering directions 1-3, and the filtering response value of pixel 1 in the first filtering direction 1 is F. 11 The filtering response value of pixel 1 in the first filtering direction 2 is F 12 The filtering response value of pixel 2 in the first filtering direction 2 is F 22 The filtering response value of pixel 2 in the first filtering direction 3 is F23 The filtering response value of pixel 3 in the first filtering direction 3 is F 33 The filter response value of pixel 3 in the first filter direction 1 is F. 31 Then the superposition filter value of the first filter direction 1 is F 11 +F 31 The superposition filter value of the first filtering direction 2 is F 12 +F 22 The superposition filter value of the first filtering direction 3 is F 23 +F 33 .
[0196] In S703, the first weight corresponding to the first filtering direction is negatively correlated with the superimposed filter value in the first filtering direction.
[0197] Understandably, this step is similar to S602, except that the basis for adjusting the initial weights is different. For details, please refer to the relevant description in S602.
[0198] The superimposed filter value can reflect the filter response value of all pixels in the non-defect area in the first filter direction, thus reflecting the overall filtering performance of the non-defect area in the first filter direction, and is more representative. Furthermore, adjusting the initial weights based on this superimposed filter value can accommodate the impact of random factors, such as noise, on the adjustment of the initial weights, which may lead to inaccurate filter response values of some pixels in certain first filter directions.
[0199] By using this embodiment, the influence of random factors, such as noise, on the first weight can be avoided, so that the first weight can better balance the filtering response values of the texture in the non-defect area in each first filtering direction, thereby improving the accuracy of the trained target filter.
[0200] It is understandable that if the filter response value of each pixel in the non-defect region in the first filter direction is greater than the first preset value, it indicates that the initial weight corresponding to the first filter direction in the initial filter is not reasonable enough, resulting in an excessively large filter response value in the first filter direction, i.e., the initial weight corresponding to the first filter direction is too large. Therefore, the adjusted first weight corresponding to the first filter direction should be less than the initial weight corresponding to the first filter direction. Based on this, the present invention also provides an initial weight adjustment method, such as... Figure 8 As shown, the method includes:
[0201] S801, determine the first filtering direction based on the filtering response value of each pixel in the non-defect area in the initial filtering direction in the initial defect detection result.
[0202] In S801, this step is the same as in S601. For details, please refer to the relevant description of S601. It will not be repeated here.
[0203] S802, for each first filtering direction, superimpose the filter response values of all pixels in the non-defect region in the first filtering direction to obtain the superimposed filter value in the first filtering direction.
[0204] In S802, this step is the same as in S702. For details, please refer to the relevant description of S702. It will not be repeated here.
[0205] S803, obtain the quotient of the superimposed filter value and the area of the non-defect region in each first filtering direction, and obtain the weight difference corresponding to each first filtering direction.
[0206] S804, subtract the initial weight corresponding to each first filtering direction from the weight difference corresponding to each first filtering direction to obtain the first weight corresponding to each first filtering direction.
[0207] In S803, since non-defect regions have already been marked in the labeled samples, the execution entity can determine the area of the non-defect regions based on the markings. The superimposed filter values for each first filtering direction are different, resulting in different weight differences. It can be understood that the weight difference corresponding to each first filtering direction is proportional to its corresponding superimposed filter value. Since the area of the non-defect region is proportional to the number of pixels in the non-defect region, this weight difference, to some extent, reflects the average filter response value of each pixel within the non-defect region in the first filtering direction.
[0208] In S804, it can be understood that since the first weight corresponding to the first filtering direction is the difference between the initial weight corresponding to the first filtering direction and the weight difference corresponding to each first filtering direction, the first weight corresponding to each first filtering direction is less than its corresponding initial weight. Furthermore, the larger the weight difference corresponding to each first filtering direction, the smaller the first weight corresponding to each first filtering direction. Since the weight difference corresponding to each first filtering direction is proportional to its corresponding superimposed filter value, the larger the superimposed filter value corresponding to each first filtering direction, the smaller the first weight corresponding to each first filtering direction.
[0209] In this embodiment, the superimposed filter value in the first filtering direction is normalized by the area of the non-defect region to obtain a weight difference that is positively correlated with the superimposed filter value. Then, the initial weight is obtained by subtracting the weight difference from the initial weight. This provides a specific method for adjusting the initial weight, which can better balance the filter response values of the texture in the non-defect region in each first filtering direction, thereby improving the accuracy of the trained target filter.
[0210] See Figure 9 , Figure 9 This is a schematic diagram of a surface defect detection device provided in an embodiment of the present invention. The device includes:
[0211] Sample acquisition module 901 is used to acquire the sample to be tested;
[0212] The sample detection module 902 is used to input the sample to be detected into the target filter for filtering and detection, and to obtain the defect detection result.
[0213] The target filter is a filter obtained by adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with defective regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each of the initial filtering directions.
[0214] In one possible embodiment, the initial defect detection result includes the filter response values of each pixel in the defect region of the marked sample in each of the initial filter directions.
[0215] The device further includes: a first direction determination module, configured to adjust the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with marked defective regions in the following manner:
[0216] Based on the filter response value of each pixel in the defect region in the initial filter direction in the initial defect detection result, a first filter direction is determined, wherein the filter response value of each pixel in the defect region in the first filter direction is greater than a first preset threshold.
[0217] Adjust the initial filtering direction to the first filtering direction.
[0218] In one possible embodiment, the apparatus further includes: a filter response acquisition module, configured to obtain the filter response values of each pixel in the defect region in each of the initial filter directions by means of:
[0219] The initial filter is used to filter each pixel in the marked sample in each initial filtering direction to obtain the original filtered value of each pixel in the defect region in each initial filtering direction.
[0220] For each pixel in the defect region and each initial filtering direction, the original filtered value of the pixel in the initial filtering direction and the original filtered value of the pixel in the adjacent filtering direction are statistically analyzed to obtain the filtered response value of the pixel in the initial filtering direction. The adjacent filtering direction is other initial filtering directions that are adjacent to the initial filtering direction.
[0221] In one possible embodiment, the first direction determining module includes:
[0222] A threshold determination submodule is used to determine the pixel filtering direction of each pixel in the defect region in each of the initial filtering directions, wherein the filtering response value of the pixel in the pixel filtering direction is greater than a second preset threshold.
[0223] The superposition filtering determination submodule is used to superimpose the filter response values of all pixels with the initial filtering direction as the pixel filtering direction on the initial filtering direction for each initial filtering direction, so as to obtain the superposition filtering value of the initial filtering direction.
[0224] The first filtering determination submodule is used to determine the initial filtering direction when the superimposed filtering value is greater than a first preset threshold, and use it as the first filtering direction.
[0225] In one possible embodiment, the device further includes:
[0226] The update filtering module is used to select multiple filtering directions from the neighborhood of the first filtering direction as the update filtering directions;
[0227] The update detection module is used to perform filter detection on the defect region in the marked sample in each of the update filter directions through the initial filter to obtain the update defect detection result;
[0228] The return module is used to return to the execution of the step of determining the first filtering direction based on the filtering response value of each pixel in the defect region in the initial filtering direction in the initial filtering direction until the preset loop termination condition is met, taking the updated filtering direction as the new initial filtering direction and the updated defect detection result as the new initial defect detection result.
[0229] In one possible embodiment, the device further includes:
[0230] The weight determination module is used to determine a first weight for each of the first filtering directions, wherein the first weight is positively correlated with the superimposed filter value of the first filtering direction.
[0231] In one possible embodiment, the target filter is obtained by adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with defective regions, and adjusting the initial weights corresponding to the initial filtering directions of the initial filter based on the detection results of the non-defective regions in the initial defect detection results of the marked samples with non-defective regions.
[0232] See Figure 10 , Figure 10This is a schematic diagram of a surface defect detection device provided in an embodiment of the present invention. The device includes:
[0233] Module 1001 is used to acquire the sample to be detected;
[0234] The detection module 1002 is used to input the sample to be detected into the target filter for filtering and detection, and to obtain the defect detection result;
[0235] The target filter is an initial filter obtained by adjusting the initial weights corresponding to each initial filtering direction of the initial filter based on the detection results of the non-defect regions in the initial defect detection results of the marked samples with marked non-defect regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each of the initial filtering directions.
[0236] In one possible embodiment, the initial defect detection result includes the filter response value of each pixel in the non-defect region of the marked sample in each of the initial filter directions.
[0237] The device further includes: a first weight determination module, configured to adjust the initial weights corresponding to each initial filtering direction of the initial filter based on the detection results of the non-defect regions in the initial defect detection results of the marked samples with marked non-defect regions in the following manner:
[0238] Based on the filter response value of each pixel in the non-defect region in the initial defect detection result in the initial filter direction, a first filter direction is determined, wherein the filter response value of each pixel in the non-defect region in the first filter direction is greater than a first preset threshold.
[0239] The initial weight corresponding to the first filtering direction is adjusted to a first weight based on the filtering response value of each pixel in the non-defect region in the first filtering direction. The first weight is negatively correlated with the filtering response value of each pixel in the non-defect region in the first filtering direction.
[0240] In one possible embodiment, the first weight determination module includes:
[0241] The overlay submodule is used to overlay the filter response values of all pixels in the non-defect region in the first filter direction for each first filter direction, so as to obtain the overlay filter value in the first filter direction.
[0242] The first weighting submodule is used to adjust the initial weight corresponding to the first filtering direction to a first weight according to the superimposed filter value in each of the first filtering directions, wherein the first weight corresponding to the first filtering direction is negatively correlated with the superimposed filter value in the first filtering direction.
[0243] In one possible embodiment, the first weighting submodule includes:
[0244] The weight difference unit is used to obtain the quotient of the superimposed filter value and the area of the non-defect region in each of the first filtering directions, and to obtain the weight difference corresponding to each of the first filtering directions.
[0245] The first weighting unit is used to subtract the initial weight corresponding to each of the first filtering directions from the weight difference corresponding to each of the first filtering directions to obtain the first weight corresponding to each of the first filtering directions.
[0246] This invention also provides an electronic device, such as... Figure 11 As shown, it includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0247] Memory 113 is used to store computer programs;
[0248] When processor 111 executes a program stored in memory 113, it performs the following steps:
[0249] Obtain the sample to be tested;
[0250] The sample to be detected is input into a target filter for filtering and detection to obtain the defect detection result;
[0251] The target filter is a filter obtained by adjusting the initial filtering directions of the initial filter based on the detection results of the defective regions in the initial defect detection results of the marked samples with defective regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each of the initial filtering directions.
[0252] or
[0253] Obtain the sample to be tested;
[0254] The sample to be detected is input into a target filter for filtering and detection to obtain the defect detection result;
[0255] The target filter is an initial filter obtained by adjusting the initial weights corresponding to each initial filtering direction of the initial filter based on the detection results of the non-defect regions in the initial defect detection results of the marked samples with marked non-defect regions. The initial defect detection results are the defect detection results obtained by the initial filter filtering and detecting defects in the marked samples in each of the initial filtering directions.
[0256] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0257] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0258] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0259] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0260] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described surface defect detection methods.
[0261] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the surface defect detection methods described above.
[0262] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0263] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0264] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, and computer-readable storage media are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0265] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A surface defect detection method characterized by, The method comprises: acquiring a sample to be detected; inputting the sample to be detected into a target filter for filtering detection to obtain a defect detection result; wherein the target filter is a filter obtained by adjusting each initial filter direction of an initial filter according to a detection result of a defect region in an initial defect detection result of a marked sample marked with the defect region, and adjusting each initial weight corresponding to each initial filter direction of the initial filter according to a detection result of a non-defect region in an initial defect detection result of a marked sample marked with the non-defect region, the initial defect detection result being a defect detection result obtained by filtering detection of the marked sample in each initial filter direction by the initial filter.
2. The method of claim 1, wherein, The initial defect detection result comprises a filter response value of each pixel of the defect region in the marked sample in each initial filter direction, The adjusting of each initial filter direction of the initial filter according to the detection result of the defect region in the initial defect detection result of the marked sample marked with the defect region comprises: determining a first filter direction according to the filter response value of each pixel of the defect region in the initial filter direction in the initial defect detection result, the filter response value of each pixel of the defect region in the first filter direction being greater than a first preset threshold value; adjusting the initial filter direction to the first filter direction.
3. The method of claim 2, wherein, The filter response value of each pixel of the defect region in each initial filter direction is obtained by: filtering each pixel in the marked sample in each initial filter direction by the initial filter to obtain an original filter value of each pixel of the defect region in each initial filter direction; for each pixel of the defect region and each initial filter direction, statistically processing the original filter value of the pixel in the initial filter direction and the original filter value of the pixel in an adjacent filter direction to obtain the filter response value of the pixel in the initial filter direction, the adjacent filter direction being another initial filter direction adjacent to the initial filter direction.
4. The method of claim 2, wherein, The determining of the first filter direction according to the filter response value of each pixel of the defect region in the initial filter direction in the initial defect detection result comprises: for each pixel of the defect region, determining a pixel filter direction of the pixel in each initial filter direction, wherein the filter response value of the pixel in the pixel filter direction is greater than a second preset threshold value; for each initial filter direction, superimposing the filter response values of all pixels with the initial filter direction as the pixel filter direction in the initial filter direction to obtain a superimposed filter value of the initial filter direction; determining an initial filter direction with the superimposed filter value greater than the first preset threshold value as the first filter direction.
5. The method of claim 2, wherein, The method further comprises: selecting a plurality of filter directions from a neighborhood of the first filter direction as updated filter directions; obtaining an updated defect detection result by filtering detection of the defect region in the marked sample in each updated filter direction by the initial filter; until a preset cycle end condition is met, taking the updated filter direction as a new initial filter direction and the updated defect detection result as a new initial defect detection result, returning to execute the determining of the first filter direction according to the filter response values of each pixel in the defect region in the initial defect detection result in the initial filter direction.
6. The method of claim 4, wherein, The method further comprises: determining a first weight for each of the first filter directions, wherein the first weight is positively correlated with the superimposed filter value of the first filter direction.
7. A surface defect detection method characterized by, The method comprises: obtaining a sample to be detected; inputting the sample to be detected into a target filter for filter detection to obtain a defect detection result; wherein the target filter is a filter obtained by adjusting, by an initial filter, each initial weight corresponding to each initial filter direction of the initial filter according to a detection result of a non-defect region in an initial defect detection result of a marked sample marked with the non-defect region, and the initial defect detection result is a defect detection result obtained by performing filter detection on the marked sample in each initial filter direction by the initial filter.
8. The method of claim 7, wherein, The initial defect detection result comprises filter response values of each pixel in the non-defect region in each initial filter direction, adjusting, by the initial filter, each initial weight corresponding to each initial filter direction according to a detection result of a non-defect region in an initial defect detection result of a marked sample marked with the non-defect region, comprises: determining a first filter direction according to filter response values of each pixel in the non-defect region in the initial filter direction in the initial defect detection result, wherein the filter response values of each pixel in the non-defect region in the first filter direction are greater than a first preset threshold; adjusting an initial weight corresponding to the first filter direction to a first weight according to the filter response values of each pixel in the non-defect region in the first filter direction, wherein the first weight is negatively correlated with the filter response values of each pixel in the non-defect region in the first filter direction.
9. The method of claim 8, wherein, The adjusting of the initial weight corresponding to the first filter direction to the first weight according to the filter response values of each pixel in the non-defect region in the first filter direction comprises: superimposing the filter response values of all pixels in the non-defect region in the first filter direction to obtain a superimposed filter value of the first filter direction for each first filter direction; adjusting an initial weight corresponding to the first filter direction to a first weight according to the superimposed filter value in each first filter direction, wherein the first weight corresponding to the first filter direction is negatively correlated with the superimposed filter value in the first filter direction.
10. The method of claim 9, wherein, The adjusting of the initial weight corresponding to the first filter direction to the first weight according to the superimposed filter value in each first filter direction comprises: obtaining a quotient of the superimposed filter value in each first filter direction and an area of the non-defect region to obtain a weight difference corresponding to each first filter direction; The initial weight corresponding to each of the first filter directions is subtracted from the weight difference corresponding to each of the first filter directions to obtain a first weight corresponding to each of the first filter directions.
11. A surface defect detection apparatus characterized by comprising: The device comprises: a sample acquisition module configured to acquire a sample to be detected; a sample detection module configured to input the sample to be detected into a target filter for filter detection to obtain a defect detection result; The target filter is a filter obtained by adjusting each initial filter direction of an initial filter according to a detection result of a defect region in an initial defect detection result of a mark sample marked with the defect region, and adjusting each initial weight corresponding to each initial filter direction of the initial filter according to a detection result of a non-defect region in an initial defect detection result of a mark sample marked with the non-defect region, wherein the initial defect detection result is a defect detection result obtained by performing filter detection on each initial filter direction of the initial filter on the mark sample.
12. The apparatus of claim 11, wherein, The device further comprises a first direction determination module configured to adjust each initial filter direction of the initial filter according to the detection result of the defect region in the initial defect detection result of the mark sample marked with the defect region, by the following method, comprising: determining a first filter direction according to a filter response value of each pixel in the defect region in the initial filter direction in the initial defect detection result, wherein the filter response value of each pixel in the defect region in the first filter direction is greater than a first preset threshold value; adjusting the initial filter direction to the first filter direction; a filter response acquisition module configured to obtain the filter response value of each pixel in the defect region in each initial filter direction by the following method: performing filter detection on each pixel in the mark sample in each initial filter direction by the initial filter to obtain an original filter value of each pixel in the defect region in each initial filter direction; for each pixel in the defect region and each initial filter direction, performing statistics on the original filter value of the pixel in the initial filter direction and the original filter value of the pixel in an adjacent filter direction to obtain a filter response value of the pixel in the initial filter direction, wherein the adjacent filter direction is another initial filter direction adjacent to the initial filter direction; an update filter module configured to select a plurality of filter directions from a neighborhood of the first filter direction as update filter directions; an update detection module configured to perform filter detection on the defect region in the mark sample in each update filter direction by the initial filter to obtain an update defect detection result; a return module configured to return to perform the determination of the first filter direction according to the filter response value of each pixel in the defect region in the initial filter direction in the initial defect detection result until a preset loop end condition is met, wherein the update filter direction is used as a new initial filter direction, and the update defect detection result is used as a new initial defect detection result. The weight determination module is configured to determine a first weight of each of the first filter directions, wherein the first weight is positively correlated with a superimposed filter value of the first filter direction; The first direction determination module comprises: A threshold determination submodule is configured to determine, for each pixel of the defect area, a pixel filter direction of the pixel in each of the initial filter directions, wherein a filter response value of the pixel in the pixel filter direction is greater than a second preset threshold value; A superimposed filter determination submodule is configured to superimpose, for each initial filter direction, filter response values of all pixels with the initial filter direction as the pixel filter direction in the initial filter direction to obtain a superimposed filter value of the initial filter direction; A first filter determination submodule is configured to determine an initial filter direction with a superimposed filter value greater than a first preset threshold value as a first filter direction. The initial defect detection result includes filter response values of each pixel of the defect area in each of the initial filter directions in the mark sample with the defect area; and the target filter is obtained by adjusting each initial filter direction of an initial filter according to detection results of the defect area in an initial defect detection result of a mark sample with the defect area marked, and adjusting each initial weight corresponding to each initial filter direction of the initial filter according to detection results of the non-defect area in an initial defect detection result of a mark sample with the non-defect area marked.
13. A surface defect detection apparatus characterized by comprising: The device comprises: An acquisition module is configured to acquire a sample to be detected; A detection module is configured to input the sample to be detected into a target filter for filter detection to obtain a defect detection result. The target filter is obtained by adjusting each initial weight corresponding to each initial filter direction of an initial filter according to detection results of the non-defect area in an initial defect detection result of a mark sample with the non-defect area marked, and the initial defect detection result is a defect detection result obtained by performing filter detection on the mark sample in each of the initial filter directions by the initial filter.
14. The apparatus of claim 13, wherein, The device further comprises a first weight determination module configured to adjust each initial weight corresponding to each initial filter direction of the initial filter according to detection results of the non-defect area in an initial defect detection result of a mark sample with the non-defect area marked by the following method, comprising: determining a first filter direction according to filter response values of each pixel of the non-defect area in the initial filter direction in the initial defect detection result, wherein the filter response value of each pixel of the non-defect area in the first filter direction is greater than a first preset threshold value; adjusting an initial weight corresponding to the first filter direction to a first weight according to the filter response value of each pixel of the non-defect area in the first filter direction, wherein the first weight is negatively correlated with the filter response value of each pixel of the non-defect area in the first filter direction; The first weight determination module comprises: The superposition submodule is configured to superimpose the filtered response values of all pixels in the non-defect region in the first filter direction to obtain a superimposed filter value of the first filter direction; The first weight submodule is configured to adjust the initial weight corresponding to the first filter direction to a first weight according to the superimposed filter value in the first filter direction, and the first weight corresponding to the first filter direction is negatively correlated with the superimposed filter value in the first filter direction; The first weight submodule includes: The weight difference unit is configured to obtain a quotient of the superimposed filter value in each first filter direction and the area of the non-defect region to obtain a weight difference corresponding to each first filter direction; The first weight unit is configured to subtract the initial weight corresponding to each first filter direction from the weight difference corresponding to each first filter direction to obtain a first weight corresponding to each first filter direction. The initial defect detection result includes the filtered response values of each pixel in the non-defect region in the initial filter direction in the mark sample.
15. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps of any one of claims 1-6 or 7-10. The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps of any one of claims 1-6 or 7-10. 16. A computer-readable storage medium, characterized in that,
Citation Information
Patent Citations
Mura defect detection method and device
CN110728681A