A defect grayscale unified measurement method, system, device and storage medium

By converting the grayscale value of industrial images from grayscale space to tangent space, it solves the grayscale problem in the existing technology that cannot uniformly judge bright defects and dark defects, and achieves fast, accurate and unified measurement of defects in the industrial manufacturing process. .

CN118351119BActive Publication Date: 2024-09-24CHENGDU UNION BIG DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410785460.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-09-24
Estimated Expiration
2044-06-18

AI Technical Summary

Technical Problem

The existing technology cannot uniformly judge the grayscale of light defects and dark defects, resulting in the inability to calculate the same value in the grayscale space and the inability to achieve a unified measurement standard of defect grayscale.

Method used

By inputting the industrial image to be inspected into the target detection model for defect detection, the defect position coordinates are obtained, and grayscale detection is performed based on these coordinates to obtain the minimum grayscale value, maximum grayscale value and background average grayscale value, and the spatial conversion coefficient is used to convert These values ​​are converted from gray space to tangent space, allowing for a unified measurement of defect gray levels.

Benefits of technology

It achieves unified grayscale measurement of bright defects and dark defects, provides a fast and accurate method for threshold determination, and improves the accuracy of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118351119B
    Figure CN118351119B
Patent Text Reader

Abstract

The present invention provides a defect grayscale unified measurement method, system, device and storage medium, which relates to the field of defect detection technology. The method flow is: inputting an industrial image to be detected into a target detection model for defect detection to obtain defect position coordinates; performing defect grayscale detection based on the defect position coordinates to obtain a minimum grayscale value, a maximum grayscale value and an average grayscale value; converting the minimum grayscale value, the maximum grayscale value and the average grayscale value from the grayscale space to the tangent space based on a spatial conversion coefficient to obtain a minimum tangent value, a maximum tangent value and an average tangent value; unifying the defect grayscale based on the minimum tangent value, the maximum tangent value and the average tangent value to obtain a defect grayscale unified measurement result. The present invention constructs a spatial conversion coefficient based on the average grayscale value, and converts the minimum grayscale value and the maximum grayscale value from the grayscale space to the tangent space based on the spatial conversion coefficient, so as to unify the grayscale measurement standard.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of defect detection technology, and in particular to a defect grayscale unified measurement method, system, device and storage medium. Background Art

[0002] In the industrial manufacturing process, various product defects will occur due to factors such as manufacturing process fluctuations and machine differences, which seriously affect product quality. Therefore, a large amount of manpower is required to identify and classify product defects. With the development of industrial manufacturing, more and more electronic manufacturers have begun to use computer vision methods to detect product quality. In some industrial inspection processes, defects detected by the target detection model sometimes need to be filtered using CV post-processing, and the final filtering results need to be compared with the manually set threshold to determine whether the defects meet the detection criteria. However, at present, for the area detected by the target detection model, it is impossible to determine whether to use a larger grayscale or a smaller grayscale as the judgment standard, that is, when calculating bright (defect grayscale is greater than the background grayscale) and dark (defect grayscale is less than the background grayscale) defects in the grayscale space, it is impossible to make the two different degrees of defects calculate the same value, that is, it is impossible to unify the grayscale measurement standards for bright and dark defects. Summary of the invention

[0003] The present invention provides a defect grayscale unified measurement method, system, device and storage medium, which solves the problem that the prior art cannot unify the defect grayscale measurement standard.

[0004] In a first aspect, an embodiment of the present invention provides a method for uniformly measuring defect grayscales, and the method flow is as follows:

[0005] Input the industrial image to be inspected into the target detection model for defect detection to obtain the defect position coordinates;

[0006] Defect grayscale detection is performed based on the defect position coordinates to obtain the minimum grayscale value, maximum grayscale value of the defect and the average grayscale value of the background;

[0007] Obtaining spatial conversion coefficients of grayscale space and tangent space, and converting the minimum grayscale value, the maximum grayscale value, and the average grayscale value from the grayscale space to the tangent space based on the spatial conversion coefficients to obtain the minimum tangent value, the maximum tangent value, and the average tangent value;

[0008] The defect grayscale is unified based on the minimum tangent value, the maximum tangent value and the average tangent value to obtain a defect grayscale unified measurement result.

[0009] In the above embodiment, the present invention first constructs a spatial conversion coefficient based on the average grayscale value, and converts the minimum grayscale value and the maximum grayscale value from the grayscale space to the tangent space based on the spatial conversion coefficient, so as to unify the grayscale measurement standard, which is convenient for the subsequent rapid and accurate threshold determination of the unified measurement results of the defect grayscale.

[0010] As some optional implementation modes of the present application, before inputting the industrial image to be detected into the target detection model for defect detection, it is necessary to perform model training on the target detection model.

[0011] In the above embodiment, the present invention performs defect detection on the industrial image to be inspected based on deep learning technology, and can quickly obtain the defect type and defect location coordinates.

[0012] As some optional implementation methods of the present application, the process of training the target detection model is as follows:

[0013] Collect historical industrial images and annotate the defect types and locations of the historical industrial images to form a defect training set;

[0014] The historical industrial images in the defect training set are enhanced and input into the deep learning network model for iterative training to obtain the target detection model.

[0015] In the above embodiment, the present invention annotates and performs image enhancement processing on historical industrial images, so that the iteratively trained target detection model can accurately identify defects and output the defect location coordinates.

[0016] As some optional implementations of the present application, the process of image enhancement processing on the historical industrial images in the defect training set is as follows:

[0017] Perform forward Fourier transform on the historical industrial images in the defect training set to convert the historical industrial images from the time domain to the frequency domain;

[0018] The historical industrial images in the frequency domain are subjected to high-frequency filtering and inverse Fourier transform to convert the historical industrial images from the frequency domain to the time domain.

[0019] In the above embodiment, the present invention can enhance the saturation of the image by performing forward Fourier transform, high-frequency filtering and inverse Fourier transform on the historical industrial data, so as to facilitate the subsequent processing of a series of images.

[0020] As some optional implementations of the present application, the process of performing defect grayscale detection based on the defect position coordinates to obtain the minimum grayscale value, maximum grayscale value of the defect and the average grayscale value of the background is as follows:

[0021] Traverse the defect position coordinates to obtain the grayscale values ​​of all pixels of the defect, and perform grayscale verification on the grayscale values ​​of all pixels of the defect to obtain the minimum grayscale value and the maximum grayscale value of the defect;

[0022] A defect target frame is generated based on the defect position coordinates, and the grayscale values ​​of all pixels of the background are obtained radially outward based on the defect target frame, and the pixel values ​​of all pixels of the background are averaged to obtain the average grayscale value of the background.

[0023] In the above embodiment, the present invention obtains corresponding pixel values ​​radiating outward from the defect target frame and performs mean check on the pixel values, so as to obtain an average grayscale value that is very close to the background image, thereby making the subsequently obtained spatial conversion coefficient and defect grayscale unified measurement results more accurate.

[0024] As some optional implementations of the present application, the calculation formula of the space conversion coefficient is as follows:

[0025]

[0026] Among them, m represents the spatial conversion coefficient, and c represents the average gray value of the background.

[0027] In the above-mentioned embodiment, the present invention constructs a spatial conversion coefficient based on the average gray value, so that the subsequent defect grayscale unified measurement result is more accurate.

[0028] As some optional implementations of the present application, the calculation formulas for the minimum tangent value, the maximum tangent value and the average tangent value are as follows:

[0029] ; ;

[0030] Among them, A represents the minimum tangent value, B represents the maximum tangent value, C represents the average tangent value, a represents the minimum gray value of the defect, b represents the maximum gray value of the defect, and c represents the average gray value of the background.

[0031] In the above embodiment, the present invention multiplies the minimum grayscale value, the maximum grayscale value of the defect and the average grayscale value of the background by the space conversion parameter, that is, the background grayscale is approximated to π / 4. If the converted value is greater than π / 2, π / 2 is directly taken.

[0032] As some optional implementations of the present application, the process of unifying the defect grayscale based on the minimum tangent value, the maximum tangent value and the average tangent value to obtain the defect grayscale unified measurement result is as follows:

[0033] Calculate the minimum tangent value and the ratio of the maximum tangent value to the average tangent value to obtain a first tangent ratio A / C and a second defect ratio B / C;

[0034] The first tangent ratio A / C and the second defect ratio B / C are numerically compared, and the data with the smaller value is used as the uniform measurement result of the defect grayscale.

[0035] In the above embodiment, the present invention uses tangent conversion to map the grayscale space from 0 to 255 to 0 to positive infinity, calculates the first tangent ratio A / C and the second defect ratio B / C (when the ratio is greater than 1, directly take the reciprocal), and selects the smaller one (the closer it is to 0, the more serious it is) as the final unified defect grayscale measurement result.

[0036] In a second aspect, the present invention provides a defect grayscale unified measurement system, the system comprising:

[0037] A target defect detection unit, wherein the target defect detection unit is used to input the industrial image to be detected into the target detection model for defect detection to obtain the defect position coordinates;

[0038] A defect grayscale detection unit, wherein the defect grayscale detection unit performs defect grayscale detection based on the defect position coordinates to obtain a minimum grayscale value, a maximum grayscale value of the defect and an average grayscale value of the background;

[0039] A tangent space conversion unit, the tangent space conversion unit is used to obtain a space conversion coefficient between a grayscale space and a tangent space, and based on the space conversion coefficient, convert the minimum grayscale value, the maximum grayscale value and the average grayscale value from the grayscale space to the tangent space to obtain a minimum tangent value, a maximum tangent value and an average tangent value;

[0040] The defect grayscale unification unit unifies the defect grayscale based on the minimum tangent value, the maximum tangent value and the average tangent value to obtain a defect grayscale unification measurement result.

[0041] In a third aspect, the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the unified defect grayscale measurement method when executing the computer program.

[0042] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for uniformly measuring defect grayscale is implemented.

[0043] The beneficial effects of the present invention are as follows:

[0044] 1. The present invention first constructs a spatial conversion coefficient based on the average grayscale value, and converts the minimum grayscale value and the maximum grayscale value from the grayscale space to the tangent space based on the spatial conversion coefficient, so as to unify the grayscale measurement standard, which is convenient for the subsequent rapid and accurate threshold determination of the unified measurement results of the defect grayscale.

[0045] 2. The present invention obtains corresponding pixel values ​​radiating outward from the defect target frame and performs mean check on the pixel values, so as to obtain an average grayscale value that is very close to the background image, so that the subsequently obtained spatial conversion coefficient and defect grayscale unified measurement results are more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0047] Figure 1 is a schematic diagram of the computer device structure of the hardware operating environment described in the embodiment of the present invention;

[0048] Figure 2 is a flow chart of a method for uniformly measuring defect grayscale according to an embodiment of the present invention;

[0049] Figure 3 It is a structural block diagram of the defect grayscale unified measurement system described in an embodiment of the present invention. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0051] In order to solve the problem that the prior art cannot determine whether to use a larger grayscale or a smaller grayscale as the judgment standard, that is, it is impossible to unify the defect grayscale measurement standard. This application provides a defect grayscale unified measurement method, system, device and storage medium. Before introducing the specific technical solution of this application, the hardware operating environment involved in the embodiment of this application is first introduced.

[0052] See also Figure 1 , Figure 1 A schematic diagram of the computer device structure of the hardware operating environment involved in the embodiments of the present application.

[0053] like Figure 1As shown, the computer device may include: a processor, such as a central processing unit (CPU), a communication bus, a user interface, a network interface, and a memory. Among them, the communication bus is used to realize the connection and communication between these components. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), and optionally, the user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity interface). The memory may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory may optionally be a storage device independent of the aforementioned processor.

[0054] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0055] like Figure 1 As shown, the memory as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module and an electronic program module.

[0056] exist Figure 1 In the computer device shown, the network interface is mainly used for data communication with the network server; the user interface is mainly used for data interaction with the user; the processor and memory in the computer device of the present application can be set in the computer device, and the computer device calls the defect grayscale unified measurement system stored in the electronic program module through the processor, and executes the defect grayscale unified measurement method provided by the present application.

[0057] Based on the hardware environment of the aforementioned embodiment, this application provides a unified defect grayscale measurement method, please refer to Figure 2 , Figure 2 The flowchart of the defect grayscale unified measurement method is as follows:

[0058] (1) The industrial image to be inspected is input into the target detection model for defect detection to obtain the defect location coordinates.

[0059] In an embodiment of the present invention, before inputting the industrial image to be detected into the target detection model for defect detection, it is necessary to perform model training on the target detection model.

[0060] In an embodiment of the present invention, the process of training the target detection model is as follows:

[0061] (1.1) Collect historical industrial images and annotate the defect types and locations of the historical industrial images to form a defect training set.

[0062] (1.2) Perform image enhancement processing on the historical industrial images in the defect training set and input them into the deep learning network model for iterative training to obtain the target detection model.

[0063] In an embodiment of the present invention, the present invention performs defect detection on the industrial image to be inspected based on deep learning technology, and can quickly obtain the defect type and defect location coordinates.

[0064] Specifically, the process of image enhancement processing for the historical industrial images in the defect training set is as follows:

[0065] (1.21) Perform forward Fourier transform on the historical industrial images in the defect training set to convert the historical industrial images from the time domain to the frequency domain.

[0066] (1.22) Perform high-frequency filtering and inverse Fourier transform on the historical industrial images in the frequency domain to convert the historical industrial images from the frequency domain to the time domain.

[0067] In an embodiment of the present invention, the present invention can enhance the saturation of an image by performing forward Fourier transform, high-frequency filtering, and inverse Fourier transform on historical industrial data, thereby facilitating subsequent processing of a series of images.

[0068] (2) Perform defect grayscale detection based on the defect position coordinates to obtain the minimum grayscale value, maximum grayscale value corresponding to the defect, and the average grayscale value corresponding to the background.

[0069] In an embodiment of the present invention, the process of obtaining the minimum grayscale value, the maximum grayscale value of the defect and the average grayscale value of the background is as follows:

[0070] (2.1) Traverse the defect position coordinates to obtain the grayscale values ​​of all pixels of the defect, and perform grayscale verification on the grayscale values ​​of all pixels of the defect to obtain the minimum grayscale value and the maximum grayscale value of the defect.

[0071] Specifically, the process of obtaining the minimum grayscale value and the maximum grayscale value of the defect is as follows:

[0072] (2.11) The defect position coordinates are divided into regions according to a fixed pixel specification to obtain a number of minimum regional pixel sets, wherein the fixed pixel specification can be a preset value or can be dynamically set according to the defect size.

[0073] (2.12) Obtain the total grayscale value of all minimum area pixel sets, and select the minimum total grayscale value and the maximum total grayscale value therefrom, and use the minimum total grayscale value as the minimum grayscale value of the defect, and use the maximum total grayscale value as the maximum grayscale value of the defect.

[0074] (2.2) Generate a defect target frame based on the defect position coordinates, and obtain the grayscale values ​​of all pixels of the background radially outward based on the defect target frame, and perform a mean check on the pixel values ​​of all pixels of the background to obtain the average grayscale value of the background.

[0075] Specifically, the process of obtaining the grayscale values ​​of all pixels of the background radially outward based on the defect target frame is as follows:

[0076] (2.21) The defect target frame is radiated outward in a certain step to obtain a first-level check frame, a second-level check frame, ..., an N-level check frame;

[0077] (2.22) Obtain the grayscale values ​​of all pixels between the first-level check box and the defect target box to obtain the first-level background grayscale value. Similarly, obtain the grayscale values ​​of all pixels between the second-level check box and the first-level check box to obtain the second-level background grayscale value. And so on, N levels of background grayscale values ​​can be obtained.

[0078] Specifically, the process of performing mean check on the pixel values ​​of all pixels of the background to obtain the average grayscale value of the background is as follows:

[0079] (2.23) Divide the primary background grayscale value, the secondary background grayscale value, ..., the N-level background grayscale value by the number of corresponding pixels to obtain the primary average grayscale value, the secondary average grayscale value, ..., the N-level average grayscale value;

[0080] (2.24) Multiply the first-level average grayscale value, the second-level average grayscale value, ..., the N-level average grayscale value by the corresponding confidence value and then add them together to obtain the average grayscale value of the final background; wherein the confidence values ​​corresponding to the first-level average grayscale value, the second-level average grayscale value, ..., the N-level average grayscale value can be preset values ​​or dynamically set according to the defect background law.

[0081] In an embodiment of the present invention, the present invention obtains corresponding pixel values ​​radiating outward from the defect target frame and performs mean check on the pixel values, so as to obtain an average grayscale value that is very close to the background image, so that the subsequently obtained spatial conversion coefficient and the unified measurement result of the defect grayscale are more accurate.

[0082] (3) Obtaining spatial conversion coefficients of grayscale space and tangent space, and converting the minimum grayscale value, the maximum grayscale value, and the average grayscale value from the grayscale space to the tangent space based on the spatial conversion coefficients to obtain the minimum tangent value, the maximum tangent value, and the average tangent value.

[0083] In the embodiment of the present invention, the calculation formula of the space conversion coefficient is as follows:

[0084]

[0085] Among them, m represents the spatial conversion coefficient, and c represents the average gray value of the background.

[0086] In the embodiment of the present invention, the present invention constructs a spatial conversion coefficient based on the average grayscale value, so that the subsequent defect grayscale unified measurement result is more accurate.

[0087] Specifically, the calculation formulas for the minimum tangent value, the maximum tangent value and the average tangent value are as follows:

[0088] ; ;

[0089] Among them, A represents the minimum tangent value, B represents the maximum tangent value, C represents the average tangent value, a represents the minimum gray value of the defect, b represents the maximum gray value of the defect, and c represents the average gray value of the background.

[0090] In an embodiment of the present invention, the present invention multiplies the minimum grayscale value, the maximum grayscale value of the defect and the average grayscale value of the background by the spatial conversion parameter, that is, the background grayscale is approached to π / 4. If the converted value is greater than π / 2, π / 2 is directly taken.

[0091] (4) Defect grayscale is unified based on the minimum tangent value, the maximum tangent value, and the average tangent value to obtain a unified defect grayscale measurement result.

[0092] In an embodiment of the present invention, the process of obtaining the uniform measurement result of defect grayscale is as follows:

[0093] (4.1) Calculate the minimum tangent value and the ratio of the maximum tangent value to the average tangent value to obtain the first tangent ratio A / C and the second defect ratio B / C.

[0094] (4.2) The first tangent ratio A / C and the second defect ratio B / C are numerically compared, and the data with the smaller value is used as the uniform measurement result of the defect grayscale.

[0095] In an embodiment of the present invention, the present invention uses tangent conversion to map the grayscale space from 0 to 255 to 0 to positive infinity, calculates the first tangent ratio A / C and the second defect ratio B / C (when the ratio is greater than 1, the reciprocal is directly taken), and selects the smaller one (the closer it is to 0, the more serious it is) as the final unified defect grayscale measurement result.

[0096] In summary, the present invention first constructs a spatial conversion coefficient based on the average grayscale value, and converts the minimum grayscale value and the maximum grayscale value from the grayscale space to the tangent space based on the spatial conversion coefficient, so as to unify the grayscale measurement standard, which is convenient for the subsequent rapid and accurate threshold determination of the unified measurement results of the defect grayscale.

[0097] In addition, in one embodiment, based on the same inventive concept as the above embodiment, the embodiment of the present invention provides a defect grayscale unified measurement system, and the system corresponds to the method of embodiment 1 one by one, please refer to Figure 3 , Figure 3 The structural block diagram of the defect grayscale unified measurement system is shown in FIG. 1 , wherein the system includes:

[0098] A target defect detection unit, wherein the target defect detection unit is used to input the industrial image to be detected into the target detection model for defect detection to obtain the defect position coordinates;

[0099] A defect grayscale detection unit, wherein the defect grayscale detection unit performs defect grayscale detection based on the defect position coordinates to obtain a minimum grayscale value, a maximum grayscale value of the defect and an average grayscale value of the background;

[0100] A tangent space conversion unit, the tangent space conversion unit is used to obtain a space conversion coefficient between a grayscale space and a tangent space, and based on the space conversion coefficient, convert the minimum grayscale value, the maximum grayscale value and the average grayscale value from the grayscale space to the tangent space to obtain a minimum tangent value, a maximum tangent value and an average tangent value;

[0101] The defect grayscale unification unit unifies the defect grayscale based on the minimum tangent value, the maximum tangent value and the average tangent value to obtain a defect grayscale unification measurement result.

[0102] It should be noted that each unit in the defect grayscale unified measurement system in this embodiment corresponds one-to-one to each step in the defect grayscale unified measurement method in the aforementioned embodiment. Therefore, the specific implementation method and technical effects achieved by this embodiment can refer to the implementation method of the aforementioned defect grayscale unified measurement method, which will not be repeated here.

[0103] In addition, in one embodiment, the present application also provides a computer device, which includes a processor, a memory, and a computer program stored in the memory, and the computer program implements the method in the aforementioned embodiment when executed by the processor.

[0104] In addition, in one embodiment, the present application further provides a computer storage medium, on which a computer program is stored, and the computer program implements the method in the aforementioned embodiment when executed by a processor.

[0105] In some embodiments, the computer readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories. The computer may be various computing devices including intelligent terminals and servers.

[0106] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0107] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0108] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.

[0109] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0110] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0111] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a multimedia terminal device (which can be a mobile phone, a computer, a television receiver, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0112] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A defect grayscale unified measurement method, characterized in that: The method comprises the following steps: Input the industrial image to be inspected into the target detection model for defect detection to obtain the defect position coordinates; Defect grayscale detection is performed based on the defect position coordinates to obtain the minimum grayscale value, maximum grayscale value of the defect and the average grayscale value of the background; wherein the process of obtaining the minimum grayscale value, maximum grayscale value and the average grayscale value of the background is as follows: Traverse the defect position coordinates to obtain the grayscale values ​​of all pixels of the defect, and perform grayscale verification on the grayscale values ​​of all pixels of the defect to obtain the minimum grayscale value and the maximum grayscale value of the defect; Generate a defect target frame based on the defect position coordinates, and obtain the grayscale values ​​of all pixels of the background radially outward based on the defect target frame, and perform a mean check on the pixel values ​​of all pixels of the background to obtain the average grayscale value of the background; Obtain the spatial conversion coefficients of the grayscale space and the tangent space, and convert the minimum grayscale value, the maximum grayscale value, and the average grayscale value from the grayscale space to the tangent space based on the spatial conversion coefficient to obtain the minimum tangent value, the maximum tangent value, and the average tangent value; wherein the calculation formula of the spatial conversion coefficient is as follows: Among them, m represents the spatial conversion coefficient, and c represents the average gray value of the background; Defect grayscale unification is performed based on the minimum tangent value, the maximum tangent value, and the average tangent value to obtain a defect grayscale unification measurement result; The calculation formulas for the minimum tangent value, the maximum tangent value and the average tangent value are as follows: A=a×m; B=b×m; C=c×m Among them, A represents the minimum tangent value, B represents the maximum tangent value, C represents the average tangent value, a represents the minimum gray value of the defect, b represents the maximum gray value of the defect, and c represents the average gray value of the background.

2. A defect grayscale unified measurement method according to claim 1, characterized in that: Before inputting the industrial image to be detected into the target detection model for defect detection, the target detection model needs to be trained.

3. A defect grayscale unified measurement method according to claim 2, characterized in that: The process of model training for the target detection model is as follows: Collect historical industrial images and annotate the defect types and locations of the historical industrial images to form a defect training set; The historical industrial images in the defect training set are enhanced and input into the deep learning network model for iterative training to obtain the target detection model.

4. A defect grayscale unified measurement method according to claim 3, characterized in that: The process of image enhancement processing for historical industrial images in the defect training set is as follows: Perform forward Fourier transform on the historical industrial images in the defect training set to convert the historical industrial images from the time domain to the frequency domain; The historical industrial images in the frequency domain are subjected to high-frequency filtering and inverse Fourier transform to convert the historical industrial images from the frequency domain to the time domain.

5. A defect grayscale unified measurement method according to claim 1, characterized in that: The process of unifying the defect grayscale based on the minimum tangent value, the maximum tangent value, and the average tangent value to obtain the defect grayscale unified measurement result is as follows: Calculate the minimum tangent value and the ratio of the maximum tangent value to the average tangent value to obtain a first tangent ratio A / C and a second defect ratio B / C; The first tangent ratio A / C and the second defect ratio B / C are numerically compared, and the data with the smaller value is used as the uniform measurement result of the defect grayscale.

6. A defect grayscale unified measurement system, characterized in that: The system comprises: A target defect detection unit, wherein the target defect detection unit is used to input the industrial image to be detected into the target detection model for defect detection to obtain the defect position coordinates; A defect grayscale detection unit, wherein the defect grayscale detection unit performs defect grayscale detection based on the defect position coordinates to obtain the minimum grayscale value, the maximum grayscale value of the defect and the average grayscale value of the background; wherein the process of obtaining the minimum grayscale value, the maximum grayscale value and the average grayscale value of the background is as follows: Traverse the defect position coordinates to obtain the grayscale values ​​of all pixels of the defect, and perform grayscale verification on the grayscale values ​​of all pixels of the defect to obtain the minimum grayscale value and the maximum grayscale value of the defect; Generate a defect target frame based on the defect position coordinates, and obtain the grayscale values ​​of all pixels of the background radially outward based on the defect target frame, and perform a mean check on the pixel values ​​of all pixels of the background to obtain the average grayscale value of the background; A tangent space conversion unit, the tangent space conversion unit is used to obtain a space conversion coefficient between a grayscale space and a tangent space, and based on the space conversion coefficient, convert the minimum grayscale value, the maximum grayscale value and the average grayscale value from the grayscale space to the tangent space to obtain a minimum tangent value, a maximum tangent value and an average tangent value; wherein the calculation formula of the space conversion coefficient is as follows: Among them, m represents the spatial conversion coefficient, and c represents the average gray value of the background; The defect grayscale unification unit unifies the defect grayscale based on the minimum tangent value, the maximum tangent value and the average tangent value to obtain a defect grayscale unification measurement result; wherein the calculation formulas of the minimum tangent value, the maximum tangent value and the average tangent value are as follows: A=a×m; B=b×m; C=c×m Among them, A represents the minimum tangent value, B represents the maximum tangent value, C represents the average tangent value, a represents the minimum gray value of the defect, b represents the maximum gray value of the defect, and c represents the average gray value of the background.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for uniformly measuring defect grayscale described in any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for uniformly measuring defect grayscales described in any one of claims 1 to 5 is implemented.