UV resin coating paint surface defect detection method and system

Through reflective point removal treatment and MSF-CRA-YOLOv5 neural network model, the problem of irregular surface defect detection is difficult and uncured and color uneven defect detection accuracy is insufficient in UV resin coating paint defect detection, achieving higher Detection accuracy and efficiency.

CN119313650AActive Publication Date: 2025-01-14TAIZHOU YIKAI PACKAGING CO LTD

Patent Information

Application Number
CN202411466879.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-01-14
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

The existing UV resin coating paint defect detection methods are difficult to effectively identify defects on irregular surfaces, especially surfaces with more reflective points, which leads to difficult defect detection and identification, and insufficient detection accuracy for uncured and uneven color defects. .

Method used

The image to be detected is obtained through the reflection point removal process, the similarity index and degree of difference of segmented images are calculated to determine the uncured and color uneven defects, and the MSF-CRA-YOLOv5 neural network model is established to detect and identify other defects, and finally collect all Defect information is used to analyze the paint quality.

Benefits of technology

Effectively suppresses strong light reflection areas, reduces noise interference, improves detection accuracy of uncured and uneven color defects, enhances the extraction of fine-grained features and the perception of global features, and improves the accuracy and efficiency of paint defect detection .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313650A_ABST
    Figure CN119313650A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of paint surface detection, in particular to a UV resin coating paint surface defect detection method and system.The method comprises the steps that a paint surface image set shot by light sources at different angles is subjected to reflective point removal treatment, and a fused to-be-detected image facilitating defect detection is obtained; segmenting the to-be-detected image of the paint surface before and after cleaning, calculating a similarity index of the segmented image, and detecting whether an uncured defect exists or not according to a preset similarity threshold value; acquiring and processing data of the segmented image to obtain a segmented region uniformity index, and detecting a color non-uniformity defect according to a preset threshold value; establishing an MSF-CRA-YOLOv5 model to carry out defect detection on the paint surface to be detected, wherein the defect detection comprises a defect type and a defect position; designing a plurality of loss functions in the total loss function, and designing a loss function in a prediction stage for accurate positioning of a bounding box; and finally obtaining a detection result and generating a detection report. According to the method provided by the invention, the efficiency of detecting the paint surface defects of the UV resin coating is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of paint surface detection, and in particular to a method and system for detecting paint surface defects of UV resin coatings. Background Art

[0002] UV resin coating is a type of coating that is cured by ultraviolet radiation. Unlike traditional coatings, it relies on the irradiation of ultraviolet light sources to carry out chemical reactions, causing the resin molecules to crosslink and cure to form a solid coating. This type of coating has a fast curing speed, is energy-saving and environmentally friendly, and is therefore widely used in a variety of industrial scenarios such as wood coating, packaging printing, and metal surface treatment.

[0003] Although UV resin coatings have many advantages, they may have some defects in their application. For example, if air is mixed into the curing process, bubbles may appear on the surface. The volume change of the coating during curing causes the coating to shrink, which may cause an uneven surface or cracking of the coating. When the coating has poor fluidity or is too thick, the coating may sag and form an uneven surface. Due to uneven UV irradiation, the coating in some areas may not be fully cured, resulting in a decrease in coating performance.

[0004] Existing UV resin coating surface defect detection methods mainly use optical detection, image processing, multi-spectral analysis and thickness measurement to identify defects such as bubbles, scratches, orange peel, sagging and particles. High-precision cameras, sensors and automated control systems are used to detect the surface quality of the coating in real time, and mechanical properties such as hardness and wear resistance are tested to ensure the stability of the coating performance. Most of the existing research focuses on defect detection on flat paint surfaces. For UV resin coating surfaces with irregular surfaces, there are many reflective points, and the surface contour easily interferes with defect identification. Defect detection and identification are difficult, and there is still room for exploration and research.

[0005] Therefore, a UV resin coating surface defect detection method and system are proposed. Summary of the invention

[0006] The purpose of the present invention is to provide a UV resin coating paint surface defect detection method and system, by removing reflective spots, obtaining a to-be-detected image that is more conducive to subsequent defect detection; by calculating the segmented image similarity index between the first segmented area and the second segmented area, judging whether there is an uncured defect; by calculating the difference between the segmented area and its adjacent segmented area, judging whether there is a color unevenness defect; establishing an MSF-CRA-YOLOv5 neural network model to detect and identify other defects such as bubbles and scratches; finally, collecting all defect information and establishing a defect data set to analyze and track the paint surface quality.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A UV resin coating paint surface defect detection method, comprising:

[0009] A first set of paint surface images of the paint surface to be detected is obtained and the reflective point removal process is performed to obtain a first image to be detected; the first set of paint surface images are paint surface images taken by light sources at different angles, and the reflective point removal process includes fusion and pixel correction of the paint surface images taken by light sources at different angles; a second set of paint surface images of the paint surface to be detected after solvent cleaning is obtained and the reflective point removal process is performed to obtain a second image to be detected; the first image to be detected and the second image to be detected are segmented in the same way to obtain a first segmented image set and a second segmented image set; data of the first segmented image set and the second segmented image set are obtained and processed to obtain a segmented image similarity index, and uncured defects are detected according to a preset similarity threshold.

[0010] Furthermore, the reflective spot removal process includes: obtaining the paint surface images taken at different angles of light sources at a fixed position, and the image set is recorded as {I(θ e )}, where e=1, 2,..., n, θ e represents the shooting angle, and n represents the number of the paint surface images; the paint surface images in the image set are fused to obtain a multi-light source fused image, and the pixel value of the pixel point in the multi-light source fused image is the pixel value with the lowest brightness among the pixel points at the corresponding position in all the paint surface images;

[0011] If the brightness value of the pixel point in the multi-light source fusion image exceeds a preset brightness threshold, the pixel value of the pixel point is reset to zero to obtain a zeroed pixel point; the pixel values ​​and corresponding weight values ​​of the adjacent pixel points of the zeroed pixel point are obtained and an improved bicubic interpolation formula is used to obtain an interpolated pixel point;

[0012] All the pixel points in the multi-light source fusion image are acquired and processed to obtain the image to be detected.

[0013] Further, the weight value includes: obtaining pixel values ​​of the adjacent pixel points and processing them to obtain the gradient of the adjacent pixel points; obtaining the gradient and processing them to obtain the gradient weight, which is used to adjust the weights of different pixel values ​​in the interpolation process;

[0014] Obtain pixel values ​​of the adjacent pixel points and use quadratic surface fitting to obtain a pixel surface function z(x,y) by least square method; obtain and process the pixel surface function to obtain a local surface fitting weight for adjusting the interpolation result to be more consistent with the shape of the local surface;

[0015] The gradient weight and the local surface fitting weight are obtained and processed to obtain a comprehensive weight, and the calculation formula of the comprehensive weight is:

[0016] ω(i,j)=eta1·ω1(i,j)+eta2·ω2(i,j);

[0017] Among them, ω(i,j) represents the comprehensive weight at (x+i,y+j), η1 represents the proportional coefficient of the gradient weight, η2 represents the proportional coefficient of the local fitting weight, ω1(i,j) represents the gradient weight at (x+i,y+j), ω2(i,j) represents the local surface fitting weight at (x+i,y+j), (x,y) represents the position of the zeroed pixel, and (x+i,y+j) represents the position of the adjacent pixel.

[0018] Furthermore, the detection of uncured defects includes: the number of images in the first segmented image set and the second segmented image set is G; the data of the g-th segmented image in the first segmented image set and the g-th segmented image in the second segmented image set are obtained and processed to obtain the segmented image similarity index; the g-th segmented image in the first segmented image set and the g-th segmented image in the second segmented image set are in the same position; if the segmented image similarity index is greater than the preset similarity threshold, the uncured defect exists in the second image to be detected.

[0019] The data of the second segmented image set is acquired and processed to obtain a segmented region uniformity index, and color non-uniformity defects are detected according to a preset uniformity threshold.

[0020] Furthermore, the detection of color unevenness defects includes: acquiring and processing data of the second segmented image set to obtain image features; acquiring and processing data of adjacent segmented images of the g-th segmented image in the second segmented image set to obtain weighted image features of the g-th segmented image, acquiring and processing the weighted image features and image features of the g-th segmented image to obtain a segmented area uniformity index; if the segmented area uniformity index is greater than a preset uniformity threshold, the g-th segmented image has a color unevenness defect.

[0021] An MSF-CRA-YOLOv5 neural network model is established to perform defect detection on the paint surface to be inspected, including defect type and location; the contour of the irregular surface is obtained and segmented to obtain a segmented contour set, and the segmented contour set and defect data set are obtained to establish a data set; the target confidence loss, classification loss and coordinate regression loss are obtained and processed to obtain a total loss function.

[0022] Furthermore, the data set includes:

[0023] Objects to be identified include: bubbles, sagging, orange peel texture, particle impurities, cracks, scratches and surface contours;

[0024] The surface contour is obtained, and curve fitting and segmentation processing are performed to obtain a segmented contour set; the segmentation includes obtaining the curvature of the fitting curve, and if the curvature exceeds a preset threshold, contour segmentation is performed; the segmented contour set and defect establishment data set are obtained.

[0025] Furthermore, the neural network model includes: a multi-scale feature fusion module that obtains and processes shallow features and deep features to obtain fused features for detecting tiny defects on the paint surface of UV resin paint; a residual module based on the attention mechanism, which adds the CBAM attention mechanism on the basis of the residual connection to capture the detailed features of key areas of the paint surface of UV resin paint.

[0026] Furthermore, the loss function includes: a target confidence loss function that minimizes the gap between the prediction and the true target, which is used to predict whether there is a defect; a classification loss function for defect classification tasks; and a coordinate loss function for optimizing the position and size of the bounding box;

[0027] The calculation formula of the total loss function is:

[0028] L total =λ1·L obj +λ2·L cls +λ3·L loc ;

[0029] Among them, L total represents the total loss function, λ1 represents the weight coefficient of the target confidence loss function, L obj represents the target confidence loss function, λ2 represents the weight coefficient of the classification loss function, L cls represents the classification loss function, λ3 represents the weight coefficient of the coordinate loss function, L loc represents the coordinate loss function;

[0030] The loss data is obtained and processed to obtain a prediction stage loss function for optimizing the position accuracy of the bounding box.

[0031] Obtain test results and generate test reports for paint quality tracking and analysis.

[0032] Furthermore, all defect information is recorded, including defect type, defect area, defect location and defect occurrence times, and sample defect data is generated based on all defect information for quality tracking and analysis of the paint surface.

[0033] A UV resin coating paint surface defect detection system, comprising:

[0034] An uncured defect detection module is used to obtain a first set of paint surface images of the paint surface to be detected and perform the reflective point removal process to obtain a first image to be detected; the first set of paint surface images are paint surface images taken by light sources at different angles, and the reflective point removal process includes fusion and pixel correction of the paint surface images taken by light sources at different angles; obtain a second set of paint surface images of the paint surface to be detected after solvent cleaning and perform the reflective point removal process to obtain a second image to be detected; perform the same segmentation on the first image to be detected and the second image to be detected to obtain a first segmented image set and a second segmented image set; obtain and process the data of the first segmented image set and the second segmented image set to obtain a segmented image similarity index, and detect uncured defects according to a preset similarity threshold;

[0035] A spraying unevenness detection module is used to obtain and process the data of the second segmented image set to obtain a segmented area uniformity index and detect color unevenness defects according to a preset uniformity threshold;

[0036] The defect detection module is used to establish an MSF-CRA-YOLOv5 neural network model to perform defect detection on the paint surface to be detected, including defect type and location; obtain the contour of the irregular surface and segment it to obtain a segmented contour set, obtain the segmented contour set and defect establishment data set; obtain target confidence loss, classification loss and coordinate regression loss and process them to obtain a total loss function;

[0037] The data analysis module obtains the test results and generates a test report for quality tracking and analysis of the paint surface to be tested.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] 1. Take images of light sources at different angles at a fixed position, and fuse the multi-light source images by obtaining the pixel with the lowest brightness value in the corresponding position of each image. This can effectively suppress strong light reflection areas, such as highlights or reflective points, and eliminate surface reflection problems caused by a single light source angle, which helps to obtain clearer paint surface images and reduce noise interference; process the highlight pixels in the fused image, and use the preset brightness threshold to return the pixels exceeding the threshold to zero, further eliminating overexposed or highly reflective areas on the fused image; use the improved bicubic interpolation formula, and when calculating the interpolation point, not only consider the pixel values ​​of the surrounding pixels, but also introduce pixel value gradient weights and local surface fitting weights. By considering these factors, a smoother and more continuous image can be generated, so that the interpolated image retains more local detail features.

[0040] 2. Aiming at the curing problem that is particularly present in UV resin coatings, the UV resin coating surface is cleaned with solvent, and then the paint surface images before and after cleaning are compared, and the similarity is calculated to analyze and detect the insufficient curing defects of the UV resin coating surface; the uncured area may have different performances after solvent cleaning, such as softening, discoloration or dissolution, and the image of the uncured area will be more different from the area before cleaning, and the uncured area will appear more prominent and easier to detect; by uniformly segmenting and analyzing the images at the same position before and after processing, the segmented image similarity index is used to detect the uncured area, and the uncured defective area can be located more accurately.

[0041] 3. An improved YOLOv5 model is used to detect and identify paint defects. In order to overcome the problems of insufficient feature extraction capability and unsatisfactory feature integration during defect detection and identification, a residual module is introduced to reduce the loss of defect information during layered transmission, thereby enhancing the extraction of fine-grained features and improving the perception of details and global features. By introducing parameter weights in the loss function, the overlapping area, center point distance, aspect ratio and other features of the bounding box in different scenes can be adjusted to make the model more flexible during training. Two improved loss functions are proposed, which are used in the model training and prediction stages respectively, which improve the stability and generalization of the positioning accuracy of the bounding box during the training process, and help the model further improve the position accuracy of the prediction box. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A schematic flow chart of a UV resin coating surface defect detection method provided in Example 1 of the present invention;

[0043] Figure 2 A schematic diagram of a process for removing reflective spots provided in Example 1 of the present invention;

[0044] Figure 3 A schematic diagram of a feature fusion method provided in Example 1 of the present invention;

[0045] Figure 4 A schematic diagram of the structure of a CRA module provided in Example 1 of the present invention;

[0046] Figure 5 This is a schematic structural diagram of a UV resin coating surface defect detection system provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] Example 1

[0049] A certain automobile manufacturer uses colored UV coatings for the exterior and interior parts of the car body. These coatings can be formulated into different colors as needed to provide different visual effects for the car, and have properties such as wear resistance, scratch resistance, and corrosion resistance. Black, metallic, matte, and other customized colors are usually used for door handles, rearview mirror housings, decorative strips, and other parts to enhance the appearance. In order to detect whether the automobile parts covered with UV coatings have defects, a UV resin coating paint surface defect detection method provided by the present invention is introduced. The specific process is as follows: Figure 1 shown.

[0050] Step S1: First, a multi-light source image fusion processing method is proposed. The process is as follows: Figure 2 The paint surface images taken by light sources at different angles are obtained and the reflective point removal process is performed on the paint surface images to obtain the image to be detected. The reflective point removal process includes the fusion of the paint surface images taken by light sources at different angles and the correction of pixel points.

[0051] Further, the paint surface images taken at different angles of light sources at a fixed position are obtained, and the image set is recorded as {I(θ i )}, where i=1, 2,..., n, θ i represents the shooting angle; the paint surface images in the image set are fused to obtain a multi-light source fused image, the pixel value of the pixel point in the multi-light source fused image is the pixel value with the lowest brightness among the pixel points at the corresponding position in all the paint surface images, and the calculation formula is:

[0052]

[0053] in, Indicates the multi-light source fusion image The pixel value at the position, represents the pixel value at the (x, y) position in the i-th paint surface image, min D () represents the pixel value corresponding to the pixel point with the smallest brightness value at the (x, y) position.

[0054] If the brightness value of the pixel in the multi-light source fusion image exceeds the preset brightness threshold, the pixel value of the pixel is reset to zero to obtain a zeroed pixel, and the position is (x, y); the pixel values ​​and corresponding weight values ​​of the adjacent pixels of the zeroed pixel are obtained and the improved bicubic interpolation formula is used to obtain the interpolated pixel; the calculation formula of the improved bicubic interpolation formula is:

[0055]

[0056] Among them, I new (x,y) represents the new pixel value at (x,y), p(i) and p(j) represent the weight functions of standard bicubic interpolation, I(x+i,y+j) represents the pixel value of the pixel at the position (x+i,y+j), and ω(i,j) represents the comprehensive weight at the position (x+i,y+j).

[0057] All the pixel points in the multi-light source fusion image are acquired and the above operation is performed to obtain a first image to be detected.

[0058] Taking images at a fixed angle is conducive to subsequent image calibration and fusion; taking images of light sources at different angles and fusing multi-light source images by obtaining the pixel with the lowest brightness value among the pixels at the corresponding position of each image can effectively suppress the strong light reflection area; further processing the highlight pixels in the fused image, using the preset brightness threshold to reset the pixels exceeding the threshold to zero, and further eliminating the highlight area on the fused image; using the improved bicubic interpolation formula, a smoother and continuous image can be generated, so that the final image to be detected retains more local detail features.

[0059] The pixel values ​​of the adjacent pixel points are obtained and processed to obtain the gradient of the adjacent pixel points; the gradient is obtained and processed to obtain a gradient weight, which is used to adjust the weights of different pixel values ​​in the interpolation process; the calculation formula of the gradient weight function is:

[0060]

[0061] Wherein, ω1(i,j) represents the gradient weight at (x+i,y+j), α1 represents the control coefficient of the gradient weight, and G(x+i,y+j) represents the gradient at (x+i,y+j);

[0062] The pixel values ​​of the adjacent pixels are obtained and quadratic surface fitting is used to obtain the pixel surface function z(x, y) by the least square method; the pixel surface function is obtained and processed to obtain the local surface fitting weight, which is used to adjust the interpolation result to be more consistent with the shape of the local surface; the calculation formula of the local surface fitting weight is:

[0063]

[0064] Wherein, ω2(i,j) represents the local surface fitting weight at (x+i,y+j), α2 represents the control coefficient of the local surface fitting weight, and z(x,y) represents the pixel surface value at (x+i,y+j);

[0065] The gradient weight and the local surface fitting weight are obtained and processed to obtain a comprehensive weight, and the calculation formula of the comprehensive weight is:

[0066] ω(i,j)=eta1·ω1(i,j)+eta2·ω2(i,j);

[0067] Wherein, ω(i,j) represents the comprehensive weight, η1 represents the proportional coefficient of the gradient weight, and η2 represents the proportional coefficient of the local surface fitting weight;

[0068] The gradient weight can avoid excessive smoothing of edges or mutation areas during the interpolation process, making the interpolation result more consistent with the actual surface characteristics; the local surface fitting weight takes into account the surface height difference around the target point, making the interpolation result more consistent with the local shape of the surface; the improved bicubic interpolation method based on gradient weight and local surface fitting weight can more intelligently adjust the weights of different pixels in the interpolation process, thereby reducing the interpolation error and optimizing the interpolation result.

[0069] Step S2: obtaining a first set of paint surface images of the paint surface to be detected and performing the reflective point removal process to obtain a first image to be detected; the first set of paint surface images are paint surface images taken by light sources at different angles, and the reflective point removal process includes fusion and pixel correction of the paint surface images taken by light sources at different angles; obtaining a second set of paint surface images of the paint surface to be detected after solvent cleaning and performing the reflective point removal process to obtain a second image to be detected; performing the same segmentation on the first image to be detected and the second image to be detected to obtain a first segmented image set and a second segmented image set; obtaining and processing the data of the first segmented image set and the second segmented image set to obtain a segmented image similarity index, and detecting uncured defects according to a preset similarity threshold;

[0070] Furthermore, the detection of uncured defects includes: the number of images in the first segmented image set and the second segmented image set is G; the data of the g-th segmented image in the first segmented image set and the g-th segmented image in the second segmented image set are obtained and processed to obtain the segmented image similarity index; the g-th segmented image in the first segmented image set and the g-th segmented image in the second segmented image set are in the same position; if the segmented image similarity index is greater than the preset similarity threshold, the uncured defect exists in the second image to be detected.

[0071] Furthermore, the calculation formula of the segmented image similarity index is:

[0072]

[0073] Among them, XSD represents the similarity index of the segmented image, P represents the pixel height of the segmented image, Q represents the pixel width of the segmented image, I1(p,q) represents the pixel value of the first segmented image at the (p,q) position, and I2(p,q) represents the pixel value of the second segmented image at the (p,q) position.

[0074] Furthermore, the segmented image similarity index is calculated for the segmented images in the first segmented image set and the segmented images in the second segmented image set at the corresponding position, and the presence of uncured defects is determined according to a preset similarity threshold. After calculation, the presence rate of uncured defects on the paint surface of the automobile parts produced in the batch is 0.01%, and there is basically no uncured defect on the paint surface.

[0075] The insufficient curing defects of UV resin coatings are detected by comparing and similarity analyzing the images after solvent treatment. Since the uncured areas may show different performances after solvent cleaning, such as softening, discoloration or dissolution, the performance of the uncured areas will be more obvious than that of the cured areas. Therefore, when comparing the images before and after, the uncured areas will appear more prominent and easier to detect. The uncured areas are detected by uniformly segmenting and analyzing the images at the same position before and after treatment, and the segmented image similarity index is used to more accurately locate the uncured defective areas.

[0076] Step S3: acquiring and processing data of the second segmented image set to obtain weighted uniformity, and detecting color unevenness defects according to a preset uniformity threshold;

[0077] Further, the data of the second segmented image set is obtained and processed to obtain image features; the image features include brightness, hue and saturation, etc.; the data of the adjacent segmented images of the g-th segmented image in the second segmented image set is obtained and processed to obtain the weighted image features of the g-th segmented image, the weighted image features and the image features of the g-th segmented image are obtained and processed to obtain the segmented area uniformity index, if the segmented area uniformity index is greater than the preset uniformity threshold, then the g-th segmented image has the color unevenness defect. The calculation formula of the segmented area uniformity index is:

[0078]

[0079] Wherein, JYD represents the uniformity index of the segmented region, H represents the number of image features, and f hrepresents the hth image feature of the segmented image, A represents the number of adjacent segmented images, represents the hth image feature of the ath adjacent segmented image, k a It represents the weight coefficient of the ath adjacent segmented image. According to calculation, the color unevenness defect rate of the batch-produced automobile parts is 0.01%, and there is basically no paint color unevenness defect, which meets the quality requirements.

[0080] When judging whether there is a color unevenness defect in the area to be inspected, it does not only rely on the data of a single area, but combines the overall situation of adjacent areas, reducing the error caused by isolated data and enhancing the perception of local tiny unevenness; by calculating the color uniformity of each segmented area and combining the weighted image features of the adjacent areas, it can accurately capture the color unevenness in the area to be inspected, effectively improving the detection accuracy of surface color unevenness defects on UV resin coatings.

[0081] Step S4: Establish an MSF-CRA-YOLOv5 neural network model to perform defect detection on the paint surface to be inspected, including defect type and location; obtain the contour of the irregular surface and segment it to obtain a segmented contour set, obtain the segmented contour set and defect establishment data set; obtain the target confidence loss, classification loss and coordinate regression loss and process them to obtain a total loss function.

[0082] Further, in the data set, the objects to be identified include: bubbles, sagging, orange peel texture, particle impurities, cracks, scratches and surface contours;

[0083] The surface contour is obtained, and curve fitting and segmentation processing are performed to obtain a set of segmented contours; the segmentation processing includes obtaining the curvature of the fitting curve, and if the curvature exceeds a preset curvature threshold, contour segmentation is performed; the segmented contour set and defects are obtained, and a data set is further established.

[0084] The complex contour features of irregular surfaces often interfere with defect detection, especially when there are complex textures or patterns on the surface. Through curvature segmentation, the complex contour is decomposed into several smaller parts, so that each part can be analyzed independently, thereby reducing the interference of complex surface features on defect detection.

[0085] Furthermore, the improvements of the neural network model include: a multi-scale feature fusion strategy to obtain shallow features and deep features and process them to obtain fused features for detecting tiny defects; a residual module based on an attention mechanism, which adds a CBAM attention mechanism on the basis of residual connection, to capture the detailed features of key areas of the UV resin paint surface.

[0086] Furthermore, the basic framework of the YOLOv5 model consists of three parts:

[0087] Backbone: CSP and SPPF modules are used for feature extraction. CSP processes the input features into two paths, retaining more original feature information while reducing redundancy.

[0088] Neck: Multi-scale feature fusion is achieved through the Path Aggregation Network (PAN), ensuring the effective transfer of feature information from high-level semantics to low-level details.

[0089] YOLO Head: defines the prediction box and makes classification predictions while accurately locating the bounding box through regression.

[0090] The original structure of the YOLOv5 model already has a certain multi-scale feature processing capability, and uses feature pyramids (FPN networks) and PAN to achieve the combination of shallow and deep features. Since different levels of the pyramid contain target information of specific sizes, current feature fusion methods usually ignore the high-resolution shallow layers, making it difficult to detect small targets. The improved YOLOv5 further improves the effect of feature fusion by introducing a more advanced multi-scale feature fusion strategy.

[0091] The multi-scale feature fusion strategy (MSF) includes:

[0092] The input image undergoes multiple convolutions and downsampling to generate feature maps of different scales (P1, P2, P3 and P4). The shallow feature extraction (P1 feature map) contains high-resolution information and retains more spatial details, which is particularly suitable for detecting small targets; the deep feature extraction (P2, P3 and P4 feature maps) contains rich semantic information and is suitable for the detection and classification of large targets.

[0093] Through upsampling and downsampling, shallow and deep feature maps are fused at different resolutions. High-resolution feature maps are fused layer by layer with low-resolution feature maps, allowing the model to handle objects of different sizes; fusion methods such as Figure 3 As shown in the figure, it is divided into feature layer-by-layer fusion and feature fusion respectively.

[0094] Based on the fused feature map, object detection and bounding box regression are performed.

[0095] The second improvement is the introduction of the residual module CRA based on the attention mechanism. The CBAM attention mechanism is added on the basis of the residual connection to enhance the feature extraction capability and reduce information loss. The attention mechanism is used to improve the perception ability of key areas, so that the model can better capture the detailed features of key areas.

[0096] The structure of the CRA module is as follows Figure 4As shown, including:

[0097] First, the input feature map is divided into two paths through the CSP structure. One path extracts and enhances features through a series of convolutions, residual connections, and the CBAM attention mechanism. The other path keeps the original features and fuses them with the features of the first path through cross-stage fusion to generate the enhanced feature map P2. Similarly, feature maps P3 and P4 are generated.

[0098] Furthermore, in the CRA module, the residual connection structure is used to maintain the continuous transmission of information while avoiding the gradient vanishing problem; the residual structure helps to reduce the optimization difficulties brought by the deep network and make the training more stable; the CBAM module consists of channel attention and spatial attention, which can adaptively assign different weights to different features. Channel attention enhances the feature expression ability between different channels, while spatial attention ensures that the model pays more attention to important spatial positions through weight adjustment; the processed features are fused with the original features in the CSP path to obtain an enhanced feature map. This combination can effectively retain the original information while optimizing the features of key areas through the attention mechanism.

[0099] Furthermore, the CRA module is embedded in the Backbone part of the YOLOv5 model. The CRA module enhances the multi-scale features extracted from the image by processing at a specific level, thereby improving the model's ability to capture detailed information.

[0100] The design of this network structure can effectively improve the accuracy, robustness and efficiency of target detection through multi-scale feature extraction, channel and spatial attention mechanism, feature aggregation and fusion, etc. It is suitable for detecting multi-scale targets in complex scenes, especially in real-time application scenarios, and can achieve efficient detection while ensuring accuracy.

[0101] Furthermore, the loss function includes: a target confidence loss function that minimizes the gap between the prediction and the true target, used to predict whether the target exists; a classification loss function for classification tasks; a coordinate loss function for optimizing the position and size of the bounding box;

[0102] The target confidence loss minimizes the gap between the prediction and the true target, allowing the model to correctly predict whether there is an object in the image;

[0103]

[0104] Among them, L obj represents the target confidence loss, S 2 represents the number of grids, B represents the number of anchor boxes preset in each grid unit, Indicates that if the target is in the bth anchor box of the sth grid, the value is 1, otherwise it is 0; represents the true target confidence in the sth grid, C s Represents the target confidence predicted in the sth grid;

[0105] The classification loss function is used for classification tasks to ensure that the network can correctly classify the target;

[0106]

[0107] Among them, L obj represents the classification loss, c represents the category label of the target, and classes represents the target category. represents the true category probability in the sth grid, P s (c) represents the predicted category probability in the sth grid;

[0108] The coordinate loss function is used to optimize the position and size of the bounding box by combining the intersection-over-union ratio, center point distance, and aspect ratio;

[0109]

[0110] Among them, L loc represents the coordinate loss, IoU represents the intersection over union ratio, ρ(b,b re ) is used to measure the predicted box b and the real box b re The Euclidean distance between the center points of , m represents the length of the image diagonal, γ represents the hyperparameter for measuring the aspect ratio, v represents the similarity measure of the aspect ratio (i.e., the difference in the aspect ratio between the predicted box and the true box), and μ represents the adjustment coefficient;

[0111] The calculation formula of the total loss function is:

[0112] L total =λ1·L obj +λ2·L cls +λ3·L loc ;

[0113] Among them, L total represents the total loss function, λ1 represents the weight coefficient of the target confidence loss function, L obj represents the target confidence loss function, λ2 represents the weight coefficient of the classification loss function, L cls represents the classification loss function, λ3 represents the weight coefficient of the coordinate loss function, L loc represents the coordinate loss function;

[0114] Furthermore, in the prediction stage, the loss function still plays an important role. In the prediction stage, the model may generate multiple candidate boxes. In order to select the most suitable box, it is necessary to score these candidate boxes according to some criteria. The improved loss function L D-loc No longer forcing the aspect ratio to be considered, the distance and overlap between the candidate box and the true target box can be better measured, which can help the model make more accurate bounding box selection during the prediction process.

[0115] Furthermore, loss data is obtained and processed to obtain a prediction stage loss function, which is used to optimize the position accuracy of the bounding box in the prediction stage; the loss data includes the intersection-over-union ratio, the distance between the center point of the prediction box and the true target box, and the diagonal length; the calculation formula of the prediction stage loss function is:

[0116]

[0117] Among them, L D-loc represents the loss function in the prediction stage, and μ represents the adjustment coefficient.

[0118] Table 1. Model evaluation

[0119] Defect Type Accuracy Recall Intersection and Union F1-Score bubble 95.67% 93.43% 0.92 94.57 Scratches 97.32% 96.19% 0.95 96.72 Orange peel texture 93.82% 91.76% 0.90 92.26 Sagging 94.57% 92.82% 0.91 93.32 Cracking 96.32% 95.07% 0.94 95.63 Particle impurities 92.79% 91.25% 0.89 91.14 Average performance index 95.47% 93.84% 0.92 94.01

[0120] Table 1 lists the performance indicators such as detection accuracy, recall rate and intersection over union ratio for different defect types, which are used to evaluate the performance of the model. The data show that the model provided by the present invention can perform defect detection very well. Two improved IoU loss functions are used in the model training and prediction stages respectively; the loss function designed for the bounding box regression problem in object detection in the training stage not only considers the overlapping area between the bounding boxes, but also introduces the center point distance and aspect ratio to comprehensively optimize the positioning of the bounding box; the adjustment coefficient μ is added to further optimize the overlapping area, center point distance and aspect ratio of the bounding box, which can better balance the optimization between accuracy and position during the training process, and improve the stability of the positioning accuracy of the bounding box during the training process; the loss function in the prediction stage focuses on helping the model further improve the position accuracy of the prediction box.

[0121] Step S5: Obtain the test results and generate a test report for quality tracking and analysis of the paint surface.

[0122] Furthermore, all defect information is recorded, including defect type, defect area, defect location and defect occurrence frequency, and sample defect data is generated based on all defect information for quality tracking and analysis of the paint surface. The quality compliance rate of this batch of auto parts is 98.45%. Through defect detection of this batch of auto parts, it can be found that the main defect problem is concentrated on scratches. In the future production process, the automobile manufacturer should adjust the production method according to the frequency of defect occurrence.

[0123] By comprehensively recording and analyzing the defect information of UV resin coatings, recording detailed defect types, areas, locations and occurrences, the coating quality can be monitored in an all-round way. Based on the sample defect data set, the defect trend can be tracked, and the changing patterns of different defects over time or production batches can be understood, providing a basis for accurate tracking and improvement of product quality.

[0124] The present invention first proposes a method for multi-light source image fusion, generates a fused image using the minimum brightness value of the pixel point at each position, then further removes the highlight points using a preset brightness threshold, and finally fills the highlight points using an improved bicubic interpolation formula, finally obtaining an image to be detected that is conducive to subsequent detection and retains more image features; a segmented image similarity index is designed for uncured defects unique to UV resin coatings to detect uncured areas and more accurately locate the positions of uncured defects; for color uneven defects, image features are extracted to calculate the segmented area uniformity index, effectively improving the detection accuracy of surface color uneven defects on UV resin coatings; for other defects, an MSF-CRA-YOLOv5 neural network model is established for identification and detection, and different loss functions are designed for accurate positioning of defect positions. Through the above operations, the present invention provides a defect detection method for UV resin coatings, which improves the efficiency of automobile manufacturers in quality inspection.

[0125] Example 2

[0126] A cosmetics company uses UV coating on its outer packaging to increase gloss and texture. The surfaces of these packaging boxes are often curved or irregular. In order to identify problems such as uneven gloss, scratches, and defects on the packaging surface and ensure the beauty and integrity of the packaging, a UV resin coating paint surface defect detection system is applied. The system structure is as follows: Figure 5 shown.

[0127] First, the production line sets up multiple light sources at different angles to shoot fixed positions on the surface of the outer packaging. This multi-angle light source setting ensures that various defects on the paint surface can be fully captured when inspecting smooth reflective surfaces, including bubbles, scratches, uneven gloss, etc. In order to reduce the interference caused by a single light source angle, multi-angle shooting and light source fusion technology are used to fuse images taken at different angles, select the lowest brightness value of each pixel point, and effectively remove over-reflective areas. This reflective point removal process further optimizes the image quality through an adaptive interpolation algorithm to ensure that subsequent analysis is not interfered by bright spots. The brightness range of the processed image is significantly reduced compared to the image before processing, and the interpolation algorithm greatly improves the smoothness of the image.

[0128] Furthermore, when performing the highlight removal operation in the fused image, by introducing a dynamic threshold, the thresholds of different areas can be automatically adjusted according to the local lighting conditions, thereby reducing misjudgments caused by overly bright or dark areas.

[0129] Furthermore, the dynamic threshold in the highlight removal process in the fused image can be calculated based on the pixel brightness values ​​around the target pixel to ensure the adaptability of the threshold in different areas. Usually, the dynamic threshold is adjusted based on the statistical characteristics of the local area, such as the local mean and standard deviation, and the calculation formula is as follows:

[0130] T(x′,y′)=μ′(x′,y′)+k·σ′(x′,y′);

[0131] Among them, T(x′, y′) represents the dynamic threshold at the position (x′, y′), μ′(x′, y′) represents the mean brightness of the neighborhood pixels at the position (x′, y′), k represents the adjustment coefficient, and σ′(x′, y′) represents the standard deviation of the brightness of the neighborhood pixels at the position (x′, y′).

[0132] Furthermore, an n×n window area is selected at the position (x′, y′), and the typical window size is 3×3 or 5×5; the calculation formula of the brightness mean in the window is:

[0133]

[0134] Among them, I(x′+i′,y′+j′) represents the brightness value of the area pixel, and n×n represents the window size.

[0135] Furthermore, the calculation formula for the brightness standard deviation in the window is:

[0136]

[0137] Furthermore, the dynamic threshold T(x′, y′) is calculated by using the mean and standard deviation and adjusting the coefficient k.

[0138] Next, after the initial inspection, the surface of the outer packaging will be cleaned with a solvent, usually isopropyl alcohol. This step not only removes residual impurities on the surface, but also reveals uncured coating defects. By photographing the cleaned surface again, the image is captured using the same multi-angle light source, and then compared and analyzed with the image before cleaning. During the comparison process, the system first divides the image evenly, and then detects whether there are uncured areas by calculating the similarity index of each segmented area. The lower the similarity index, the smaller the change in the coating, and the rate of uncured defects is 0.99%, indicating that the production process needs to be improved and the lighting time needs to be adjusted.

[0139] In addition to detecting the uncured areas, the system also identifies and processes the color-uneven areas in the image. By processing the image features of each segmented area and calculating the segmented area uniformity index, the system can detect areas with uneven colors. The lower the uniformity index, the more uniform the coating color distribution in the area. The results show that the color-uneven defect area accounts for about 1.45%, indicating that the spraying process needs to be improved urgently.

[0140] In order to improve the accuracy of defect detection, the system also uses the MSF-CRA-YOLOv5 neural network model for defect identification. The model combines multi-scale feature fusion and attention mechanism residual blocks to accurately identify various types of defects, including bubbles, scratches, orange peel textures, and sagging. The test results are shown in Table 2. The model achieved a detection accuracy of 98.54% and maintained a recall rate of 97.58% with a processing time of only 25 milliseconds per image. After processing, the model generates a detailed inspection report, which contains detailed information such as the type, area, location, and number of occurrences of each defect. The analysis report shows that the defects are mainly concentrated in the lower left corner of the image, and the company can adjust the production method based on the location of the defects.

[0141] Table 2. Test results

[0142] Defect Type Detection accuracy Recall Scratches 98.92% 97.54% Particle impurities 98.13% 97.20% Cracking 99.02% 98.27% average value 98.54% 97.58%

[0143] This defect detection process provides a strong quality assurance for the production of cosmetic packaging. By analyzing and tracking coating defect information, companies can promptly identify quality problems in production, further improve production processes, and enhance the overall appearance quality and market competitiveness of products.

[0144] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A UV resin coating paint surface defect detection method, characterized in that: include: A first set of paint surface images of the paint surface to be detected is obtained and a reflective point removal process is performed to obtain a first image to be detected; the first set of paint surface images is a set of paint surface images taken by light sources at different angles, and the reflective point removal process includes the fusion of the paint surface images taken by light sources at different angles and pixel correction; a second set of paint surface images of the paint surface to be detected after solvent cleaning is obtained and a reflective point removal process is performed to obtain a second image to be detected; the first image to be detected and the second image to be detected are segmented in the same manner to obtain a first segmented image set and a second segmented image set; data of the first segmented image set and the second segmented image set are obtained and processed to obtain a segmented image similarity index, and uncured defects are detected according to a preset similarity threshold; Acquire and process the data of the second segmented image set to obtain a segmented region uniformity index, and detect color unevenness defects according to a preset uniformity threshold; Establishing an MSF-CRA-YOLOv5 neural network model to perform defect detection on the paint surface to be inspected, including defect type and location; obtaining the contour of the irregular surface and performing segmentation to obtain a segmented contour set, obtaining the segmented contour set and defect establishment data set; obtaining target confidence loss, classification loss and coordinate regression loss and processing them to obtain a total loss function; The test results are obtained and a test report is generated for quality tracking and analysis of the paint surface to be tested.

2. A UV resin coating paint surface defect detection method according to claim 1, characterized in that: The reflective spot removal process comprises: The paint surface images taken at different angles of light source at a fixed position are obtained, and the image set is recorded as {I(θ e )}, where e=1, 2,..., n, θ e represents the shooting angle, and n represents the number of the paint surface images; the paint surface images in the image set are fused to obtain a multi-light source fused image, and the pixel value of the pixel point in the multi-light source fused image is the pixel value with the lowest brightness value among the pixel points at the corresponding position in all the paint surface images; If the brightness value of the pixel point in the multi-light source fusion image exceeds a preset brightness threshold, the pixel value of the pixel point is reset to zero to obtain a zeroed pixel point; the pixel values ​​and corresponding weight values ​​of the adjacent pixel points of the zeroed pixel point are obtained and an improved bicubic interpolation formula is used to obtain an interpolated pixel point; All the pixel points in the multi-light source fusion image are acquired and processed to obtain an image to be detected.

3. A UV resin coating paint surface defect detection method according to claim 2, characterized in that: The weight values ​​include: Obtaining and processing the pixel values ​​of the adjacent pixel points to obtain the gradients of the adjacent pixel points; obtaining and processing the gradients to obtain gradient weights for adjusting the weights of different pixel values ​​in the interpolation process; Obtain pixel values ​​of the adjacent pixel points and use quadratic surface fitting to obtain a pixel surface function z(x,y) by least square method; obtain and process the pixel surface function to obtain a local surface fitting weight for adjusting the interpolation result; The gradient weight and the local surface fitting weight are obtained and processed to obtain a comprehensive weight, and the calculation formula of the comprehensive weight is: ω(i,j)=eta1·ω1(i,j)+eta2·ω2(i,j); Among them, ω(i,j) represents the comprehensive weight at (x+i,y+j), η1 represents the proportional coefficient of the gradient weight, η2 represents the proportional coefficient of the local surface fitting weight, ω1(i,j) represents the gradient weight at (x+i,y+j), ω2(i,j) represents the local surface fitting weight at (x+i,y+j), (x,y) represents the position of the zeroed pixel, and (x+i,y+j) represents the position of the adjacent pixel.

4. A UV resin coating surface defect detection method according to claim 1, characterized in that: The detecting of uncured defects comprises: The number of images in the first segmented image set and the second segmented image set are both G; data of the g-th segmented image in the first segmented image set and the g-th segmented image in the second segmented image set are obtained and processed to obtain the segmented image similarity index; the g-th segmented image in the first segmented image set and the g-th segmented image in the second segmented image set are in the same position; if the segmented image similarity index is greater than the preset similarity threshold, the uncured defect exists in the second image to be detected.

5. The UV resin coating surface defect detection method according to claim 1, characterized in that: The detection of color unevenness defects includes: Acquire and process data of the second segmented image set to obtain image features; acquire and process data of adjacent segmented images of the g-th segmented image in the second segmented image set to obtain weighted image features of the g-th segmented image; acquire and process the weighted image features and image features of the g-th segmented image to obtain the segmented area uniformity index; if the segmented area uniformity index is greater than the preset uniformity threshold, the i-th segmented image has the color unevenness defect.

6. A UV resin coating surface defect detection method according to claim 1, characterized in that: The dataset includes: The contour is obtained, and curve fitting and segmentation processing are performed to obtain a set of segmented contours; the segmentation processing includes obtaining the curvature of the fitting curve, and if the curvature exceeds a preset curvature threshold, contour segmentation is performed; the segmented contour set and the defects are obtained to establish a data set, and the defects include: bubbles, sagging, orange peel texture, granular impurities, cracks and scratches.

7. A UV resin coating surface defect detection method according to claim 1, characterized in that: The loss function includes: The target confidence loss function minimizes the gap between the prediction and the true target and is used to predict whether there is a defect. The classification loss function is used for defect classification tasks. The coordinate loss function is used to optimize the position and size of the defect bounding box. The calculation formula of the total loss function is: L total =λ1·L obj +λ2·L cls +λ3·L loc ; Among them, L total represents the total loss function, λ1 represents the weight coefficient of the target confidence loss function, L obj represents the target confidence loss function, λ2 represents the weight coefficient of the classification loss function, L cls represents the classification loss function, λ3 represents the weight coefficient of the coordinate loss function, L loc Denotes the coordinate loss function.

8. The UV resin coating surface defect detection method according to claim 1, characterized in that: The loss function also includes: acquiring and processing loss data to obtain a prediction stage loss function for optimizing the position accuracy of the bounding box, wherein the loss data includes an intersection-over-union ratio, a distance between the center points of the predicted box and the true target box, and a diagonal length of the box.

9. A UV resin coating paint surface defect detection method according to claim 1, characterized in that: Also includes: All defect information is recorded, including defect type, defect area, defect location and defect occurrence frequency, and sample defect data is generated based on all defect information for quality tracking and analysis of the paint surface to be tested.

10. A UV resin coating surface defect detection system, characterized in that: include: An uncured defect detection module is used to obtain a first set of paint surface images of the paint surface to be detected and perform a reflective point removal process to obtain a first image to be detected; the first set of paint surface images are paint surface images taken by light sources at different angles, and the reflective point removal process includes the fusion of the paint surface images taken by light sources at different angles and pixel correction; obtain a second set of paint surface images of the paint surface to be detected after solvent cleaning and perform the reflective point removal process to obtain a second image to be detected; perform the same segmentation on the first image to be detected and the second image to be detected to obtain a first segmented image set and a second segmented image set; obtain and process the data of the first segmented image set and the second segmented image set to obtain a segmented image similarity index, and detect uncured defects according to a preset similarity threshold; A spraying unevenness detection module is used to obtain and process the data of the second segmented image set to obtain a segmented area uniformity index and detect color unevenness defects according to a preset uniformity threshold; The defect detection module is used to establish an MSF-CRA-YOLOv5 neural network model to perform defect detection on the paint surface to be detected, including defect type and location; obtain the contour of the irregular surface and segment it to obtain a segmented contour set, obtain the segmented contour set and defect establishment data set; obtain target confidence loss, classification loss and coordinate regression loss and process them to obtain a total loss function; The data analysis module obtains the test results and generates a test report for quality tracking and analysis of the paint surface to be tested.

Citation Information

Patent Citations

  • Rapid detection method for paint film solidifying degree of polyurethane enameled wire

    CN103528947A

  • Method, device and equipment for detecting paint spraying uniformity of keys and readable storage medium

    CN114511545A

  • Vehicle paint defect detection and segmentation integrated method based on YOLOv5 framework

    CN116245843A

  • Fabric defect detection method based on deep convolutional neural network and visual saliency

    WO2019104767A1

Cited By

  • Deep learning-based can making defect detection method, system and equipment

    CN120471892A

  • Mobile phone rear cover defect automatic detection method and system based on machine vision

    CN120495260A

  • Furniture surface paint spraying defect detection method based on vision

    CN120543521A

  • Visual detection method and system for coating coverage uniformity

    CN122089739A

  • A visual inspection method and system for coating uniformity

    CN122089739B