A method and system for detecting surface defects of sheet metal parts before painting
By conducting water film test and grid slice processing on the surface of sheet metal, combined with machine learning oil stain sequential analyzer, the surface oil stain detection of sheet metal is automated and high-precision control, solving the problems of low detection efficiency and poor accuracy, and ensuring the coating quality.
Patent Information
- Application Number
- CN202411891749.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2044-12-20
Smart Images

Figure CN119688698B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of surface defect detection, and particularly relates to a method and system for detecting surface defects of sheet metal parts before painting. Background Art
[0002] Sheet metal parts are widely used in industries such as automobiles and aviation. Their surface quality directly affects the appearance of products and subsequent processes such as painting and assembly. Surface defects, especially oil stains before painting, not only affect the painting effect but may also affect the corrosion resistance, wear resistance, and other physical properties of products. However, traditional surface defect detection of sheet metal parts mainly relies on manual visual inspection, touch methods, or some simple mechanical detection methods. Although obvious surface defects such as oil stains can be detected, limited by the subjectivity and accuracy of manual detection, the detection efficiency is often low, the error is large, and it is difficult to apply to large-scale automated production. Especially before painting, minute defects such as oil and grease on the surface of sheet metal parts are key factors affecting the coating quality. How to achieve automated and high-precision surface defect detection of sheet metal parts before painting has become an urgent problem to be solved.
[0003] Therefore, in the related technologies at the present stage, there are technical problems of low detection efficiency and poor accuracy in detecting oil stains on the surface of sheet metal parts. Summary of the Invention
[0004] This application provides a method and system for detecting surface defects of sheet metal parts before painting, solves the technical problems of low detection efficiency and poor accuracy in detecting oil stains on the surface of sheet metal parts in the prior art, realizes the automated control of detecting oil stains on the surface of sheet metal parts, and achieves the technical effects of improving the detection accuracy and detection efficiency of oil stains on the surface of sheet metal parts.
[0005] This application provides a method for detecting surface defects of sheet metal parts before painting. The method includes: obtaining a predetermined sheet metal part, where the predetermined sheet metal part refers to any sheet metal part processed according to an oil cleaning plan; processing the predetermined sheet metal part according to a water film test plan to obtain a post-water film sheet metal part, and obtaining a surface image of the post-water film sheet metal part; performing grid slicing preprocessing on the surface image to obtain an image preprocessing result, where the image preprocessing result includes a first grid slice; activating a surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result; when the first oil stain judgment result meets a predetermined surface oil stain constraint, performing painting control execution on the predetermined sheet metal part.
[0006] In a possible implementation, the predetermined sheet metal part is processed according to a water film test plan to obtain a post-water film sheet metal part, and a surface image of the post-water film sheet metal part is acquired. The following processing is also performed: Image acquisition is performed on the predetermined sheet metal part to obtain an initial surface image; Sampling pixel points of the initial surface image are obtained based on the principle of random sampling; Sampling pixel color feature values corresponding to the sampling pixel points are obtained; Opposite colors of the sampling pixel colors corresponding to the sampling pixel color feature values are obtained, where the opposite colors have opposite color feature values; The opposite color feature values are formulated into predetermined distilled water, and the water film test plan is designed based on the predetermined distilled water.
[0007] In a possible implementation, the surface oil stain successive judgment device is activated to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result. The following processing is also performed: A target sheet metal part is screened out from the same type of sheet metal parts of the predetermined sheet metal part; Target historical oil stain detection records of the target sheet metal part are obtained, and the target historical oil stain detection records include multiple historical grid slices with oil stain state identifiers; A first historical grid slice and a second historical grid slice are sequentially extracted from the multiple historical grid slices with oil stain state identifiers, and the first historical grid slice and the second historical grid slice meet predetermined extraction constraints; A first training data group is formed based on the first historical slice feature information of the first historical grid slice and the first historical oil stain state identifier; A second training data group is formed based on the second historical slice feature information of the second historical grid slice and the second historical oil stain state identifier; Classification learning training is performed on the training data group composed of the first training data group and the second training data group to obtain the surface oil stain successive judgment device.
[0008] In a possible implementation, the surface oil stain successive judgment device is activated to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result. The following processing is also performed: Discrete cosine transform processing is performed on the first grid slice to obtain first discrete cosine transform coefficients; A slice feature value estimation function is introduced to perform estimation analysis on the first discrete cosine transform coefficients to obtain first feature values; Local binary conversion is performed on the first grid slice to obtain a first conversion code, and first slice feature information is formed in combination with the first feature values; The first slice feature information is used as input data of the surface oil stain successive judgment device, and the first oil stain judgment result is obtained through the surface oil stain successive judgment device.
[0009] In a possible implementation, a slice eigenvalue estimation function is introduced to estimate and analyze the first discrete cosine transform coefficients to obtain a first eigenvalue, and the following processing is also performed: obtaining a weight allocation plan; based on the slice eigenvalue estimation function and in combination with the weight allocation plan, weighting the first slice DC coefficient and the first slice AC coefficient in the first discrete cosine transform coefficients to obtain the first eigenvalue; wherein, the expression of the slice eigenvalue estimation function is as follows:
[0010] ;
[0011] Wherein, refers to the first eigenvalue, refers to the first slice DC coefficient of the first grid slice n, refers to the first slice AC coefficient of the first grid slice n, refers to the th sub-block of the first grid slice n, a refers to the influence factor of the first slice DC coefficient on the first eigenvalue, b refers to the influence factor of the first slice AC coefficient on the first eigenvalue, where a + b = 1, and a is much greater than b.
[0012] In a possible implementation, when the first oil stain judgment result meets the predetermined surface oil stain constraint, painting control is performed on the predetermined sheet metal part, and the following processing is also performed: counting the number of grid slices with the oil stain status marked as no oil stain in the first oil stain judgment result; obtaining the ratio of the number of grid slices to the total number of grid slices in the image preprocessing result, denoted as the first oil stain ratio; when the first oil stain ratio reaches the predetermined ratio threshold in the predetermined surface oil stain constraint, then the first oil stain judgment result meets the predetermined surface oil stain constraint.
[0013] In a possible implementation, for the method for detecting surface defects of a sheet metal part before painting, the following processing is also performed: when the first oil stain judgment result does not meet the predetermined surface oil stain constraint, the oil stain cleaning plan is retrieved to perform re-cleaning on the predetermined sheet metal part.
[0014] The present application also provides a surface defect detection system for a sheet metal part before painting, including: a predetermined sheet metal part acquisition module for acquiring a predetermined sheet metal part, where the predetermined sheet metal part refers to any one sheet metal part processed according to an oil stain cleaning plan; a surface image acquisition module for processing the predetermined sheet metal part according to a water film test plan to obtain a post-water film sheet metal part and acquiring the surface image of the post-water film sheet metal part; a grid slicing preprocessing module for performing grid slicing preprocessing on the surface image to obtain an image preprocessing result, where the image preprocessing result includes a first grid slice; an oil stain judgment module for activating a surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result; a painting control execution module for performing painting control execution on the predetermined sheet metal part when the first oil stain judgment result meets a predetermined surface oil stain constraint.
[0015] It is intended to obtain a predetermined sheet metal part through a surface defect detection method and system for a sheet metal part before painting proposed in the present application; process the predetermined sheet metal part according to a water film test plan to obtain a post-water film sheet metal part and acquire the surface image of the post-water film sheet metal part; perform grid slicing preprocessing on the surface image to obtain an image preprocessing result; activate a surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result; when the first oil stain judgment result meets a predetermined surface oil stain constraint, perform painting control execution on the predetermined sheet metal part. This solves the technical problems of low detection efficiency and poor accuracy in detecting oil stains on the surface of sheet metal parts in the prior art, realizes the automatic control of detecting oil stains on the surface of sheet metal parts, and achieves the technical effects of improving the detection accuracy and detection efficiency of oil stains on the surface of sheet metal parts. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments of the present disclosure will be briefly introduced below. Flowcharts are used in this application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the operations before or below do not necessarily need to be executed precisely in sequence. On the contrary, according to needs, they can be executed in reverse order or simultaneously. At the same time, other operations can also be added to these processes, or one or several steps of operations can be removed from these processes.
[0017] Figure 1 It is a schematic flowchart of a surface defect detection method for a sheet metal part before painting provided by an embodiment of the present application.
[0018] Figure 2 It is a schematic structural diagram of a surface defect detection system for a sheet metal part before painting provided by an embodiment of the present application.
[0019] Description of the attached drawing reference numerals: Predetermined sheet metal part acquisition module 10, surface image acquisition module 20 of the sheet metal part, grid slicing preprocessing module 30, oil stain judgment module 40, painting control execution module 50. Detailed implementation manners
[0020] The above description is only an overview of the technical solution of this application. In order to be able to understand the technical means of this application more clearly, it can be implemented in accordance with the content of the specification. And in order to make the above and other purposes, features and advantages of this application more obvious and understandable, the following specifically gives the detailed implementation manners of this application.
[0021] In order to make the purpose, technical solution and advantages of this application clearer, the following will further describe this application in detail with reference to the attached drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of this application.
[0022] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict. The terms "first\second" involved are only used to distinguish similar objects and do not represent a specific order for the objects. The terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or modules that are not clearly listed or are inherent to these processes, methods, products or devices. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application.
[0023] An embodiment of this application provides a method for detecting surface defects before painting of a sheet metal part, as Figure 1 shown. The method includes:
[0024] Step S100, acquire a predetermined sheet metal part, where the predetermined sheet metal part refers to any one sheet metal part processed through an oil stain cleaning plan.
[0025] Preferably, a predetermined sheet metal part is obtained. The predetermined sheet metal part refers to the target sheet metal part during the entire painting process. The predetermined sheet metal part is any one of the sheet metal parts processed according to the oil stain cleaning plan. Among them, the oil stain cleaning plan treatment refers to the oil stain cleaning treatment on the surface of the sheet metal part. Specifically, during the production and processing of the sheet metal part, substances such as oil stains, fats, and lubricating fluids often adhere to the surface. These substances will affect the subsequent painting effect and even cause poor adhesion of the coating. By cleaning the surface according to the oil stain cleaning plan, the excess oil stains are removed to ensure the painting quality. The oil stain cleaning plan may include different cleaning methods, such as mechanical cleaning, chemical cleaning, etc.; any one of the sheet metal parts means that the predetermined sheet metal part is randomly selected from multiple sheet metal parts after oil stain cleaning treatment as the object to be detected, so as to carry out subsequent defect detection or painting control.
[0026] Step S200, process the predetermined sheet metal part according to the water film test plan to obtain a post-water film sheet metal part, and acquire the surface image of the post-water film sheet metal part.
[0027] Preferably, the water film test plan refers to a specific test plan used to detect oil stains or contaminants on the surface of the sheet metal part. Among them, the predetermined sheet metal part needs to go through multiple steps, that is, using the water film test technology to enhance the appearance of oil stains on the surface of the sheet metal part. Specifically, it includes water film formation, by evenly spraying or coating water or a water-based solution on the surface of the sheet metal part to form a thin water film; the interaction between the oil stain and the water film, the oil stain on the surface of the sheet metal part (if any) will interact with the water film. The oil stain usually forms visible traces different from the clean surface in the water film, and can leave different textures or stains on the water film; through the water film test, the surface oil stain becomes more visible, thus providing a clearer basis for subsequent defect detection. After the water film test treatment, a water film is formed on the surface of the sheet metal part. Through the reaction of the water film with the oil stain and contaminants, the defects such as surface oil stains are more clearly shown. The sheet metal part after the water film test treatment is the post-water film sheet metal part, and then the surface image of the post-water film sheet metal part is acquired. Specifically, by using a high-definition image acquisition device (such as a camera or a scanner) to take pictures or scan the surface of the sheet metal part, clear image data of the surface of the sheet metal part is obtained. These images contain defect information such as oil stains and stains on the surface of the sheet metal part. For example, the specific positions and forms of oil stains or other defects will be shown in the images.
[0028] Further, step S200 further includes step S210 of acquiring an initial surface image of the predetermined sheet metal part; step S220 of obtaining sampling pixel points of the initial surface image based on the principle of random sampling; step S230 of obtaining sampling pixel color feature values corresponding to the sampling pixel points; step S240 of obtaining the opposite color of the sampling pixel color corresponding to the sampling pixel color feature value, wherein the opposite color has opposite color feature values; step S250 of formulating the opposite color feature value with predetermined distilled water and designing a water film test plan based on the predetermined distilled water.
[0029] Preferably, the initial surface image data of the predetermined sheet metal part is acquired by an image acquisition device (such as a camera, a scanner, etc.). The initial surface image is the original image of the surface of the sheet metal part, which contains information such as possible defects, oil stains, scratches, etc. on the surface of the sheet metal part. The sampling pixel points of the initial surface image are obtained based on the principle of random sampling. The sampling pixel points refer to some pixel positions randomly selected from the image. Specifically, a certain number of pixel points are randomly selected from the initial surface image for analysis. Among them, random sampling is to reduce the calculation amount and quickly evaluate the overall characteristics of the image. Especially when the image content is very large and all pixel points cannot be processed, this method can effectively represent the characteristics of the overall image. Then, the sampling pixel color feature values corresponding to the sampling pixel points are obtained, that is, the color analysis of the sampling pixel points is carried out. The color information of each pixel point can be represented by a color space (such as RGB, HSV, etc.), and then the color feature values (i.e., the quantization representation of the color of each sampling pixel point) are obtained. For example, the RGB model represents the components of red, green, and blue respectively, or the HSV model represents hue, saturation, and lightness. Then, the opposite color of the sampling pixel color corresponding to the sampling pixel color feature value is obtained. The opposite color refers to the color that is in the opposite position in the color space to the original color, and the opposite color has opposite color feature values. The core is to enhance the detection of oil stains or defects based on the contrast of colors. For example, in the RGB color model, the opposite color of red is cyan, the opposite color of green is magenta, and the opposite color of blue is yellow. By generating the opposite color, the visibility of specific color areas (such as oil stains, stains) in the image can be enhanced, which helps to more clearly identify defects such as oil stains. The opposite color feature value is formulated with predetermined distilled water, that is, an image processing reagent (such as simulating a water film test) is prepared by combining the opposite color feature value with distilled water. The distilled water serves as a reagent or a carrier to help generate a water film for the process of forming a certain water film on the surface of the sheet metal part to enhance the effect of oil stain detection. Finally, a water film test plan is designed based on the predetermined distilled water. By forming a thin water film on the surface, the interaction between the oil stain and the water will make the oil stain more obvious, and improve the accuracy and detection effect of the oil stain or other surface defects.
[0030] Step S300: Perform grid slicing preprocessing on the surface image to obtain an image preprocessing result, where the image preprocessing result includes a first grid slice.
[0031] Preferably, perform grid slicing preprocessing on the surface image to obtain an image preprocessing result, that is, divide the obtained surface image of the sheet metal part into multiple small and regular regions (i.e., several uniform grid slices) through a certain grid division method. Each grid slice represents a local region in the image. Here, a grid refers to dividing the image according to a certain grid. For example, the image is divided into several rectangular regions of equal size, and each rectangular region is a grid; a slice refers to each region after the image is divided. Each slice contains a part of the image information and represents a local region in the image. For example, if the surface image of the sheet metal part is large and contains a lot of details and possible defects (such as oil stains, scratches, etc.), it may be difficult to directly analyze the entire image. Through the grid slicing method, the entire image is divided into several small pieces, and each small piece can be processed and analyzed separately, thereby improving the processing accuracy and efficiency. The image preprocessing result is the multiple grid slices obtained by performing grid slicing preprocessing on the surface image. Among them, the first grid slice is any one in the image preprocessing result. The main function of grid slicing preprocessing is to divide the large-sized surface image into multiple small pieces, so as to facilitate more detailed analysis of each small piece, more easily detect small defects or contaminants in a certain region, make individual judgments and analyses on defects such as oil stains and scratches in each region of the sheet metal part surface, and can reduce the complexity of calculation and processing, and improve the accuracy and efficiency of defect detection.
[0032] Step S400: Activate the surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result.
[0033] Preferably, the surface oil stain successive judgment device judges the oil stains on the first grid slice. The surface oil stain successive judgment device is a trained machine learning model used to automatically analyze each grid slice in the surface image of the sheet metal part, identify oil stains, stains or other pollutants in the image, and determine the state of the oil stains in each area. Specifically, the surface oil stain successive judgment device will analyze each part of the image one by one (successive judgment) and gradually check each detailed area in the image to ensure that the oil stains are accurately detected. Oil stain judgment refers to judging the oil stains in the surface image, that is, judging whether a certain part of the image contains oil stains or other pollutants and giving a judgment result. Using the surface oil stain successive judgment device to judge the oil stains on the first grid slice, that is, analyzing the image content in the first grid slice and judging whether there are oil stains in this part of the area, including using image analysis algorithms (such as edge detection, color change analysis, texture recognition, etc.) to identify the possible oil stain areas on the surface and obtaining the first oil stain judgment result. The first oil stain judgment result is the analysis result of the oil stain situation in this slice area, for example, indicating whether there are oil stains, and the result is "yes" or "no"; or quantifying the area and distribution of the oil stains through the coverage rate of the oil stains, the severity of the oil stains, etc., aiming to accurately identify whether there are oil stains on the surface of the sheet metal part, so as to ensure the surface is clean and the painting effect is excellent before painting.
[0034] Further, step S400 further includes step S410 of screening out the target sheet metal part from the similar sheet metal parts of the predetermined sheet metal part; step S420 of obtaining the target historical oil stain detection record of the target sheet metal part, where the target historical oil stain detection record includes multiple historical grid slices with oil stain status identifiers; step S430 of successively extracting the first historical grid slice and the second historical grid slice from the multiple historical grid slices with oil stain status identifiers, and the first historical grid slice and the second historical grid slice meet the predetermined extraction constraints; step S440 of forming the first training data group based on the first historical slice feature information and the first historical oil stain status identifier of the first historical grid slice; step S450 of forming the second training data group based on the second historical slice feature information and the second historical oil stain status identifier of the second historical grid slice; step S460 of performing classification learning training on the training data group composed of the first training data group and the second training data group to obtain the surface oil stain successive judgment device.
[0035] Preferably, the target sheet metal parts are screened out from the same type of sheet metal parts of a predetermined sheet metal part, which may be sheet metal parts with similar dimensions, materials, processing techniques, etc. Then, the target historical oil stain detection records of the target sheet metal parts are obtained. Each target sheet metal part has a historical oil stain detection record, which contains multiple historical grid slices and their corresponding oil stain status identifiers. That is, in the target historical oil stain detection record, whether each grid slice contains oil stains, or the severity, type, etc. of the oil stains are all identified. Through the target historical oil stain detection record, the past oil stain status of the sheet metal part can be understood. Then, from multiple historical grid slices with oil stain status identifiers, the first historical grid slice and the second historical grid slice are sequentially extracted according to a predetermined extraction constraint, corresponding to the image areas detected in the past, and each grid slice has its corresponding oil stain status identifier. Among them, the predetermined extraction constraint is some preset conditions, such as the position of the grid, the status of the oil stain, the quality of the slice, etc.
[0036] Preferably, the feature information of each historical grid slice (such as the color, texture, shape, etc. of the image) is combined with the corresponding oil stain status identifier (such as "with oil stain" or "without oil stain", or the degree, type, etc. of the oil stain) to construct a training data set. Specifically, based on the feature information of the first historical grid slice and the corresponding oil stain status identifier, the first set of training data is constructed, that is, the first training data set; based on the feature information of the second historical grid slice and the corresponding oil stain status identifier, the second set of training data is constructed, that is, the second training data set; these two training data sets are used as the input data of the machine learning model to help the model understand the images in different oil stain states, that is, the first training data set and the second training data set are combined into a data set for classification training. For example, supervised learning algorithms (such as support vector machines, decision trees, neural networks, etc.) are used to train the data, so that the system can predict the oil stain status according to the image features. During the training process, the system continuously adjusts the parameters of the model to minimize the prediction error. Finally, a surface oil stain successive judgment device is obtained, which can judge the oil stain status on the surface of the sheet metal part (such as whether there is an oil stain, the severity of the oil stain, etc.) according to the image features (such as the texture, color, shape, etc. in the image), and then can automatically and accurately identify and analyze the oil stain during the subsequent production or detection process of the sheet metal part to ensure the smooth progress of the painting process.
[0037] Further, step S400 further includes step S470 of performing a discrete cosine transform on the first grid slice to obtain first discrete cosine transform coefficients; step S480 of introducing a slice eigenvalue estimation function to perform estimation and analysis on the first discrete cosine transform coefficients to obtain a first eigenvalue; step S490 of performing local binary conversion on the first grid slice to obtain a first conversion code, and combining the first eigenvalue to form first slice feature information; step S4100 of using the first slice feature information as input data for the surface oil stain successive judgment device, and obtaining a first oil stain judgment result through the surface oil stain successive judgment device.
[0038] Preferably, the first grid slice is processed and its feature information is used as input data, and the trained surface oil stain successive judgment device is used to perform oil stain judgment to obtain a first oil stain judgment result. Specifically, a discrete cosine transform is performed on the first grid slice. The discrete cosine transform (DCT) is a commonly used signal processing technique, often used in image processing to extract the frequency domain information of this part of the image, that is, to convert the image data from the spatial domain to the frequency domain to analyze the frequency characteristics of the image, and then obtain the first discrete cosine transform coefficients, which reflect the information distribution of the image at different frequencies. The high-frequency discrete cosine transform coefficients represent the details and textures of the image, while the low-frequency discrete cosine transform coefficients represent the overall structure and main features of the image; then a slice eigenvalue estimation function is introduced to perform estimation and analysis on the first discrete cosine transform coefficients. The slice eigenvalue estimation function is used to extract meaningful eigenvalues from the discrete cosine transform coefficients, that is, by performing a certain form of statistical analysis or transformation on the first discrete cosine transform coefficients, the key features (first eigenvalue) in the image are extracted, which represent some important features of the image grid slice and may include the contrast, texture features, edge information, etc. of the image, and help to identify the difference between the oil stain and the clean surface.
[0039] Preferably, local binary conversion is performed on the first grid slice to obtain a first conversion code. Local Binary Pattern (LBP) is a commonly used texture description method for extracting local texture information from images. Specifically, the image of the first grid slice is binarized. For example, a binary pattern (conversion code) is generated by comparing the pixel value with the neighboring pixels, obtaining the first conversion code, which represents the local texture features in this part of the image. Then, combining the first eigenvalue (obtained by DCT analysis) and the first conversion code (obtained by LBP processing), a complete feature set is formed, that is, the first slice feature information, which includes the texture and frequency domain features of the grid slice, and is helpful for subsequent oil stain detection. Finally, the first slice feature information is used as the input data of the surface oil stain successive judgment device, input into the surface oil stain successive judgment device for analysis, and a judgment on the oil stain situation is made, outputting the first oil stain judgment result. For example, "there is an oil stain" or "there is no oil stain", or the type and degree of the oil stain, etc. Through image processing and pattern recognition technologies, it automatically analyzes whether there is an oil stain on the surface of the sheet metal part and makes a judgment, thereby improving the detection efficiency and accuracy.
[0040] Further, step S480 further includes step S481 of obtaining a weight distribution plan; step S482 of weighting the first slice DC coefficient and the first slice AC coefficient in the first discrete cosine transform coefficients based on the slice eigenvalue estimation function and in combination with the weight distribution plan to obtain the first eigenvalue; step S483, where the expression of the slice eigenvalue estimation function is as follows:
[0041] ;
[0042] Where refers to the first eigenvalue, refers to the first slice DC coefficient of the first grid slice n, refers to the first slice AC coefficient of the first grid slice n, refers to the th sub-block of the first grid slice n, a refers to the influence factor of the first slice DC coefficient on the first eigenvalue, b refers to the influence factor of the first slice AC coefficient on the first eigenvalue, where a + b = 1, and a is much larger than b.
[0043] Preferably, the weight allocation plan refers to a plan for determining how to allocate the weights of different parts of data when calculating eigenvalues. The weight allocation determines the contribution degree of different parts (DC coefficients and AC coefficients) to the eigenvalues. For example, in the discrete cosine transform (DCT), the DC coefficients and AC coefficients represent different frequency characteristics of the image respectively. The DC coefficients usually represent the low-frequency information of the image, while the AC coefficients represent the high-frequency detail information of the image. The DC coefficients represent the overall brightness or average gray level information of the image, and the AC coefficients represent the detail information in the image, especially the high-frequency part, including edges, textures, etc. The weight allocation plan assigns different weights to the DC coefficients and AC coefficients to reflect their contribution degrees to the final eigenvalues; then, through the slice eigenvalue estimation function, combined with the weight allocation plan, the first discrete cosine transform coefficients of the first grid slice are weighted to obtain the first eigenvalue. The expression of the slice eigenvalue estimation function is as follows:
[0044] ;
[0045] wherein, refers to the first eigenvalue, refers to the first slice DC coefficient of the first grid slice n, refers to the first slice AC coefficient of the first grid slice n, refers to the th sub-block of the first grid slice n. a refers to the influence factor of the first slice DC coefficient on the first eigenvalue, and b refers to the influence factor of the first slice AC coefficient on the first eigenvalue, where a + b = 1, and a is much greater than b. a + b = 1 means that the weighted sum of the DC coefficients and AC coefficients is 1 in total. a being much greater than b means that the DC coefficient has a greater influence on the eigenvalue because the DC coefficient contains the main structural information of the image (such as brightness, overall shape, etc.), while the AC coefficient more represents the detail information of the image; the sub-block refers to dividing the grid slice into multiple smaller regions for analysis. Each sub-block undergoes an independent discrete cosine transform to obtain DC coefficients and AC coefficients, and they are weighted and combined to form the final eigenvalue.
[0046] Step S500, when the first oil stain judgment result meets the predetermined surface oil stain constraint, perform painting control on the predetermined sheet metal part.
[0047] Preferably, the predetermined surface oil stain constraint refers to the tolerance or acceptable range of the oil stains on the surface of the sheet metal part during the painting process, which is used to determine whether the surface oil stains reach or exceed the permitted range. It may include the area of the oil stains. For example, if the area of the oil stains exceeds a certain predetermined ratio (such as 10% of the surface area), the painting cannot continue; the severity of the oil stains. If the oil stains are very obvious or dense, it may affect the adhesion of the coating; the type of the oil stains, such as whether the types of the oil stains (such as grease, paint residue, stains, etc.) meet the painting requirements. Specifically, if the first oil stain judgment result meets the predetermined surface oil stain constraint, that is, after the oil stain judgment, the situation of the oil stains on the surface of the sheet metal part meets the predetermined standard, the subsequent painting of the sheet metal part can be carried out. In other words, the degree of the oil stains on the surface of the sheet metal part does not exceed the acceptable range, and it enters the formal painting process control stage, including starting the painting process of the sheet metal part when the oil stain judgment result meets the predetermined constraint; if there is an intelligent painting system, automatically adjust the parameters of the painting equipment (such as the type of paint, the painting thickness, etc.) according to the oil stain detection result to ensure the painting quality; ensure good adhesion of the coating and there is no phenomenon that the surface affects the coating quality due to excessive oil stains. Through the automated oil stain detection and painting control execution, the production efficiency can be effectively improved and the product quality can be ensured.
[0048] Further, step S500 further includes step S510, counting the number of grid slices with the oil stain status marked as no oil stain in the first oil stain judgment result; step S520, obtaining the ratio of the number of grid slices to the total number of grid slices in the image preprocessing result, denoted as the first oil stain ratio; step S530, when the first oil stain ratio reaches the predetermined ratio threshold in the predetermined surface oil stain constraint, the first oil stain judgment result meets the predetermined surface oil stain constraint.
[0049] Preferably, count the number of grid slices with the oil stain status marked as no oil stain in the first oil stain judgment result, and then calculate the ratio of the number of grid slices without oil stains to the total number of grid slices in the image preprocessing result as the first oil stain ratio. Among them, the total number of grid slices refers to the total number of all slices obtained after preprocessing the entire surface image of the sheet metal part by grid slicing. The first oil stain ratio represents the proportion of the area without oil stains in the image, and is expressed by the formula:
[0050] First oil stain ratio = × 100%;
[0051] Among them, the first oil stain ratio reflects the overall oil stain distribution on the surface of the sheet metal part. If this ratio is relatively high, it means that there are fewer oil stains on the surface of the sheet metal part and it may meet the painting requirements; otherwise, it may need further cleaning.
[0052] Preferably, the predetermined ratio threshold refers to the maximum allowable oil stain ratio during the painting process, which is usually set according to the surface quality requirements of the sheet metal parts. For example, the predetermined threshold may be 95%, indicating that if more than 5% of the surface area of the sheet metal part has oil stains, painting cannot be carried out. When the calculated first oil stain ratio reaches the predetermined ratio threshold, it means that the degree of oil stains on the surface of the sheet metal part meets the predetermined requirements, and it is considered that the oil stain problem has been solved or is small enough not to affect the painting effect, and the sheet metal part can enter the subsequent painting process. If the oil stain ratio exceeds the threshold, it means that there are too many oil stains, which may cause problems such as poor coating adhesion and poor painting effect, and further cleaning is required first. Through automated image processing and oil stain analysis methods, production efficiency can be effectively improved, the workload of manual inspection can be reduced, and the high quality of products can be ensured.
[0053] Further, step S500 further includes step S540. When the first oil stain judgment result does not meet the predetermined surface oil stain constraint, the oil stain cleaning plan is retrieved to perform re-cleaning on the predetermined sheet metal part.
[0054] Preferably, if the first oil stain judgment result does not meet the predetermined surface oil stain constraint, it means that the state of the oil stains exceeds the allowable range. It may be that the oil stain area is too large, the severity is too high, or the oil stain concentration in some areas is too high to meet the painting requirements. Then the oil stain cleaning plan is retrieved to perform re-cleaning on the predetermined sheet metal part. That is, after the first cleaning of the sheet metal part, when the predetermined oil stain standard is still not reached, cleaning is carried out again, which may include reusing the cleaning agent, increasing the cleaning time, or adopting more powerful cleaning means to completely remove the oil stains until the surface oil stains reach the allowable standard, ensuring that the surface of the sheet metal part meets the painting requirements and avoiding the influence of oil stains on the coating adhesion and painting effect.
[0055] In the above text, reference is made to Figure 1 A method for detecting surface defects before painting of a sheet metal part according to an embodiment of the present invention is described in detail. Next, a system for detecting surface defects before painting of a sheet metal part according to an embodiment of the present invention will be described with reference to Figure 2 A system for detecting surface defects before painting of a sheet metal part according to an embodiment of the present invention is described.
[0056] A system for detecting surface defects before painting of a sheet metal part according to an embodiment of the present invention is used to solve the technical problems of low detection efficiency and poor accuracy in detecting oil stains and grease stains on the surface of sheet metal parts in the prior art, and realizes the automatic control of detecting oil stains and grease stains on the surface of sheet metal parts, achieving the technical effects of improving the detection accuracy and detection efficiency of oil stains and grease stains on the surface of sheet metal parts. A system for detecting surface defects before painting of a sheet metal part includes: a predetermined sheet metal part acquisition module 10, a sheet metal part surface image acquisition module 20, a grid slicing preprocessing module 30, an oil stain judgment module 40, and a painting control execution module 50.
[0057] A predetermined sheet metal part acquisition module 10 is used to acquire a predetermined sheet metal part, where the predetermined sheet metal part refers to any sheet metal part processed through an oil stain cleaning plan; a surface image acquisition module 20 of the sheet metal part is used to process the predetermined sheet metal part according to a water film test plan to obtain a post-water film sheet metal part, and acquire the surface image of the post-water film sheet metal part; a grid slicing preprocessing module 30 is used to perform grid slicing preprocessing on the surface image to obtain an image preprocessing result, where the image preprocessing result includes a first grid slice; an oil stain judgment module 40 is used to activate a surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result; a painting control execution module 50 is used to perform painting control execution on the predetermined sheet metal part when the first oil stain judgment result meets a predetermined surface oil stain constraint.
[0058] Next, the specific configuration of the surface image acquisition module 20 of the sheet metal part will be described in detail. The surface image acquisition module 20 of the sheet metal part further includes: acquiring an initial surface image by performing image acquisition on the predetermined sheet metal part; acquiring sampling pixel points of the initial surface image based on the principle of random sampling; acquiring sampling pixel color feature values corresponding to the sampling pixel points; acquiring the opposite color of the sampling pixel color corresponding to the sampling pixel color feature value, where the opposite color has opposite color feature values; formulating the opposite color feature value with predetermined distilled water, and designing the water film test plan based on the predetermined distilled water.
[0059] Next, the specific configuration of the oil stain judgment module 40 will be described in detail. The oil stain judgment module 40 further includes: screening a target sheet metal part from the same type of sheet metal parts of the predetermined sheet metal part; acquiring the target historical oil stain detection record of the target sheet metal part, where the target historical oil stain detection record includes a plurality of historical grid slices with oil stain status identifiers; sequentially extracting a first historical grid slice and a second historical grid slice from the plurality of historical grid slices with oil stain status identifiers, and the first historical grid slice and the second historical grid slice meet a predetermined extraction constraint; forming a first training data group based on the first historical slice feature information of the first historical grid slice and the first historical oil stain status identifier; forming a second training data group based on the second historical slice feature information of the second historical grid slice and the second historical oil stain status identifier; performing classification learning training on the training data group composed of the first training data group and the second training data group to obtain the surface oil stain successive judgment device.
[0060] Next, the specific configuration of the oil stain judgment module 40 will be further described in detail. The oil stain judgment module 40 further includes: performing discrete cosine transform processing on the first grid slice to obtain first discrete cosine transform coefficients; introducing a slice eigenvalue estimation function to perform estimation analysis on the first discrete cosine transform coefficients to obtain a first eigenvalue; performing local binary conversion on the first grid slice to obtain a first conversion code, and combining the first eigenvalue to form first slice feature information; using the first slice feature information as input data of the surface oil stain successive judgment device, and obtaining the first oil stain judgment result through the surface oil stain successive judgment device.
[0061] Next, the specific configuration of the oil stain judgment module 40 will be further described in detail. The oil stain judgment module 40 further includes: obtaining a weight allocation plan; based on the slice eigenvalue estimation function, combining the weight allocation plan to weight the first slice DC coefficient and the first slice AC coefficient in the first discrete cosine transform coefficients to obtain the first eigenvalue; where the expression of the slice eigenvalue estimation function is as follows:
[0062] ;
[0063] Where, refers to the first eigenvalue, refers to the first slice DC coefficient of the first grid slice n, refers to the first slice AC coefficient of the first grid slice n, refers to the th sub-block of the first grid slice n, a refers to the influence factor of the first slice DC coefficient on the first eigenvalue, b refers to the influence factor of the first slice AC coefficient on the first eigenvalue, where a + b = 1, and a is much larger than b.
[0064] Next, the specific configuration of the painting control execution module 50 will be described in detail. The painting control execution module 50 further includes: counting the number of grid slices with the oil stain status flag of no oil stain in the first oil stain judgment result; obtaining the ratio of the number of grid slices to the total number of grid slices in the image preprocessing result, denoted as the first oil stain ratio; when the first oil stain ratio reaches the predetermined ratio threshold in the predetermined surface oil stain constraint, then the first oil stain judgment result meets the predetermined surface oil stain constraint.
[0065] Next, the specific configuration of the painting control execution module 50 will be described in detail. The painting control execution module 50 further includes: when the first oil stain judgment result does not meet the predetermined surface oil stain constraint, retrieving the oil stain cleaning plan to perform re-cleaning on the predetermined sheet metal part.
[0066] The surface defect detection system for sheet metal parts provided by the embodiments of the present invention can execute the surface defect detection method for sheet metal parts provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.
[0067] Although this application makes various references to certain modules in the system according to the embodiments of this application, however, any number of different modules can be used and run on the user terminal and / or server. The various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of mutual distinction and do not limit the protection scope of the present invention.
[0068] The above specific implementation manners do not constitute a limitation on the protection scope of this application. Those skilled in the art should understand that various modifications, combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of this application shall be included within the protection scope of this application.
Claims
1. A method for detecting surface defects of sheet metal parts before painting, characterized in that, The method includes: Obtain a predetermined sheet metal part, where the predetermined sheet metal part refers to any one sheet metal part processed through an oil stain cleaning plan; Process the predetermined sheet metal part according to a water film test plan to obtain a post-water film sheet metal part, and obtain a surface image of the post-water film sheet metal part; Perform grid slicing preprocessing on the surface image to obtain an image preprocessing result, where the image preprocessing result includes a first grid slice; Activate the surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result; When the first oil stain judgment result meets the predetermined surface oil stain constraint, perform coating control execution on the predetermined sheet metal part; Among them, processing the predetermined sheet metal part according to a water film test plan to obtain a post-water film sheet metal part and obtaining a surface image of the post-water film sheet metal part includes: Perform image acquisition on the predetermined sheet metal part to obtain an initial surface image; Obtain sampling pixel points of the initial surface image based on the principle of random sampling; Obtain the sampling pixel color feature values corresponding to the sampling pixel points; Obtain the opposite color of the sampling pixel color corresponding to the sampling pixel color feature value, where the opposite color has opposite color feature values; Prepare the opposite color feature value with predetermined distilled water, and design the water film test plan based on the predetermined distilled water. Preparing the opposite color feature value with predetermined distilled water means modulating an image processing reagent by combining the opposite color feature value with distilled water, and the distilled water serves as a reagent or carrier to help generate a water film.
2. The surface defect detection method for a sheet metal part before painting according to claim 1, wherein Activating the surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result includes: Screen out a target sheet metal part from the same type of sheet metal parts of the predetermined sheet metal part; Obtain the target historical oil stain detection record of the target sheet metal part, and the target historical oil stain detection record includes multiple historical grid slices with oil stain status identifiers; Successively extract a first historical grid slice and a second historical grid slice from the multiple historical grid slices with oil stain status identifiers, and the first historical grid slice and the second historical grid slice meet the predetermined extraction constraint; Form a first training data group based on the first historical slice feature information and the first historical oil stain status identifier of the first historical grid slice; Form a second training data group based on the second historical slice feature information and the second historical oil stain status identifier of the second historical grid slice; Perform classification learning training on the training data group composed of the first training data group and the second training data group to obtain the surface oil stain successive judgment device.
3. The surface defect detection method for a sheet metal part before painting according to claim 1, characterized in that, Activating the surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result includes: Perform discrete cosine transform processing on the first grid slice to obtain a first discrete cosine transform coefficient; Introduce a slice feature value estimation function to perform estimation analysis on the first discrete cosine transform coefficient to obtain a first feature value; Perform local binary conversion on the first grid slice to obtain a first conversion code, and form first slice feature information in combination with the first feature value; Use the first slice feature information as the input data of the surface oil stain successive judgment device, and obtain the first oil stain judgment result through the surface oil stain successive judgment device.
4. The surface defect detection method for a sheet metal part before painting according to claim 3, wherein Introduce a slice feature value estimation function to estimate and analyze the first discrete cosine transform coefficient to obtain a first feature value, including: Obtain a weight allocation preplan. Based on the slice feature value estimation function, combine the weight allocation preplan to weight the first slice DC coefficient and the first slice AC coefficient in the first discrete cosine transform coefficient to obtain the first feature value. Among them, the expression of the slice feature value estimation function is as follows: ; Among them, refers to the first eigenvalue, refers to the first slice DC coefficient of the first grid slice n, refers to the first slice AC coefficient of the first grid slice n, refers to the th sub-block of the first grid slice n. a refers to the influence factor of the first slice DC coefficient on the first eigenvalue, b refers to the influence factor of the first slice AC coefficient on the first eigenvalue, where a + b = 1 and a is much larger than b.
5. The surface defect detection method for sheet metal parts before painting according to claim 1, characterized in that, When the first oil stain judgment result meets the predetermined surface oil stain constraint, perform painting control execution on the predetermined sheet metal part, including: Count the number of grid slices with the oil stain status flag of no oil stain in the first oil stain judgment result. Obtain the ratio of the number of grid slices to the total number of grid slices in the image preprocessing result, denoted as the first oil stain ratio. When the first oil stain ratio reaches the predetermined ratio threshold in the predetermined surface oil stain constraint, the first oil stain judgment result meets the predetermined surface oil stain constraint.
6. The surface defect detection method for a sheet metal part before painting according to claim 5, wherein When the first oil stain judgment result does not meet the predetermined surface oil stain constraint, retrieve the oil stain cleaning preplan to perform re-cleaning on the predetermined sheet metal part.
7. A surface defect detection system for sheet metal parts before painting, characterized in that, The system is used to implement a method for detecting surface defects of a sheet metal part before painting according to any one of claims 1 to 6. The system includes: A predetermined sheet metal part acquisition module, configured to acquire a predetermined sheet metal part, where the predetermined sheet metal part refers to any sheet metal part processed through an oil stain cleaning preplan. A sheet metal part surface image acquisition module, configured to process the predetermined sheet metal part according to a water film test preplan to obtain a post-water film sheet metal part, and acquire the surface image of the post-water film sheet metal part. A grid slice preprocessing module, configured to perform grid slice preprocessing on the surface image to obtain an image preprocessing result, where the image preprocessing result includes a first grid slice. An oil stain judgment module, configured to activate a surface oil stain successive judgment device to perform oil stain judgment on the first grid slice to obtain a first oil stain judgment result. A painting control execution module, configured to perform painting control execution on the predetermined sheet metal part when the first oil stain judgment result meets the predetermined surface oil stain constraint.
Citation Information
Patent Citations
Visual inspection method and system for surface defects of automobile sheet metal parts
CN116402742A
Product defect detection method, device, equipment, system and readable storage medium
CN117173107A