Appearance defect detection method, device, electronic equipment and storage medium

By combining the encoding of the image to be detected and the image information of the defect sample, and using the neural network to find defect features in the image to be detected, the problem of complexity and low efficiency of appearance defect detection in the existing technology is solved, and efficient defect location identification is achieved. .

CN116777859BActive Publication Date: 2024-08-30BEIJING MICROCHAIN DAOAI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310703801.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-14
Publication Date
2024-08-30
Estimated Expiration
2043-06-14

AI Technical Summary

Technical Problem

Existing appearance defect detection methods are complex to operate and have low detection efficiency. They require deep learning model training and data annotation, and it is easy to segment images from other areas into defects.

Method used

By encoding the image information to be detected and combining it with the defect sample image information to generate fused image coding information, the neural network is used to find defect feature information in the image to be detected, without manual input of position prompt information or model training, and the defect location is directly displayed.

Benefits of technology

It simplifies the detection process, improves detection efficiency, reduces the need for model training and data annotation, and significantly improves detection accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116777859B
    Figure CN116777859B
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for appearance defect detection, which are applied to the field of image processing technology. By acquiring the image information to be detected, encoding the image information to be detected, and obtaining the image encoding information to be detected, the defect sample image encoding information is obtained, and the acquired image encoding information to be detected is superimposed with the defect sample image encoding information. After generating the fused image encoding information, it is input into a neural network for encoding and parsing, and the position information of the defect in the image information to be detected can be obtained. Without manually inputting the position prompt information, the model training and data annotation of the image cutting can be performed, and the position information of the defect in the image information to be detected can be conveniently obtained, thereby improving the detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an appearance defect detection method, device, electronic device and storage medium. Background Art

[0002] There are many kinds of appearance defects in various industries, such as inclusions, scratches, pressed oxide scale, cracks, pitting and plaque. At present, the method used in industry to identify the appearance of products in the manufacturing process is usually SAM (an image segmentation model based on deep learning). SAM encodes the image to be detected, fuses the prompt encoding information, generates the fused image encoding information, and then decodes it to obtain the image information that needs to be segmented (segmenting the defects). However, there is a problem when using SAM to detect defects, that is, SAM uses position prompt information, so that the entire network will predict some object areas near the coordinates of a point input by the user to achieve image segmentation. This segmentation method is prone to segmenting images in other areas into defects. In order to avoid this problem, it is necessary to train the model of SAM segmentation process and assist in manual or automatic annotation to improve the accuracy of SAM segmentation. The operation is very complicated and it takes time to train the model and annotate the data, and it is difficult to improve the detection efficiency.

[0003] Therefore, the existing appearance defect detection method has the problems of complex operation and low detection efficiency. Summary of the invention

[0004] In view of the above-mentioned deficiencies in the prior art, the present application provides an appearance defect detection method, device, electronic device and storage medium, which are applied to the field of image processing technology, and are used to encode the image information to be detected to obtain the image encoding information to be detected, and convert the image information into data information for transmission, so as to facilitate the computer to process and transmit the image; the image encoding information to be detected is superimposed with the defect sample image encoding information to generate fused image encoding information, so that the neural network model decodes the fused image encoding information, and finds the defect consistent with the defect sample image feature information in the defect sample image information from the image encoding information to be detected according to the defect sample image encoding information, and displays the position of the defect in a display image of the same size as the image information to be detected, so as to obtain the defect position information in the image information to be detected. The present application tells the neural network to search for the corresponding defect by inputting the defect sample image encoding information, and does not need to spend time training and labeling the image, and has the beneficial effects of simple operation and improved detection efficiency.

[0005] In a first aspect, the present application provides a method for detecting appearance defects, the method comprising the following steps:

[0006] Obtaining image information to be detected;

[0007] Encoding the image information to be detected to obtain the image encoding information to be detected;

[0008] Obtaining defect sample image coding information;

[0009] Superimposing the image coding information to be detected and the defect sample image coding information to obtain fused image coding information;

[0010] The fused image encoding information is decoded to obtain the defect position information in the image information to be detected.

[0011] Through the above-mentioned appearance defect detection method, the image information to be detected is obtained, the image information to be detected is encoded, and the image encoding information to be detected is obtained. At the same time, the defect sample image encoding information is obtained, and the image information is converted into encoding information for transmission, which is convenient for computer equipment to recognize and calculate. The obtained image encoding information to be detected and the defect sample image encoding information are matrix transformed to generate fused image encoding information, which is then input into the neural network for encoding analysis, and the defect sample image feature information in the defect sample image encoding information is used to tell the neural network to find defects in the image encoding information to be detected that are consistent with the defect sample image feature information in the defect sample image encoding information, and the position of the defect is displayed in a display image of the same size as the image information to be detected, so as to obtain the position information of the defect in the image information to be detected. There is no need to manually input the position prompt information, and the model training and data annotation of the image cutting are performed, so as to conveniently obtain the position information of the defect in the image information to be detected, thereby improving the detection efficiency.

[0012] Preferably, in the appearance defect detection method provided in the present application, the step of obtaining defect sample image encoding information includes:

[0013] Acquire type information of the image to be detected according to the information of the image to be detected;

[0014] Filter common defect information of the image to be inspected according to type information;

[0015] Obtain defect sample image coding information based on common defect information.

[0016] Through the above-mentioned appearance defect detection method, the type information of the image to be detected is obtained according to the image information to be detected, so as to obtain common defect information in the image information to be detected of the same type of information, thereby avoiding the user from searching for defect sample image information from a huge defect database, saving detection time, and encoding the common defect information to obtain the defect sample image coding information, wherein the common defect information may include multiple types, such as scratches, dents, cracks, etc. Correspondingly, the defect sample image coding information also includes multiple types, which facilitates more comprehensive defect screening of the image information to be detected and improves the accuracy of defect detection.

[0017] Preferably, the present application provides an appearance defect detection method, wherein the steps of decoding the fused image encoding information to obtain defect position information in the image information to be detected include:

[0018] Obtaining defect sample image feature information from fused image coding information;

[0019] Obtaining defect image coding information that matches the defect sample image feature information in the image coding information to be detected, wherein the defect image coding information includes position information of the defect image coding information in the image coding information to be detected;

[0020] The defect position information in the image information to be detected is obtained according to the defect image coding information.

[0021] By obtaining the defect sample image feature information in the fused image coding information, it is convenient for the neural network to search for defect image coding information that matches the defect sample image feature information in the image coding information to be detected. The defect image coding information includes the position information of the defect image coding information in the image coding information to be detected, so as to obtain the position information of the defect in the image information to be detected after decoding.

[0022] Preferably, the present application provides a method for detecting appearance defects, wherein the step of decoding the fused image encoding information to obtain defect position information in the image information to be detected further includes:

[0023] Obtain defect prompt coding information, which includes defect type information;

[0024] Classifying the fused image coding information according to the defect type information to obtain the marked fused image coding information marked with the defect type information;

[0025] The coded information of the marked fusion image is decoded to obtain the defect position information in the image information to be detected.

[0026] Through the above-mentioned appearance defect detection method, since the image information to be detected may contain more than one defect type information, such as the existence of two defect type information of dents and scratches in the image information to be detected, in order to output the defect positions corresponding to the defect type information respectively, the defect prompt coding information can be used to classify the fused image coding information to obtain marked fused image coding information with defect type information, such as obtaining marked fused coding information with dents. After decoding the marked fused image coding information, the position information of the dent in the image to be detected can be obtained, which is convenient for users to distinguish the defect types in the image information to be detected.

[0027] Preferably, the present application provides a method for detecting appearance defects, the method further comprising:

[0028] Acquire type information of the image to be detected according to the information of the image to be detected;

[0029] Acquire preset standard image information according to type information;

[0030] Comparing the preset standard image information with the image information to be detected, and generating a comparison result;

[0031] According to the comparison result, the defect position information in the image information to be detected is obtained.

[0032] Preferably, the present application provides a method for detecting appearance defects, wherein the steps of comparing preset standard image information with the image information to be detected and generating a comparison result include:

[0033] Acquire a first eigenvector in preset standard image information and a second eigenvector in the image information to be detected;

[0034] calculating a difference between the first eigenvector and the second eigenvector;

[0035] When the difference is greater than or equal to the preset difference, the generated comparison result is that there is a defect in the image information to be detected;

[0036] When the difference is smaller than the preset difference, the generated comparison result is that there is no defect in the image information to be detected.

[0037] Preferably, the present application provides a method for detecting appearance defects, wherein the step of obtaining defect position information in the image information to be detected according to the comparison result comprises:

[0038] According to the comparison results, the defects are marked;

[0039] According to the marked defect location, the defect location information in the image information to be detected is obtained.

[0040] In a second aspect, the present application provides an appearance defect detection device, the device comprising:

[0041] The first acquisition module is used to acquire the image information to be detected;

[0042] The second acquisition module is used to encode the image information to be detected to obtain the image encoding information to be detected;

[0043] The third acquisition module is used to obtain the defect sample image coding information;

[0044] Fusion module: used to superimpose the coding information of the image to be detected and the coding information of the defect sample image to obtain fused image coding information;

[0045] Decoding module: used to decode the fused image encoding information to obtain the defect location information in the image information to be detected.

[0046] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are performed.

[0047] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, runs the steps in the method provided in the first aspect above.

[0048] Beneficial effects: The present application provides a method, device, electronic device and storage medium for detecting appearance defects. Through the above-mentioned appearance defect detection method, the image information to be detected is obtained, the image information to be detected is encoded, and the image encoding information to be detected is obtained. At the same time, the defect sample image encoding information is obtained, and the image information is converted into encoding information for transmission, so as to facilitate the recognition and calculation of the computer equipment. The obtained image encoding information to be detected and the defect sample image encoding information are matrix transformed. After the fused image encoding information is generated, it is input into the neural network for encoding analysis, and the defect sample image feature information in the defect sample image encoding information is used to tell the neural network to find the defect consistent with the defect sample image feature information in the defect sample image encoding information in the image encoding information to be detected, and the position of the defect is displayed in a display image of the same size as the image information to be detected, so as to obtain the position information of the defect in the image information to be detected. There is no need to manually input the position prompt information, and the model training and data annotation of the image cutting are performed, so as to conveniently obtain the position information of the defect in the image information to be detected, thereby improving the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 A flowchart of an appearance defect detection method provided in this application.

[0050] Figure 2 This is a structural diagram of an appearance defect detection device provided in this application.

[0051] Figure 3 A schematic diagram of the structure of the electronic device provided in this application.

[0052] Figure 4 A schematic diagram of image information to be detected provided in this application.

[0053] Figure 5 A schematic diagram of defect sample image information provided in this application.

[0054] Figure 6 A display image of defect position information in image information to be detected provided by the present application.

[0055] Explanation of reference numerals: 201, first acquisition module; 202, second acquisition module; 203, third acquisition module; 204, fusion module; 205, decoding module; 301, processor; 302, memory; 303, communication bus; 3, electronic device. DETAILED DESCRIPTION

[0056] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application usually described and marked in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0057] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0058] The following disclosure provides many different implementations or examples to achieve the purpose of the present invention and solve the problems existing in the prior art. In the current appearance defect detection method, the SAM method is usually used for image segmentation, but this method segments the image near the location according to the location prompt information input by the user, which takes time to train the model and annotate the data. The operation is very complicated and the detection efficiency is low. In order to solve this problem, the present application provides an appearance defect detection method, device, electronic device and storage medium, specifically:

[0059] Please refer to Figure 1 The embodiment of the present application provides an appearance defect detection method, which is applied to the field of image processing technology. The method encodes the image information to be detected to obtain the image coding information to be detected, and adds the defect sample image coding information to generate fused image coding information with the defect sample image coding information. The fused image coding information is input into a neural network, and the neural network is told to parse the fused image coding information. A defect that is consistent with the defect sample image feature information in the defect sample image coding information is searched in the image coding information to be detected, and the position of the defect is displayed in a display image of the same size as the image information to be detected, so as to obtain the position information of the defect in the image information to be detected.

[0060] A method for detecting appearance defects in an embodiment of the present application comprises the following steps:

[0061] A1: Obtain the image information to be detected;

[0062] A2: Encode the image information to be detected to obtain the encoded information of the image to be detected;

[0063] A3: Obtain the image coding information of the defect sample;

[0064] A4: Superimpose the image coding information to be detected and the defect sample image coding information to obtain fused image coding information;

[0065] A5: Decode the fused image encoding information to obtain the defect position information in the image information to be detected.

[0066] Among them, in step A1, in actual application, the image information to be detected is the image information of the surface of the object to be detected taken by the camera, such as Figure 4 As shown; in step A2, the image information to be detected is encoded, which is actually to convert the image information to be detected into a 64*64*3 matrix by image encoding. Similarly, the defect sample image encoding information is also a 64*64*3 matrix. In step A3, the defect sample image encoding information is obtained by the user selecting and inputting the corresponding defect sample image information. The user can input multiple different types of defect sample image information, such as dent sample image information, crack sample image information, etc. Figure 5 As shown, after encoding, the corresponding defect sample image encoding information is obtained, wherein the defect sample image information can be obtained from an open source industrial defect sample image dataset on the Internet to save the user's time in specially preparing the defect sample image information.

[0067] Among them, in step A4, the coding information of the image to be detected and the coding information of the defect sample image are superimposed, which is actually to perform a product operation on the matrix of the coding information of the image to be detected and the matrix of the coding information of the defect sample image to obtain the fused image coding information. In step A5, the fused image coding information is input into the neural network, so that the neural network searches for defects consistent with the feature information of the defect sample image in the coding information of the image to be detected according to the coding information of the defect sample image, and completes the process of decoding the fused image coding information. After the decoding is completed, the position of the defect is displayed in a display image of the same size as the image information to be detected, and the display image is output, so that the defect position information can be clearly obtained. The display image is as shown in FIG. Figure 6 As shown, the black part is the part where the defect does not exist, and the white part is the location of the defect.

[0068] Further, in some preferred embodiments, in order to more conveniently obtain the defect sample image encoding information, common defect information can be obtained according to the type of image information to be detected, and there is no need to input all defect sample image information, thereby reducing detection time and improving detection efficiency. Therefore, the step of obtaining the defect sample image encoding information includes:

[0069] Acquire type information of the image to be detected according to the information of the image to be detected;

[0070] Filter common defect information of the image to be inspected according to type information;

[0071] Obtain defect sample image coding information based on common defect information.

[0072] Among them, the type information of the image to be detected includes but is not limited to objects to be detected composed of different materials such as steel, cement, rails, cloth, etc. In practical applications, the type information of the image to be detected can be identified by image recognition technology, or the technicians can store the type information in a computer-recognizable manner in a database when taking pictures of the image information of the object to be detected, and directly obtain it when needed.

[0073] Common defect information can be obtained based on historical data. For example, in historical data, when detecting defects on the surface of steel, the defects frequently detected are "dents" and "scratches". Therefore, when the type information obtained is steel, it is only necessary to input the defect sample image information of "dents" and the defect sample image information of "scratches" into the computer for encoding to obtain the defect sample image encoding information. There is no need to input all possible defects on the steel surface for detection. In actual situations, it is also difficult to input all possible defects on the steel surface for detection. On the one hand, in an industrial environment, defect samples are difficult to obtain, and the production of defect samples often requires artificially creating defects and then obtaining defect sample image information. On the other hand, in an actual environment, the types of defects are very complicated and it is difficult to obtain all defects. Therefore, in order to improve efficiency, common defect information is obtained through historical data, and then the corresponding defect sample image information is obtained through the open source defect sample data set on the Internet. After encoding it, the defect sample image encoding information can be easily obtained.

[0074] Furthermore, in some specific implementations, the step of decoding the fused image encoding information to obtain the defect position information in the image information to be detected includes:

[0075] Obtaining defect sample image feature information from fused image coding information;

[0076] Obtaining defect image coding information that matches the defect sample image feature information in the image coding information to be detected, wherein the defect image coding information includes position information of the defect image coding information in the image coding information to be detected;

[0077] The defect position information in the image information to be detected is obtained according to the defect image coding information.

[0078] Among them, in practical applications, the defect sample image feature information actually refers to the feature information of the shape, color, etc. of the defect in the defect sample image information, which is the coding information. The image coding information to be detected is matrix-multiplied with the defect sample image coding information to obtain the superimposed fused image coding information. The fused image coding information is input into the neural network, and the matrix of the defect image coding information is used as the convolution matrix, and the defect sample image feature information is used as the convolution kernel. The defect image coding information matching the defect sample image feature information is searched in the matrix of the image coding information to be detected. The defect image coding information includes the position information of the defect image coding information in the image coding information to be detected. Therefore, the found defect image coding information is superimposed and filtered with the image coding information to be detected to obtain a display image showing the defect position information. The size of the display image is consistent with the size of the image to be detected, so that the defect position information in the image information to be detected can be clearly obtained.

[0079] Furthermore, in some preferred embodiments, the step of decoding the fused image encoding information to obtain the defect position information in the image information to be detected further includes:

[0080] Obtain defect prompt coding information, which includes defect type information;

[0081] Classifying the fused image coding information according to the defect type information to obtain the marked fused image coding information marked with the defect type information;

[0082] The coded information of the marked fusion image is decoded to obtain the defect position information in the image information to be detected.

[0083] In practical applications, since the image information to be detected may contain more than one defect type information, such as there are two defect type information of depression and scratch in the image information to be detected, in order to output the defect positions corresponding to the defect type information respectively, the defect prompt coding information can be used to classify the fused image coding information. For example, the user inputs the prompt information as "sunken" (the prompt information is text information), and the "sunken" text is encoded to obtain the "sunken" prompt coding information. The prompt coding information is superimposed with the fused image coding information, so that the network can query the defect image coding information corresponding to "sunken" in the fused image coding information, and obtain the marked fused image coding information with the "sunken" defect type information. Similarly, the marked fused image coding information with scratches can also be obtained. After decoding the marked fused image coding information, the corresponding "sunken" or "scratches" position information in the image to be detected can be obtained, thereby realizing the classification of the fused image coding information, which is convenient for users to distinguish the defect types in the image information to be detected.

[0084] Furthermore, in some preferred embodiments, the defect location information can be obtained by directly comparing the image information to be detected with the preset standard image information. Specifically, the method further includes:

[0085] Acquire type information of the image to be detected according to the information of the image to be detected;

[0086] Acquire preset standard image information according to type information;

[0087] Comparing the preset standard image information with the image information to be detected, and generating a comparison result;

[0088] According to the comparison result, the defect position information in the image information to be detected is obtained.

[0089] The type information of the image to be detected includes but is not limited to objects to be detected composed of different materials such as steel, cement, rails, and cloth. The preset standard image information is set in advance by the user and is the image information of different types of objects without defects on the surface. In actual applications, the user can collect a variety of different types of standard images in advance to make a standard image information database. After obtaining the type information of the image to be detected, the preset standard image information corresponding to the type is queried in the database. Through image recognition technology, the gray value information of the image information to be detected and the gray value of the preset standard image information are obtained. The two are compared to obtain the defect location information in the image information to be detected.

[0090] Furthermore, the step of comparing the preset standard image information with the image information to be detected and generating a comparison result includes:

[0091] Acquire a first eigenvector in preset standard image information and a second eigenvector in the image information to be detected;

[0092] calculating a difference between the first eigenvector and the second eigenvector;

[0093] When the difference is greater than or equal to the preset difference, the generated comparison result is that there is a defect in the image information to be detected;

[0094] When the difference is smaller than the preset difference, the generated comparison result is that there is no defect in the image information to be detected.

[0095] Among them, the first eigenvector includes the grayscale value of the preset standard image information, and the second eigenvector includes the grayscale value in the image information to be detected. By calculating the difference between the first eigenvector and the second eigenvector, it is determined whether the difference exceeds the preset difference to determine whether there is a defect in the image information to be detected. By setting the preset difference, the influence of external light on the acquisition of grayscale value is eliminated. When the difference is greater than or equal to the preset difference, the generated comparison result is that there is a defect in the image information to be detected. At this time, the defect in the image information to be detected can be marked, and the image information to be detected with the defect mark can be output to facilitate the identification of the defect position information in the image information to be detected. Therefore, in some specific embodiments, according to the comparison result, the step of obtaining the defect position information in the image information to be detected includes:

[0096] According to the comparison results, the defects are marked;

[0097] According to the marked defect location, the defect location information in the image information to be detected is obtained.

[0098] As can be seen from the above, the present application provides a method for detecting appearance defects, which obtains the image information to be detected, encodes the image information to be detected, obtains the image encoding information to be detected, and at the same time, obtains the defect sample image encoding information, converts the image information into encoding information for transmission, and facilitates the computer equipment to recognize and calculate, and performs matrix transformation on the obtained image encoding information to be detected and the defect sample image encoding information, and after generating the fused image encoding information, it is input into the neural network for encoding analysis, and the defect sample image feature information in the defect sample image encoding information is used to tell the neural network, and find the defect consistent with the defect sample image feature information in the defect sample image encoding information in the image encoding information to be detected, and display the position of the defect in a display image of the same size as the image information to be detected, so as to obtain the position information of the defect in the image information to be detected. There is no need to manually input the position prompt information, and the model training and data annotation of the image cutting can be performed to conveniently obtain the position information of the defect in the image information to be detected, thereby improving the detection efficiency.

[0099] Please refer to Figure 2 The present application provides a device for detecting appearance defects, the device comprising:

[0100] The first acquisition module 201 is used to acquire the image information to be detected;

[0101] The second acquisition module 202 is used to encode the image information to be detected to obtain the image encoding information to be detected;

[0102] The third acquisition module 203 is used to acquire the defect sample image coding information;

[0103] Fusion module 204: used to superimpose the image coding information to be detected and the defect sample image coding information to obtain fused image coding information;

[0104] Decoding module 205: used to decode the fused image encoding information to obtain defect position information in the image information to be detected.

[0105] Among them, in actual application, the first acquisition module 201 acquires the image information to be detected, and then passes the image information to be detected to the second acquisition module 202. The second acquisition module 202 encodes the image information to be detected to obtain the image coding information to be detected. At the same time, the third acquisition module 203 acquires the defect sample image coding information, and converts the image information into coding information for transmission, which is convenient for computer equipment to recognize and calculate. The fusion module 204 performs matrix transformation on the acquired image coding information to be detected and the defect sample image coding information. After generating the fused image coding information, it is input into the neural network and the decoding module 205 is asked to parse it. The defect sample image feature information in the defect sample image coding information is used to tell the neural network to find defects in the image coding information to be detected that are consistent with the defect sample image feature information in the defect sample image coding information, and the position of the defect is displayed in a display image of the same size as the image information to be detected, so as to obtain the position information of the defect in the image information to be detected.

[0106] As can be seen from the above, the present application provides an appearance defect detection device, which obtains the image information to be detected through the above-mentioned appearance defect detection method, encodes the image information to be detected, obtains the image encoding information to be detected, and obtains the defect sample image encoding information at the same time. By converting the image information into encoding information for transmission, it is convenient for the computer device to recognize and calculate, and the obtained image encoding information to be detected and the defect sample image encoding information are matrix transformed. After generating the fused image encoding information, it is input into the neural network for encoding analysis, and the defect sample image feature information in the defect sample image encoding information is used to tell the neural network to find the defect consistent with the defect sample image feature information in the defect sample image encoding information in the image encoding information to be detected, and the position of the defect is displayed in a display image of the same size as the image information to be detected, so as to obtain the position information of the defect in the image information to be detected. There is no need to manually input the position prompt information, and the model training and data annotation of the image cutting can be performed to conveniently obtain the position information of the defect in the image information to be detected, thereby improving the detection efficiency.

[0107] Among them, in actual applications, the type information of the image to be detected can be identified by image recognition technology, or the type information can be stored in the information to be detected in a computer-recognizable manner in advance when the technician takes the image information of the object to be detected, and can be directly obtained when needed. Common defect information can be obtained based on historical data. For example, in historical data, when detecting defects on the surface of steel, the defects frequently detected are "dents" and "scratches". Therefore, when the type information obtained is steel, it is only necessary to input the defect sample image information of "dents" and the defect sample image information of "scratches" into the computer for encoding to obtain the defect sample image encoding information, without having to input all possible defects on the steel surface into the detection, thereby improving the detection efficiency.

[0108] Among them, in practical applications, the defect sample image feature information actually refers to the feature information of the shape, color, etc. of the defect in the defect sample image information, which is the coding information. The image coding information to be detected is matrix-multiplied with the defect sample image coding information to obtain the superimposed fused image coding information. The fused image coding information is input into the neural network, and the matrix of the defect image coding information is used as the convolution matrix, and the defect sample image feature information is used as the convolution kernel. The defect image coding information matching the defect sample image feature information is searched in the matrix of the image coding information to be detected. The defect image coding information includes the position information of the defect image coding information in the image coding information to be detected. Therefore, the found defect image coding information is superimposed and filtered with the image coding information to be detected to obtain a display image showing the defect position information. The size of the display image is consistent with the size of the image to be detected, so that the defect position information in the image information to be detected can be clearly obtained.

[0109] Among them, in practical applications, since the image information to be detected may contain more than one defect type information, such as there are two defect type information of depression and scratch in the image information to be detected, in order to output the defect positions corresponding to the defect type information respectively, the defect prompt coding information can be used to classify the fused image coding information. For example, the user inputs the prompt information as "depression" (the prompt information is text information), and the "depression" text is encoded to obtain the "depression" prompt coding information. The prompt coding information is superimposed with the fused image coding information, so that the network can query the defect image coding information corresponding to "depression" in the fused image coding information, and obtain the marked fused image coding information with the "depression" defect type information. Similarly, the marked fused image coding information with scratches can also be obtained. After decoding the marked fused image coding information, the corresponding "depression" or "scratch" position information in the image to be detected can be obtained, thereby realizing the classification of the fused image coding information, which is convenient for users to distinguish the defect types in the image information to be detected.

[0110] Among them, in actual applications, users can collect a variety of different types of standard images in advance to make a standard image information database. After obtaining the type information of the image to be detected, the preset standard image information corresponding to the type is queried in the database. Through image recognition technology, the grayscale value information of the image information to be detected and the grayscale value of the preset standard image information are obtained, and the two are compared. When the difference between the grayscale value information of the image information to be detected and the grayscale value of the preset standard image information is greater than the preset difference, it means that there is a defect in the image information to be detected. The defect position is marked, and the defect position information of the image information to be detected can be easily obtained.

[0111] Please refer to Figure 3 , Figure 3 This is a structural schematic diagram of an electronic device provided in an embodiment of the present application. The present application provides an electronic device 3, including: a processor 301 and a memory 302. The processor 301 and the memory 302 are interconnected and communicate with each other through a communication bus 303 and / or other forms of connection mechanisms (not marked). The memory 302 stores computer-readable instructions executable by the processor 301. When the electronic device is running, the processor 301 executes the computer-readable instructions to execute the method in any optional implementation of the above-mentioned embodiment to achieve the following functions: obtaining image information to be detected; encoding the image information to be detected to obtain image coding information to be detected; obtaining defect sample image coding information; superimposing the image coding information to be detected and the defect sample image coding information to obtain fused image coding information; decoding the fused image coding information to obtain defect position information in the image information to be detected.

[0112] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method in any optional implementation of the above embodiment is executed to achieve the following functions: obtaining image information to be detected; encoding the image information to be detected to obtain image coding information to be detected; obtaining defect sample image coding information; superimposing the image coding information to be detected and the defect sample image coding information to obtain fused image coding information; decoding the fused image coding information to obtain defect position information in the image information to be detected.

[0113] Among them, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0114] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0115] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0116] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0117] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0118] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for detecting appearance defects, characterized in that: The method comprises the steps of: Obtaining image information to be detected; Encoding the image information to be detected to obtain coded image information to be detected; Obtaining defect sample image coding information; Superimposing the image coding information to be detected and the defect sample image coding information to obtain fused image coding information; Decoding the fused image encoding information to obtain defect position information in the image information to be detected; The step of decoding the fused image encoding information to obtain the defect position information in the image information to be detected includes: Obtaining defect sample image feature information from fused image coding information; Obtaining defect image coding information that matches the defect sample image feature information in the image coding information to be detected, wherein the defect image coding information includes position information of the defect image coding information in the image coding information to be detected; The defect position information in the image information to be detected is obtained according to the defect image coding information.

2. The appearance defect detection method according to claim 1, characterized in that: The step of obtaining defect sample image coding information comprises: Acquiring type information of the image to be detected according to the image information to be detected; Filtering common defect information of the image to be inspected according to the type information; The defect sample image coding information is obtained according to the common defect information.

3. The appearance defect detection method according to claim 1, characterized in that: The step of decoding the fused image encoding information to obtain the defect position information in the image information to be detected also includes: Obtain defect prompt coding information, wherein the defect prompt coding information includes defect type information; Classifying the fused image coding information according to the defect type information to obtain marked fused image coding information marked with the defect type information; The marked fused image encoding information is decoded to obtain defect position information in the image information to be detected.

4. The appearance defect detection method according to claim 1, characterized in that: The method further comprises: Acquiring type information of the image to be detected according to the image information to be detected; Acquire preset standard image information according to the type information; Comparing the preset standard image information with the image information to be detected, and generating a comparison result; According to the comparison result, the defect position information in the image information to be detected is obtained.

5. The appearance defect detection method according to claim 4, characterized in that: The step of comparing the preset standard image information with the image information to be detected and generating a comparison result includes: Acquire a first feature vector in the preset standard image information and a second feature vector in the image information to be detected; Calculating a difference between the first eigenvector and the second eigenvector; When the difference is greater than or equal to a preset difference, the generated comparison result is that there is a defect in the image information to be detected; When the difference is smaller than the preset difference, the generated comparison result is that there is no defect in the image information to be detected.

6. The appearance defect detection method according to claim 5, characterized in that: The step of obtaining the defect position information in the image information to be detected according to the comparison result comprises: marking defects according to the comparison results; According to the marked defect location, the defect location information in the image information to be detected is obtained.

7. An appearance defect detection device, characterized in that: The device can execute the steps in any of the methods described in claims 1 to 6, and the device comprises: The first acquisition module is used to acquire the image information to be detected; A second acquisition module is used to encode the image information to be detected to obtain the image encoding information to be detected; The third acquisition module is used to obtain the defect sample image coding information; Fusion module: used for superimposing the image coding information to be detected and the defect sample image coding information to obtain fused image coding information; Decoding module: used to decode the fused image encoding information to obtain the defect position information in the image information to be detected.

8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 6 are executed.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are executed.

Citation Information

Patent Citations

  • Defect detection method and system based on feature comparison and storage medium

    CN111696092A

  • Image defect detection method and device, electronic equipment and storage medium

    CN113240642A

  • Transparent part surface defect rapid detection method and device

    CN114998216A