A UV resin coating paint surface defect detection method and system

Through multi-light source image fusion and improved YOLOv5 neural network model, the problem of reflective point interference in the detection of paint defects of UV resin coatings is solved, and the accurate detection of uncured and color uneven defects is achieved, which improves detection efficiency and accuracy.

CN119313650BActive Publication Date: 2025-08-19TAIZHOU YIKAI PACKAGING CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing UV resin coating paint defect detection methods are difficult to effectively identify the interference of reflective spots on irregular surfaces, which makes it difficult to detect and identify defects, especially on complex surfaces, which are difficult to accurately detect defects such as bubbles and scratches.

Method used

The multi-light source image fusion and improved YOLOv5 neural network model are adopted to enhance feature extraction capabilities through reflective point removal processing, segmented image similarity analysis and color inhomogeneity detection, combined with the MSF-CRA-YOLOv5 neural network model, and multi-scale feature fusion and attention mechanism are used to enhance feature extraction capabilities.

Benefits of technology

It effectively suppresses the interference of reflective points, improves the detection accuracy of uncured and uneven color defects, enhances the perception of details and global features, and improves the accuracy and efficiency of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313650B_ABST
    Figure CN119313650B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of paint surface detection, specifically a UV resin coating paint surface defect detection method and system, comprising: performing a reflective point removal process on a set of paint surface images taken from light sources at different angles to obtain a fused image to be detected that is conducive to defect detection; segmenting the paint surface to be detected before and after cleaning and calculating the segmented image similarity index, and detecting whether there are uncured defects based on a preset similarity threshold; obtaining and processing data of the segmented image to obtain a segmented area uniformity index, and detecting color unevenness defects based on a preset threshold; establishing an MSF-CRA-YOLOv5 model to perform defect detection on the paint surface to be detected, including defect type and location; designing multiple loss functions in the total loss function, and designing a loss function in the prediction stage for accurate positioning of the bounding box; finally, obtaining the detection results and generating a detection report. The present invention improves the efficiency of UV resin coating paint surface defect detection by providing the above method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present 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 coatings are a type of coating that cures through ultraviolet radiation. Unlike traditional coatings, they rely on ultraviolet light to initiate a chemical reaction, crosslinking and curing the resin molecules to form a durable coating. These coatings cure quickly, are energy-efficient, and are environmentally friendly, making them widely used in a variety of industrial applications, including wood coating, packaging and printing, and metal surface treatment.

[0003] Although UV resin coatings have many advantages, some defects may occur 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 lead to an uneven surface or cracking of the coating; if the coating has poor fluidity or is too thick, the coating may sag, forming an uneven surface; due to uneven UV irradiation, the coating may not be fully cured in some areas, resulting in a decrease in coating performance.

[0004] Existing methods for detecting defects in UV resin coatings primarily rely on optical inspection, image processing, multispectral analysis, and thickness measurement to identify defects such as bubbles, scratches, orange peel, sags, and particles. High-precision cameras, sensors, and automated control systems are used to monitor coating surface quality in real time, and mechanical properties such as hardness and wear resistance are tested to ensure coating stability. Existing research has largely focused on defect detection on smooth paint surfaces. However, irregular UV resin coatings, with their numerous reflective points and surface contours that can interfere with defect detection, present significant challenges in defect detection and identification, leaving room for further 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 paint surface defect detection method and system, which obtains an image to be detected that is more conducive to subsequent defect detection by removing reflective spots; determines whether there is an uncured defect by calculating the similarity index of the segmented images between a first segmented area and a second segmented area; determines whether there is a color unevenness defect by calculating the degree of difference between a segmented area and its adjacent segmented areas; establishes an MSF-CRA-YOLOv5 neural network model to detect and identify other defects such as bubbles and scratches; and finally collects all defect information and establishes 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 method for detecting defects on a UV resin coating surface, comprising:

[0009] A first set of paint surface images of the paint surface to be inspected is obtained and the reflective point removal process is performed to obtain a first image to be inspected; the first paint surface image set is 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 inspected after solvent cleaning is obtained and the reflective point removal process is performed to obtain a second image to be inspected; the first image to be inspected and the second image to be inspected 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.

[0010] Furthermore, the reflection point 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, wherein the pixel value of a 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 zero-reset pixel point; the pixel values and corresponding weight values of the adjacent pixel points of the zero-reset pixel point are obtained, and an improved bicubic interpolation formula is used to obtain an interpolated pixel point;

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

[0013] Furthermore, the weight value includes: obtaining pixel values of the adjacent pixel points and processing them to obtain gradients of the adjacent pixel points; obtaining the gradients and processing them to obtain gradient weights for adjusting weights of different pixel values in the interpolation process;

[0014] Obtaining pixel values of the adjacent pixel points and fitting them using a quadratic surface to obtain a pixel surface function z(x,y) using a least squares method; obtaining and processing the pixel surface function to obtain a local surface fitting weight, which is used to adjust the interpolation result to better conform to 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 point, and (x+i,y+j) represents the position of the adjacent pixel point.

[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; 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 unevenness defects are detected according to a preset uniformity threshold.

[0020] Furthermore, the detection of color unevenness defects includes: obtaining data of the second segmented image set and processing it to obtain image features; obtaining data of adjacent segmented images of the g-th segmented image in the second segmented image set and processing it to obtain weighted image features of the g-th segmented image, obtaining the weighted image features and the image features of the g-th segmented image and processing them to obtain a segmented area uniformity index. If the segmented area uniformity index is greater than a preset uniformity threshold, then 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 dataset are obtained; 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, sags, 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 UV resin paint surface; a residual module based on the attention mechanism, which adds the CBAM attention mechanism on the basis of residual connection to capture the detailed features of key areas of the UV resin paint surface.

[0026] 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 there is a defect; a classification loss function for the defect classification task; 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 number of defect occurrences, 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 surface defect detection system, comprising:

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

[0035] a spraying unevenness detection module, configured to acquire and process 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;

[0036] A defect detection module is used to 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 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. Images of light sources at different angles are captured at a fixed position. By obtaining the pixel with the lowest brightness value among the pixels at the corresponding position in each image, multi-light source images are fused. 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. The highlight pixels in the fused image are processed, and the pixels exceeding the threshold are reset to zero using a preset brightness threshold, further eliminating overexposed or highly reflective areas in the fused image. Using an improved bicubic interpolation formula, when calculating the interpolation point, not only the pixel values of the surrounding pixels are considered, but also the pixel value gradient weight and local surface fitting weight are introduced. 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. To address the curing issues that are particularly common with UV resin coatings, the UV resin coating surface is cleaned with solvents, and then the images of the paint surface before and after cleaning are compared and the similarity is calculated to analyze and detect insufficient curing defects on the UV resin coating surface. Uncured areas may exhibit different behaviors after solvent cleaning, such as softening, discoloration, or dissolution. The difference between the image of the uncured area and the area before cleaning will be more obvious, 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 treatment, the segmented image similarity index is used to detect the uncured area and more accurately locate the uncured defect area.

[0041] 3. An improved YOLOv5 model is used to detect and identify paint defects. To overcome the problems of insufficient feature extraction 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, features such as the overlapping area, center point distance, and aspect ratio of the bounding boxes in different scenes can be adjusted, making the model more flexible during training. Two improved loss functions are proposed, used in the model training and prediction stages respectively, which improve the stability and generalization of the bounding box positioning accuracy during training, helping 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 the CRA module provided in Example 1 of the present invention;

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

[0047] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 making creative efforts are within the scope of protection of the present invention.

[0048] Example 1

[0049] A certain automobile manufacturer uses colored UV coatings for car body exteriors, interior parts, etc. 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 parts such as door handles, rearview mirror housings, and decorative strips to enhance the appearance. In order to detect whether there are defects in automobile parts covered with UV coatings, 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 paint surface images are processed to remove the reflection points to obtain the image to be detected. The reflection point removal processing includes the fusion of the paint surface images taken by light sources at different angles and pixel correction.

[0051] Furthermore, 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, 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, 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 zero-reset pixel with a position of (x, y); the pixel values and corresponding weight values of the adjacent pixels of the zero-reset 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 operations are performed to obtain a first image to be detected.

[0058] Taking images at a fixed angle facilitates subsequent image calibration and fusion. Taking images from different light sources and fusing multiple light source images by obtaining the pixel with the lowest brightness value among the pixels at the corresponding position in each image can effectively suppress areas of strong light reflection. The highlighted pixels in the fused image are further processed, and pixels exceeding the threshold are reset to zero using a preset brightness threshold, further eliminating the highlighted areas in the fused image. The improved bicubic interpolation formula can generate smoother and more continuous images, allowing the final image to be detected to retain more local detail features.

[0059] Obtain and process the pixel values of the adjacent pixel points to obtain the gradient of the adjacent pixel points; obtain and process the gradient 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] Obtain the pixel values of the adjacent pixel points and use quadratic surface fitting to obtain the pixel surface function z(x,y) by the least squares method; obtain the pixel surface function and process it to obtain a local surface fitting weight, which is used to adjust the interpolation result to better conform to 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. 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] Gradient weights can avoid over-smoothing of edges or sudden changes in the interpolation process, making the interpolation results more consistent with the actual surface characteristics; local surface fitting weights take into account the surface height differences around the target point, making the interpolation results more consistent with the local shape of the surface; the improved bicubic interpolation method based on gradient weights and local surface fitting weights can more intelligently adjust the weights of different pixels in the interpolation process, thereby reducing interpolation errors and optimizing interpolation results.

[0069] Step S2: obtaining a first set of paint surface images of the paint surface to be inspected and performing the reflective point removal process to obtain a first image to be inspected; 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 inspected after solvent cleaning and performing the reflective point removal process to obtain a second image to be inspected; performing identical segmentation on the first image to be inspected and the second image to be inspected to obtain a first segmented image set and a second segmented image set; obtaining and processing 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; 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] Wherein, 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 at the (p,q) position of the first segmented image, and I2(p,q) represents the pixel value at the (p,q) position of the second segmented image.

[0074] Furthermore, a segmented image similarity index was calculated for all segmented images in the first segmented image set and the segmented images in the corresponding second segmented image set. The presence of uncured paint defects was determined based on a preset similarity threshold. The calculation showed that the prevalence of uncured paint defects in the batch of automotive parts was 0.01%, indicating that there were essentially no uncured paint defects.

[0075] Undercuring defects in UV resin coatings are detected by comparing and similarity analyzing images after solvent treatment. Since uncured areas may exhibit different behaviors after solvent cleaning, such as softening, discoloration, or dissolution, the performance of uncured areas is more obvious than that of cured areas. Therefore, when comparing the before and after images, the uncured areas will appear more prominent and easier to detect. By uniformly segmenting and analyzing the images at the same location before and after treatment, the segmented image similarity index is used to detect uncured areas and more accurately locate the uncured defect 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] Furthermore, 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, 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 The weight coefficient of the ath adjacent segmented image is represented by . 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 the area to be inspected has color unevenness defects, it does not rely solely on the data of a single area, but combines the overall situation of adjacent areas, reducing the errors caused by isolated data and enhancing the perception of local minor unevenness. By calculating the color uniformity of each segmented area and combining the weighted image features of 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 paint surfaces.

[0081] Step S4: Establish an MSF-CRA-YOLOv5 neural network model to perform defect detection on the paint surface to be inspected, including the 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 the defect establishment data set; obtain the target confidence loss, classification loss and coordinate regression loss and process them to obtain the total loss function.

[0082] Furthermore, in the data set, objects to be identified include: bubbles, sags, 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 segmented contour set; 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 to 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 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 UV resin paint surface.

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

[0087] Backbone: It uses CSP and SPPF modules for feature extraction. CSP processes input features by dividing them into two paths, preserving 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 positioning the bounding box through regression.

[0090] The original YOLOv5 model architecture already possesses a certain level of multi-scale feature processing capability, employing a feature pyramid (FPN network) and PAN to combine shallow and deep features. Because different levels of the pyramid contain information about objects of specific sizes, current feature fusion methods often ignore the high-resolution shallow layers, making it difficult to detect small objects. The improved YOLOv5 further enhances this performance 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, enabling the model to handle targets of different sizes; fusion methods such as Figure 3 As shown in Figure 2, 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 feature extraction capabilities and reduce information loss. The attention mechanism improves the perception ability of key areas, enabling the model to better capture the detailed features of key areas.

[0096] The structure of the CRA module is as follows Figure 4Shown, 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 retains 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, a residual connection structure is used to maintain continuous information transmission while avoiding the gradient vanishing problem. The residual structure helps reduce the optimization difficulties brought by deep networks, making 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 locations through weight adjustment. The processed features are fused with the original features in the CSP path to obtain an enhanced feature map. This combination effectively preserves 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 preset anchor boxes in each grid unit, Indicates that if the target is in the b-th anchor box of the s-th 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 s-th 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 diagonal length of the image, γ 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 appropriate 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 overlapping area 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 predicted 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 cracks 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 (IoU) of 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 addition of the adjustment coefficient μ further optimizes 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, including defect type, area, location, and frequency of occurrence, is recorded. Sample defect data is generated based on this information for use in tracking and analyzing paint quality. The quality compliance rate for this batch of auto parts was 98.45%. Defect inspection of this batch revealed that scratches were the primary defect problem. In future production, the automaker should adjust its production methods based on the frequency of defects.

[0123] By comprehensively recording and analyzing defect information on UV resin coating surfaces, including detailed records of defect type, area, location, and frequency of occurrence, the coating quality can be comprehensively monitored. Based on the sample defect data set, the changing trends of defects 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 multi-light source image fusion method. This method uses the minimum brightness value of each pixel at each location to generate a fused image. Highlights are then removed using a preset brightness threshold. Finally, an improved bicubic interpolation formula is used to fill in these highlights, ultimately yielding an image that is useful for subsequent inspection and retains more image features. A segmented image similarity index is designed to detect uncured areas, a characteristic of UV resin coatings, to more accurately locate the location of uncured defects. For color unevenness defects, image features are extracted to calculate the segmented region uniformity index, effectively improving the detection accuracy of surface color unevenness defects on UV resin coating surfaces. For other defects, an MSF-CRA-YOLOv5 neural network model is established for identification and detection, and different loss functions are designed to accurately locate the defect locations. Through these operations, the present invention provides a UV resin coating surface defect detection method that improves the efficiency of quality inspections for automobile manufacturers.

[0125] Example 2

[0126] A cosmetics company uses UV coating on its outer packaging to increase gloss and texture. The surface of these packaging boxes is 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 was applied. The system structure is as follows: Figure 5 shown.

[0127] First, the production line uses multiple light sources at different angles to capture fixed-position images of the outer packaging surface. This multi-angle light source setup ensures that all defects on the paint surface, including bubbles, scratches, and uneven gloss, are fully captured when inspecting smooth, reflective surfaces. To reduce the interference caused by a single light source angle, multi-angle shooting and light source fusion technology are used. Images captured at different angles are fused, and the lowest brightness value for each pixel is selected, effectively removing excessively reflective areas. This reflective point removal process further optimizes image quality through an adaptive interpolation algorithm, ensuring that subsequent analysis is not interfered with by bright spots. The brightness range of the processed image is significantly reduced compared to the original image, and the interpolation algorithm greatly improves the image smoothness.

[0128] Furthermore, when performing highlight removal operations in the fused image, by introducing dynamic thresholds, the thresholds of different areas can be automatically adjusted according to local lighting conditions, 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 brightness values of the pixels around the target pixel to ensure the adaptability of the threshold in different regions. Usually, the dynamic threshold is adjusted based on the statistical characteristics of the local area, such as the local mean and standard deviation. The calculation formula is as follows:

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

[0131] Where T(x′,y′) represents the dynamic threshold at position (x′,y′), μ′(x′,y′) represents the mean brightness of the neighborhood pixels at position (x′,y′), k represents the adjustment coefficient, and σ′(x′,y′) represents the standard deviation of the brightness of the neighborhood pixels at 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 within 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 is completed, 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 evenly divides the image, and then calculates the similarity index of each segmented area to detect whether there is an uncured area. The lower the similarity index, the smaller the change in the coating. The presence 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 uncured areas, the system also identifies areas of uneven color within the image. By processing the image features of each segmented region and calculating its uniformity index, the system can detect areas of uneven color. A lower uniformity index indicates a more uniform coating color distribution in that area. The results show that areas of uneven color defects account for approximately 1.45%, indicating that the spraying process requires urgent improvement.

[0140] To improve the accuracy of defect detection, the system also utilizes the MSF-CRA-YOLOv5 neural network model for defect identification. This model combines multi-scale feature fusion with an attention mechanism residual block to accurately identify various types of defects, including bubbles, scratches, orange peel texture, 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 containing detailed information such as the type, area, location, and number of occurrences of each defect. Analysis of the report reveals that the defects are primarily concentrated in the lower left corner of the image, allowing the company to adjust its production methods 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% cracks 99.02% 98.27% average value 98.54% 97.58%

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

[0144] While 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 these embodiments without departing from the principles and spirit of the invention, and that the scope of the 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: Acquire a first set of paint surface images of the paint surface to be inspected and perform a reflective point removal process to obtain a first image to be inspected; The first paint surface image set is paint surface images taken by light sources at different angles; The process of removing the reflective spots 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 paint surface images. The paint surface images in the image set are fused to obtain a multi-light source fused image. The pixel value of the multi-light source fused image is the pixel value with the lowest brightness value among the pixels at the corresponding position in all the paint surface images. If the brightness value of a pixel in the multi-light source fusion image exceeds a preset brightness threshold, the pixel value of the pixel is reset to zero to obtain a zero-reset pixel; the pixel values and corresponding weight values of the adjacent pixels of the zero-reset pixel are obtained and the improved bicubic interpolation formula is used to obtain the interpolated pixel; Obtain all pixels in the multi-light source fusion image and process them to obtain the image to be detected; The weight value includes: obtaining pixel values of adjacent pixels and processing them to obtain the gradient of adjacent pixels; obtaining gradients and processing them to obtain gradient weights, which are used to adjust the weights of different pixel values in the interpolation process; Obtain the pixel values of adjacent pixels and use quadratic surface fitting to obtain the pixel surface function z(x,y) through the least squares method; obtain the pixel surface function and process it to obtain the local surface fitting weight, which is used to adjust the interpolation result; Obtain the gradient weight and local surface fitting weight and process them to obtain the comprehensive weight. The calculation formula of the comprehensive weight is: ω(i,j)=eta1·ω1(i,j)+eta2·ω2(i,j); Where ω(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. Obtaining a second set of images of the paint surface to be inspected after solvent cleaning and performing the reflective spot removal process to obtain a second image to be inspected; performing identical segmentation on the first image to be inspected and the second image to be inspected to obtain a first set of segmented images and a second set of segmented images; obtaining and processing data of the first set of segmented images and the second set of segmented images to obtain a segmented image similarity index, and detecting uncured defects based on a preset similarity threshold; Acquire and process 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 a defect dataset; obtaining and processing the target confidence loss, classification loss, and coordinate regression loss to obtain a total loss function; Obtain the test results and generate a test report for quality tracking and analysis of the paint surface to be tested.

2. The method for detecting defects on a UV resin coating surface according to claim 1, wherein: The detecting of uncured defects comprises: The number of images in the first segmented image set and the second segmented image set is 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.

3. The method for detecting defects on a UV resin coating surface according to claim 1, wherein: 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.

4. The method for detecting defects on a UV resin coating surface according to claim 1, wherein: The dataset includes: The contour is obtained, and curve fitting and segmentation processing are performed to obtain a segmented contour set; 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, particulate impurities, cracks and scratches.

5. The method for detecting defects on a UV resin coating surface according to claim 1, wherein: 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 Represents the coordinate loss function.

6. The method for detecting defects on a UV resin coating surface according to claim 1, wherein: The loss function also includes: obtaining 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 the intersection-over-union ratio, the distance between the center point of the predicted box and the true target box, and the length of the box diagonal.

7. The method for detecting defects on a UV resin coating surface according to claim 1, wherein: Also includes: All defect information is recorded, including defect type, defect area, defect location, and number of defect occurrences. Sample defect data is generated based on the all defect information for quality tracking and analysis of the paint surface to be tested.

8. A UV resin coating surface defect detection system, characterized in that: include: An uncured defect detection module is used to obtain a first paint surface image set of the paint surface to be inspected and perform a reflective point removal process to obtain a first image to be inspected; The first paint surface image set is paint surface images taken by light sources at different angles; The process of removing the reflective spots 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 paint surface images. The paint surface images in the image set are fused to obtain a multi-light source fused image. The pixel value of the multi-light source fused image is the pixel value with the lowest brightness value among the pixels at the corresponding position in all the paint surface images. If the brightness value of a pixel in the multi-light source fusion image exceeds a preset brightness threshold, the pixel value of the pixel is reset to zero to obtain a zero-reset pixel; the pixel values and corresponding weight values of the adjacent pixels of the zero-reset pixel are obtained and the improved bicubic interpolation formula is used to obtain the interpolated pixel; Obtain all pixels in the multi-light source fusion image and process them to obtain the image to be detected; The weight value includes: obtaining pixel values of adjacent pixels and processing them to obtain the gradient of adjacent pixels; obtaining gradients and processing them to obtain gradient weights, which are used to adjust the weights of different pixel values in the interpolation process; Obtain the pixel values of adjacent pixels and use quadratic surface fitting to obtain the pixel surface function z(x,y) through the least squares method; obtain the pixel surface function and process it to obtain the local surface fitting weight, which is used to adjust the interpolation result; Obtain the gradient weight and local surface fitting weight and process them to obtain the comprehensive weight. The calculation formula of the comprehensive weight is: ω(i,j)=eta1·ω1(i,j)+eta2·ω2(i,j); Where ω(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. Obtaining a second set of images of the paint surface to be inspected after solvent cleaning and performing the reflective spot removal process to obtain a second image to be inspected; performing identical segmentation on the first image to be inspected and the second image to be inspected to obtain a first set of segmented images and a second set of segmented images; obtaining and processing data of the first set of segmented images and the second set of segmented images to obtain a segmented image similarity index, and detecting uncured defects based on a preset similarity threshold; a spraying unevenness detection module, configured to acquire and process 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; A defect detection module is used to 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 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 tracking and analyzing the quality of the paint surface to be tested.

Citation Information

Patent Citations

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

    CN114511545A