Coating surface defect real-time detection system and method based on deep learning
Through multi-scale feature extraction and feature decoupling technology, combined with deep learning and adaptive illumination compensation, the adaptability and illumination interference issues of coating inspection technology when applied across product lines are resolved, achieving efficient and rapid coating defect detection and improving the inspection capability and efficiency of the production line.
Patent Information
- Application Number
- CN202510881510.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-10
AI Technical Summary
Existing coating defect detection technology has poor adaptability when applied across product lines. It requires separate training for each product and is sensitive to adaptability to new defects and light interference, making it difficult to meet the needs of rapid iteration in production.
The multi-scale feature extraction submodule, feature decoupling submodule and small sample adaptation submodule are used, combined with deep convolutional neural networks and adversarial training to extract domain-invariant defect features across product lines, quickly adjust the model using a small number of labeled samples, and achieve real-time detection through an adaptive illumination compensation device and feedback control module.
It achieves highly compatible detection across product lines, reduces deployment costs, quickly adapts to new defects, eliminates the impact of lighting differences, and improves detection robustness and production efficiency.
Smart Images

Figure CN120766012A_ABST
Abstract
Description
[0001] Real-time detection system and method for coating surface defects based on deep learning Technical Field
[0002] The present invention relates to the field of industrial automation detection technology, and specifically to a real-time detection system and method for coating surface defects based on deep learning, which is suitable for quality control of coating products in industries such as automobiles, home appliances, and furniture. Background Art
[0003] With the development of industrial intelligence, machine vision technology has been widely used in the field of coating surface defect detection. The coating process is widely used in industries such as automobiles and home appliances, but existing coating defect detection technology still has many shortcomings.
[0004] Chinese patent publication number CN113030108A discloses a machine vision-based coating defect detection system that uses industrial cameras to capture images and utilizes a neural network model for defect classification. However, this solution fails to account for the interference of different product materials and processes on defect detection, resulting in a significant performance degradation when the model is applied across product lines. Separate training is required for each product, increasing deployment costs. Furthermore, this solution has poor adaptability to new defects and requires the re-collection of large amounts of annotated data, making it difficult to meet the needs of rapid production iterations.
[0005] Chinese patent publication number CN119757401A discloses an intelligent coating defect detection and repair system that uses a laser scanner to capture surface images and combines them with a deep learning model to identify defects. However, the detection accuracy of this solution is limited by the limitations of laser imaging, such as imaging distortion of highly reflective materials. It also lacks a cross-domain feature decoupling mechanism, making the model susceptible to interference from product-specific features such as coating color and texture. Furthermore, the system lacks the ability to quickly adapt to small sample sizes and cannot meet the real-time detection needs of new defects.
[0006] Therefore, how to overcome the above-mentioned technical defects and achieve real-time detection of coating defects with high compatibility, rapid adaptation of small samples, and anti-interference has become a key issue that needs to be urgently solved in the field of industrial quality inspection. Summary of the Invention
[0007] The purpose of this application is to provide a real-time detection system and method for coating surface defects based on deep learning, which has the advantages of improving the adaptability of cross-product line detection, reducing the model training cost in small sample scenarios, and enhancing the detection stability under complex lighting conditions.
[0008] To achieve the above object, the present invention adopts the following technical solutions: The first aspect of this case discloses a real-time detection system for coating surface defects, comprising: Image acquisition module 1, used for real-time acquisition of surface images of painted products; Cross-product line defect detection module 2, which includes: The multi-scale feature extraction submodule 21 is configured to perform feature extraction from the collected surface image of the painted product to extract features at different levels; a feature decoupling submodule 22 configured to decompose the extracted features of each level into domain-invariant defect features that are independent of product type and domain-specific features related to the material, process, or physical properties of the product, and suppress the influence of the domain-specific features on defect classification through adversarial training; The small sample adaptation submodule 23 uses a small number of labeled samples in the target domain to quickly adjust parameters based on the pre-trained model of the source domain, and uses data synthesis technology to generate additional samples to expand the training data to achieve detection in the target domain; The feedback control module 3 is used to transmit the detection results to the control system of the external production line in real time, triggering automatic marking or repair instructions.
[0009] Preferably, the multi-scale feature extraction submodule 21 includes a multi-scale feature extraction network using a ResNet50 architecture; the multi-scale feature extraction network includes: The low-level feature extraction layer 211 is configured to extract local detail features of the painted surface to use these features as low-level features; a mid-level feature extraction layer 212 configured to extract morphological features of defects to use these features as mid-level features; The high-level feature extraction layer 213 is configured to extract semantic features related to coating material properties and use these features as high-level features.
[0010] Preferably, the low-level feature extraction layer 211 is configured to extract local detail features of the image through a convolutional neural network, which includes: a Gaussian difference filter 2111 configured to enhance edge and texture features, and a directional gradient histogram extractor 2112 configured to capture local gradient change features; The intermediate feature extraction layer 212 is configured to extract morphological features of defects through a region proposal network, and includes: a morphological operation unit 2121 configured to perform dilation, erosion, and opening and closing operations to highlight the defect outline; a geometric feature calculator 2122 configured to calculate the area, perimeter, and aspect ratio parameters of the defect; The advanced feature extraction layer 213 is configured to extract material attribute related features through a semantic segmentation network, and includes: a material classification unit 2131 configured to identify different base materials of the product, and a gloss analysis unit 2132 configured to calculate surface gloss changes through a reflectance model.
[0011] Preferably, the high-level feature extraction layer weightedly aggregates multi-channel features through an attention mechanism to generate a semantic feature vector containing at least one of the following attributes: Surface gloss characteristics based on the distribution of highlight areas; Coating thickness characteristics based on color space distribution; Material type characteristics based on texture complexity; Coating adhesion characteristics based on defect edge morphology.
[0012] Preferably, the image acquisition module 1 acquires the surface image of the painted product in real time through a high-definition camera and an image sensor; the high-definition camera is integrated with an adaptive illumination compensation device 11, which can dynamically adjust the light source parameters according to the ambient light.
[0013] Preferably, the adaptive illumination compensation device 11 includes: a spectral sensor 111 configured to analyze the spectral distribution of ambient light in real time; A multi-channel LED fill light array 112 is configured to dynamically adjust the intensity of the red, green, blue, and white light sources according to the spectral analysis results; The image pre-processing unit 113 is configured to perform illumination normalization processing on the captured image, where the illumination normalization processing includes histogram equalization and Retinex enhancement.
[0014] Preferably, the feature decoupling submodule 22 includes: The feature decomposition network 221 is configured to map the features of each level into two subspaces: domain-invariant and domain-specific. The feature decomposition network 221 includes: an invariant feature encoder 2211 configured to generate a defect representation that is insensitive to product type; A specific feature encoder 2212 is configured to generate a feature representation related to a material, process, or physical property; The domain adversarial training unit 222 is configured to implement domain confusion through a gradient reversal mechanism, comprising: A domain classifier 2221 is configured to predict the product domain of the feature source; a gradient reversal layer 2222 configured to reverse the gradient direction of the domain classifier 2221 during back propagation to form an adversarial training mechanism; The decoupling loss function calculation subunit 2223 is configured to optimize the defect classification accuracy and the degree of domain confusion using a loss function to calculate the multi-objective loss; the loss function includes: Defect classification loss term, used to minimize the defect prediction error; Domain adversarial loss term, used to maximize domain classification error; The multi-objective loss is the sum of the defect classification loss term and the domain adversarial loss term.
[0015] Preferably, the small sample adapter module 23 includes: a meta-learning optimizer 231 configured to perform gradient updates on model parameters based on the Reptile algorithm, so that the model has the ability to quickly adapt to new domains; The conditional generative adversarial network 232 is configured to generate diverse defect simulation images based on a small number of samples in the target field, wherein the simulated images include defect morphologies under different lighting conditions and material properties.
[0016] Preferably, the feedback control module 3 includes: A real-time decision-making unit 31 is configured to generate control instructions based on the detection results, wherein the control instructions include defect location marking, repair path planning, or production line pause signal; The quality analysis unit 32 is configured to generate a defect statistics report across product lines, the report including defect type distribution, frequency trend and process correlation analysis. The second aspect of this case discloses a real-time detection method for coating surface defects, which is applied to the real-time detection system for coating surface defects described in the first aspect, and includes the following steps: S100: Image acquisition step, using a high-definition camera and an adaptive illumination compensation device to capture images of the surface of the painted product in real time; S200: Multi-scale feature extraction step, using the multi-scale feature extraction network of ResNet50 architecture to extract different levels of features from the preprocessed image; S300: Feature decoupling step, mapping the features of each level into two subspaces: domain-invariant and domain-specific; S400: Small sample adaptation step, using a small number of labeled samples in the target domain, quickly adjusts parameters based on the pre-trained model in the source domain, and uses data synthesis technology to generate additional samples to expand the training data; S500: Defect detection and classification step, based on the decoupled domain-invariant features and the adapted model, detects and classifies coating surface defects; S600: Feedback control step, transmitting the detection results to the control system of the external production line in real time, triggering automatic marking or repair instructions.
[0017] A third aspect of the present invention discloses a control system, comprising: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the real-time detection method for coating surface defects disclosed in the second aspect of the embodiment of the present invention.
[0018] A fourth aspect of an embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the real-time detection method for coating surface defects disclosed in the second aspect of an embodiment of the present invention.
[0019] A fifth aspect of an embodiment of the present invention discloses a computer program product, which, when run on a computer, enables the computer to execute part or all of the steps of the real-time detection method for coating surface defects of the second aspect.
[0020] A sixth aspect of an embodiment of the present invention discloses an application publishing platform, which is used to publish a computer program product. When the computer program product runs on a computer, the computer executes part or all of the steps of the real-time detection method for coating surface defects of the second aspect.
[0021] Compared with the prior art, the present invention has the following beneficial effects: 1. The multi-scale feature extraction submodule in this application utilizes deep convolutional neural networks to extract features at different levels, comprehensively capturing multiple aspects of painted product surface images. The feature decoupling submodule further decomposes features into domain-invariant defect features and domain-specific features. Using adversarial training, it suppresses the influence of domain-specific features on defect classification. This allows the system to focus more on domain-invariant defect features that reflect the essential nature of defects when applied across product lines. This effectively improves cross-domain detection generalization, avoids separate training for each product, reduces deployment costs, and enhances cross-product line detection capabilities. Because the system can separate domain-specific features associated with these characteristics through feature decoupling, it overcomes the interference of factors such as product materials and processes on defect detection, thereby adapting to the painted surface defect detection needs of different products. This achieves high compatibility, facilitating adaptation to diverse product characteristics while reducing deployment costs. The small sample adaptation submodule utilizes only a small number of annotated samples from the target domain to perform rapid fine-tuning and synthetic data augmentation, enabling rapid small sample adaptation. This enables the system to quickly adapt to the detection of new defects without re-collecting large amounts of annotated data, significantly reducing the time required to respond to new defects and meeting the needs of rapid production iteration. The feedback control module can transmit the detection results to the control system of the external production line in real time. This real-time feedback mechanism enables the production line to process defective products in a timely manner, preventing defective products from flowing into subsequent processes, and improving production efficiency and product quality. In this way, the present invention can achieve universal defect detection across product lines and reduce the demand for model training data for new products. The feature decoupling mechanism effectively eliminates false detections caused by material differences, and the small sample adaptation technology enables the model to quickly adapt to new products with the help of a small number of labeled samples, greatly shortening the new product deployment cycle and solving the problem that traditional methods require a large amount of data to retrain the model due to material differences. Universal detection across product lines is achieved, reducing data requirements and deployment cycles.
[0022] 2. The feedback control module transmits inspection results to the production line control system in real time, forming a closed-loop detection-execution chain. When defects are detected, automatic marking or repair instructions are triggered immediately, improving overall quality inspection efficiency. This module also effectively addresses the problem of false detections caused by traditional methods that ignore the correlation between material properties and defect morphology. For example, it can accurately distinguish between true bubble defects on the surface of plastic parts and normal textures generated by the injection molding process, improving the robustness of defect detection across product lines.
[0023] 3. Accurately distinguish visual artifacts and enhance cross-material detection generalization ability: The application can accurately distinguish real defects from visual artifacts caused by material characteristics, such as effectively distinguishing normal wire drawing texture on the surface of stainless steel from real scratches. When detecting cross-material products, it can automatically ignore the interference of material inherent texture, such as being unaffected by material texture when detecting plastic part bubble defects, significantly reducing the need for model retraining due to product reengineering, and improving the defect detection generalization ability of cross-material products.
[0024] 4. Eliminate the influence of light difference and ensure feature stability: Through the adaptive light compensation device and light normalization preprocessing in the image acquisition step, the application effectively eliminates the influence of different production line light conditions on image acquisition, avoiding defect omission caused by overexposure of reflection or shadow blocking. The feature distribution of the preprocessed image is more stable, which is conducive to the accurate distinction between material characteristics and real defect features by the subsequent feature decoupling module, and improves the robustness of the cross-product line detection system. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 is a structural block diagram of a coating surface defect real-time detection system of embodiment one of the case.
[0026] Figure 2 is a processing flow diagram of a coating surface defect real-time detection system of embodiment one of the case.
[0027] Figure 3 is a step flow diagram of a coating surface defect real-time detection method of embodiment two of the case.
[0028] Figure 4 is a structural diagram of a control system of embodiment three of the case. DETAILED DESCRIPTION
[0029] The technical solutions in the present application will be described in detail below with reference to the accompanying drawings in the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all embodiments. The components of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application. It should be noted that: similar numbers and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present application, the terms "first", "second" and the like are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0030] In the prior art, the coating surface defect detection technology has long been faced with the problem of poor cross-product line adaptability. Different materials and processes of coating products have significant differences in surface characteristics. The traditional detection model needs to be trained separately for each product, resulting in high deployment cost. Existing systems generally use fixed parameter models, which cannot quickly adapt to the detection needs of new product lines. When encountering new defects or process changes, a large amount of labeled data needs to be collected again, which seriously affects production efficiency. A certain automobile coating workshop once tried to deploy a general detection system, but when processing metal substrate and plastic substrate products, the misclassification rate was as high as 30% due to the difference in surface reflectance characteristics. To solve the above problems, it is first observed that the defect features of different product lines have common parts, but are masked by material characteristics. Through analysis, it is found that the feature space can be decomposed into two subspaces of domain invariance and domain specificity, which can effectively improve the model generalization ability. Secondly, for small sample scenarios, it is found that using a pre-trained model from the source domain for parameter transfer, combined with data synthesis technology, can significantly reduce the data requirements of the new domain. Finally, considering the real-time requirements of production, a closed-loop control link between the detection results and the actuator needs to be established.
[0031] Embodiment one Please refer to Figure 1 , Figure 1 is the structural block diagram of the coating surface defect real-time detection system disclosed by the embodiment of the application. Figure 2 is the processing flowchart of the coating surface defect real-time detection system disclosed by the embodiment.
[0032] As shown in Figure 1 and Figure 2 , the deep learning-based coating surface defect real-time detection system comprises: An image acquisition module 1 is configured to acquire coating product surface images in real time. Specifically, A cross-product line defect detection module 2 comprises: A multi-scale feature extraction submodule 21 is configured to extract features from the acquired coating product surface images to extract different level features. Specifically, a deep convolutional neural network such as ResNet50 is used to extract one or more feature vectors of different levels.
[0033] The feature decoupling submodule 22 is configured to decompose each of the extracted different-level features into domain-invariant defect features / cross-domain general defect features irrelevant to the product type and domain-specific features directly related to the material, process or physical characteristics of the product, and suppress the influence of the domain-specific features on defect classification through adversarial training to improve the cross-domain detection generalization capability. The specific types of the domain-invariant defect features / cross-domain general defect features include defect geometric features, defect texture features and defect morphological features; such features are irrelevant to the domain-specific characteristics such as the material and process of the product, and only reflect the essential attributes of the defect; for example, the geometric features of a scratch. The specific types of the domain-specific features include material-related features, process-related features and physical property-related features; for example, the surface glossiness of the product. The domain-invariant defect features are domain-invariant components, and the domain-invariant components are defined as F1; the domain-specific features are domain-specific components, and the domain-specific components are defined as F2; for example, we use a feature vector of a certain level after processing by the multi-scale feature extraction submodule 21, which is defined as F; the feature vector F is given to the decoupling submodule 22 for decoupling processing, and the feature vector F is decomposed into F=F1+F2. Then, the influence of F2 on defect classification is suppressed through domain adversarial training, and F1 is retained as much as possible for cross-domain detection.
[0034] The small sample adaptation submodule 23 is configured to perform rapid parameter adjustment based on a pre-trained model of a source domain by means of a few labeled samples (≤100) in a target domain based on a meta-learning algorithm (such as Reptile) and a conditional generative adversarial network (cGAN), and simultaneously generate additional samples by using a data synthesis technique to expand the training data and enhance the applicability of the model in the target domain, so as to finally achieve the purpose of detecting the target domain.
[0035] The feedback control module 3 is used to transmit the detection results to the control system of the external production line in real time, trigger automatic marking or repair instructions, and generate a cross-domain quality statistical report. Specifically, the EtherNet / IP protocol is used to communicate with the production line PLC, and when a defect is detected, the coordinate data is sent to the robot controller of the external production line in real time to trigger the pneumatic marking device to spray fluorescent markers at the defect position; at the same time, the system generates a quality report every day to count the defect type distribution, workshop shift qualification rate and other indicators, and pushes them to the process engineers through a Web interface. The process engineers can analyze the problems existing in the production process according to these statistical data, timely adjust the process parameters, optimize the production process, and further improve the product quality and production efficiency.
[0036] As described above, the multiscale feature extraction submodule in the present case utilizes a deep convolutional neural network such as ResNet50 to extract features at different levels, which can comprehensively capture various aspects of information of the surface image of the painted product. The feature decoupling submodule further decomposes the features into domain-invariant defect features and domain-specific features, suppresses the influence of domain-specific features on defect classification through adversarial training, so that the system can focus more on domain-invariant defect features reflecting the essential properties of defects when applied across product lines, effectively improving the cross-domain detection generalization ability, avoiding the need to train separately for each product, reducing deployment costs, and thus enhancing the cross-product line detection capability. Since the system in the present case can separate domain-specific features related to these characteristics through feature decoupling, it overcomes the interference of different product materials, processes, and other factors on defect detection, thereby adapting to the painting surface defect detection needs of different products and achieving high compatibility to adapt to various product characteristics while reducing deployment costs. The small sample adaptation submodule can quickly fine-tune and synthesize data enhancement using only a small amount of labeled samples in the target domain, achieving small sample rapid adaptation. This enables the system to quickly adapt to the detection of new defects without the need to re-collect a large amount of labeled data, greatly shortening the time to respond to new defects and meeting the rapid iteration production needs. Through the conditional generative adversarial network for synthetic data enhancement, more sample data similar to the target domain can be generated, enriching the training dataset and helping to improve the recognition accuracy and robustness of the model for new defects. The feedback control module can transmit the detection results to the control system of the external production line in real time. This real-time feedback mechanism enables the production line to timely process defective products, avoiding the flow of defective products into subsequent processes, and improving production efficiency and product quality.
[0037] Through the above technical solutions, the present application can achieve cross-product line defect detection versatility, reduce the need for model training data for new products, and ensure real-time linkage of detection results with production line control systems. The feature decoupling mechanism effectively eliminates false positives caused by material differences, the small sample adaptation technology shortens the deployment cycle of new products, and the feedback control module forms a closed-loop link between detection and execution, improving overall quality inspection efficiency.
[0038] As a specific implementation, the multiscale feature extraction submodule 21 includes a multiscale feature extraction network adopting a ResNet50 architecture; the multiscale feature extraction network includes: A low-level feature extraction layer 211 configured to extract local detail features of the painted surface, the local detail features including but not limited to edge, texture, and other local detail features. The local detail features are applicable to all painted products, so the acquired local detail features are used as low-level features.
[0039] The middle-level feature extraction layer 212 is configured to extract morphological features of the defects, including but not limited to geometric shape, size, contour feature; for example, extracting the geometric morphological features of scratches and bubbles, so as to obtain the morphological features as middle-level features.
[0040] The high-level feature extraction layer 213 is configured to extract semantic features related to the properties of the coating material, including but not limited to material type, surface gloss, coating thickness variation characteristics, such as learning material, color and other high-level semantic features, so as to obtain the semantic features as high-level features.
[0041] Among them, the low-level features are used to filter the differences in surface textures of different products (such as metal and plastic textures); the middle-level features are used to filter the differences in defect sizes caused by different product structures (such as large automobile parts and small household appliance parts); and the high-level features are used to filter the differences in materials caused by different coating processes (such as metal paint and plastic paint). The low-level feature extraction layer corresponds to the Conv1 and Conv2 modules of ResNet50; the middle-level feature extraction layer corresponds to the Conv3 and Conv4 modules of ResNet50; and the high-level feature extraction layer corresponds to the Conv5 module of ResNet50. ResNet50 is a classic deep convolutional neural network with good feature extraction ability and generalization performance. In this way, by corresponding the feature extraction layers of different levels to different modules of ResNet50, an efficient and stable feature extraction network can be quickly constructed, reducing the difficulty of model design and training. The hierarchical structure of the ResNet50 architecture allows different levels of features to be naturally fused together.
[0042] As described above, by setting up low-level, mid-level, and high-level feature extraction layers, features of painted surface images can be extracted from different angles and levels. The low-level feature extraction layer focuses on local details, such as edges and texture. These features are fundamental image information and are crucial for identifying subtle defects such as small scratches and textural anomalies. The mid-level feature extraction layer extracts morphological features of defects, such as geometry, size, and contour, which help accurately describe the defect's appearance and provide an important basis for defect classification. The high-level feature extraction layer extracts semantic features related to coating material properties, such as material type, surface gloss, and coating thickness variation. These features reflect the intrinsic properties and workmanship of the painted product and are important for determining the relationship between defects and materials and processes. This multi-level, multi-type feature extraction approach comprehensively covers the various feature information required for paint surface defect detection. Furthermore, this layered feature extraction approach allows for the extraction of effective features from different levels tailored to the characteristics of different defects, improving the accuracy and reliability of defect detection. This case uses the ResNet50 architecture as a multi-scale feature extraction network, fully leveraging its advantages in image feature extraction. The local detail features extracted by the low-level feature extraction layer provide foundational information for mid-level and high-level feature extraction. The morphological features extracted by the mid-level feature extraction layer further enrich the high-level feature extraction layer's understanding of defects, while the semantic features extracted by the high-level feature extraction layer guide the low-level and mid-level feature extraction layers to focus on more important areas. This hierarchical feature fusion approach helps improve the model's image understanding and enhance defect detection performance. Feature extraction at different levels captures image feature information from different perspectives, and this feature information is universal across images of painted surfaces from different products and processes. These features, extracted by the multi-scale feature extraction submodule, better represent the essential characteristics of the painted surface, reducing the influence of factors such as product material and process on feature extraction, thereby enhancing the model's cross-domain detection capabilities and further improving cross-domain detection and adaptability. For example, when the model is applied to painted products made of different materials, the semantic features related to material properties extracted by the high-level feature extraction layer provide a certain degree of adaptability, while the local detail and morphological features extracted by the low-level and mid-level feature extraction layers ensure basic defect recognition. In actual production, the materials, processes, and production environments of coated products may change. This layered feature extraction approach enables the system to better adapt to these changes. When encountering new coated products or production processes, the system can quickly adapt to new detection requirements by adjusting the weights of feature extraction at different levels. This improves the system's flexibility and adaptability, allowing it to adapt to different production scenarios.
[0043] As a specific implementation, the low-level feature extraction layer 211 is configured to extract local detailed features of the image through a convolutional neural network, which includes a Gaussian difference filter 2111 configured to enhance edge and texture features, and a histogram of oriented gradients extractor 2112 configured to capture local gradient change features. In this way, the Gaussian difference filter 2111 in the low-level feature extraction layer 211 is specifically used to enhance edge and texture features, and these edge and texture features are strengthened through the processing of the Gaussian difference filter, so that the subsequent defect detection can more sensitively capture these subtle changes, improving the extraction ability of low-level features. The histogram of oriented gradients extractor 2112 can capture local gradient change features, which can reflect the change direction and amplitude of the pixel intensity in the image, and is of great significance for identifying the shape and contour of an object. By extracting the histogram of oriented gradients, these local features can be more accurately described, providing more abundant information for subsequent feature analysis and defect recognition.
[0044] The middle-level feature extraction layer 212 is configured to extract morphological features of the defect through a region proposal network, which includes a morphological operation unit 2121 configured to perform dilation, erosion, opening and closing operations to highlight the contour of the defect, and a geometric feature calculator 2122 configured to calculate the area, perimeter and aspect ratio parameters of the defect. In this way, the morphological operation unit 2121 in the middle-level feature extraction layer 212 can highlight the contour of the defect through operations such as dilation, erosion, opening and closing. The dilation operation can expand the defect area, making small defects that are not obvious more clearly visible; the erosion operation can remove some small noise points, making the contour of the defect cleaner. The opening and closing operation combines dilation and erosion operations, which can better smooth the contour of the defect and remove burrs and voids. These morphological operations make the contour of the defect more prominent, facilitating subsequent feature calculation and defect classification. The geometric feature calculator 2122 can calculate the area, perimeter and aspect ratio of the defect. These geometric parameters are important indicators for describing the morphology of the defect, and are of great significance for defect classification and recognition. For example, scratches usually have a longer length and a smaller width, while bubbles may have a circular or elliptical contour. By calculating these geometric parameters, the morphological features of the defect can be more accurately described, providing a basis for defect classification.
[0045] The advanced feature extraction layer 213 is configured to extract material property-related features using a semantic segmentation network. It includes a material classification unit 2131 configured to identify different product substrate materials and a gloss analysis unit 2132 configured to calculate surface gloss variations using a reflectance model. In this way, the material classification unit 2131 in the advanced feature extraction layer 213 is able to identify different product substrate materials. Different materials may exhibit different properties during the painting process, such as water absorption and conductivity, which may affect the quality of the painting and the occurrence of defects. Material classification can better understand the characteristics of the painted product, providing more accurate information for subsequent defect analysis and treatment. For example, different inspection methods and treatment strategies may be required for painted products made of metal and plastic. The gloss analysis unit 2132 calculates surface gloss variations using a reflectance model. Gloss analysis can promptly detect gloss anomalies on the painted surface, providing more comprehensive information for defect detection. For example, if the gloss of a certain area of the painted surface is significantly lower than that of other areas, it may indicate that the coating thickness is insufficient or the surface roughness is high.
[0046] As mentioned above, multi-level feature extraction is combined to form a complete feature system, from low-level edge and texture features to mid-level morphological features, and then to high-level material property features. These features at different levels complement each other and can more comprehensively describe the characteristic information of the coating surface, thereby improving the accuracy of defect detection. For example, for some complex defects, it may be difficult to accurately identify them relying solely on low-level features, but by combining mid-level and high-level features, the type and severity of the defects can be more accurately judged. Since the feature extraction methods at different levels have a certain degree of independence, when the feature extraction at a certain level is disturbed, the features at other levels can still provide useful information. In addition, through multi-level feature extraction, the system can better adapt to different types of coating products and different production environments, thereby improving the versatility and adaptability of the system.
[0047] As a preferred implementation, the advanced feature extraction layer uses an attention mechanism to perform weighted aggregation of multi-channel features. The attention mechanism automatically learns the importance of features from different channels and assigns different weights based on their importance. The weighted features are then aggregated to generate a semantic feature vector containing at least one of the following attributes: Surface gloss features based on highlight area distribution: By analyzing the distribution of highlight areas in the image, features that can reflect the glossiness of the painted surface are extracted.
[0048] Coating thickness characteristics based on color space distribution: The information distribution of different color channels in the color space is used to infer the thickness characteristics of the coating.
[0049] Material type feature based on texture complexity: Different material types are identified according to the complexity of the texture of the painted surface.
[0050] Coating adhesion feature based on defect edge morphology: The morphology of the defect edge is analyzed to determine the adhesion between the coating and the substrate. The multi-channel features include color-related channel features, texture-related channel features, edge-related channel features, and frequency domain-related channel features.
[0051] As mentioned above, the advanced feature extraction layer attention mechanism can automatically focus on the more important feature channels for defect detection and classification, and ignore irrelevant or highly interfering features. By weighting and aggregating multi-channel features, the information from different channels can be comprehensively utilized to generate more representative semantic feature vectors, making the feature vectors more comprehensive in reflecting the various properties of the painted surface. The generated semantic feature vectors contain a variety of attributes related to the painted surface, such as gloss, coating thickness, material type, and coating adhesion, to provide a more comprehensive basis for defect detection and classification, helping to more accurately identify different types of defects, thereby enhancing the accuracy and reliability of defect detection. Since the feature vectors are more accurate and comprehensive, the model can better distinguish between normal and defective surfaces, reducing false positives and false negatives. In addition, the rich semantic feature vectors also support quality traceability and analysis, assisting production managers in making scientific decisions and improving product quality and production efficiency.
[0052] As a specific implementation, the image acquisition module 1 acquires real-time painted product surface images through a high-definition camera and an image sensor; the high-definition camera integrates an adaptive light compensation device 11 that can dynamically adjust light source parameters according to environmental lighting.
[0053] The adaptive light compensation device 11 includes: A spectral sensor 111 configured to analyze the spectral distribution of environmental light in real time; A multi-channel LED light compensation array 112 configured to dynamically adjust the intensity of red, green, blue, and white light sources based on the spectral analysis results; An image preprocessing unit 113 configured to perform light normalization on the acquired images, including histogram equalization and Retinex enhancement.
[0054] As mentioned above, defects on the painted surface are often relatively subtle, such as tiny particles and shallow scratches, which are difficult to capture clearly under poor lighting conditions. The adaptive lighting compensation device can highlight these defect characteristics by optimizing lighting conditions, thereby enhancing the visibility of defects. This allows the detection system to maintain good performance when facing different production scenarios, enhances the system's generalization ability, and reduces system misjudgments and missed judgments caused by environmental changes. Specifically, the spectral sensor 111 analyzes the spectral distribution of ambient light in real time, which is like giving the lighting environment a "comprehensive physical examination" and can accurately understand the various characteristics of the current ambient light. The multi-channel LED fill light array 112 dynamically adjusts the intensity of the red, green, blue, and white light sources based on the spectral analysis results, which is equivalent to tailoring a "fill light solution" for the camera. For example, when the blue light component in the ambient light is insufficient, the fill light array will increase the intensity of the blue light source to ensure that the color of the captured image is accurately restored, avoiding image color cast caused by lighting problems, thereby improving the authenticity and accuracy of the image. The image preprocessing unit 113 performs illumination normalization on the captured image, and histogram equalization is like a "redistribution" of the grayscale distribution of the image, evenly distributing the pixels originally concentrated in certain grayscale ranges to the entire grayscale range, thereby enhancing the contrast of the image. For example, for some images that are partially too dark or too bright due to uneven illumination, histogram equalization can make the light and dark levels of the image richer, and the boundary between the defective area and the normal area clearer. The enhancement of the Retinex image enhancement algorithm can remove the impact of uneven illumination and restore the true color and details of the image, just like putting on a pair of "defog glasses" for the image, making the defect features in the image more prominent. After these two preprocessing steps, the defect detection algorithm can more accurately identify and classify defects, greatly improving the accuracy of detection.
[0055] As a preferred embodiment, the feature decoupling submodule 22 includes: The feature decomposition network 221 is configured to map features at each level to a domain-invariant feature subspace and a domain-specific feature subspace; wherein the feature decomposition network refers to a neural network architecture that decomposes the input feature space into two orthogonal subspaces, which can be specifically implemented using a dual-branch encoder structure, and by sharing the underlying network parameters and branching out independent fully connected layers, the decoupling and separation of the feature space is achieved.
[0056] The feature decomposition network 221 includes: The invariant feature encoder 2211 is configured to generate a defect representation that is insensitive to product type, wherein the defect representation includes gradient features, morphological features, and texture statistical features of the defect edge; A specific feature encoder 2212 is configured to generate feature representations related to materials, processes, or physical properties, including surface reflectivity features, manufacturing process trace features, and material density distribution features; The feature decoupling submodule 22 further includes: Domain adversarial training unit 222 is configured to obfuscate domains / enhance domain invariance through a gradient reversal mechanism. Domain adversarial training refers to a mechanism for eliminating domain-dependent features through adversarial training. This can be achieved by jointly training a gradient reversal layer with a domain classifier, forcing the feature generator to produce domain-indistinguishable feature distributions by reversing the direction of the gradient during backpropagation. A gradient reversal layer is a special network layer that maintains data unchanged during forward propagation and reverses the sign of the gradient during backpropagation. This can be achieved through a custom gradient calculation function that multiplies the gradient output by the domain classifier by a negative coefficient during backpropagation and then feeds it back to the feature generator.
[0057] The domain adversarial training unit 222 includes: A domain classifier 2221 is configured to predict the product domain of the sample source based on domain-specific features; A gradient reversal layer 2222 is configured to reverse the sign of the gradient of the domain classifier 2221 during back propagation, so that the invariant feature encoder 2211 learns a feature representation that is insensitive to the domain, thereby forming an adversarial training mechanism; The decoupled loss function calculation subunit 2223 is configured to simultaneously optimize the defect classification accuracy and the domain confusion degree (domain discrimination error rate) using a loss function to calculate the multi-objective loss; the loss function includes: The defect classification loss term L1 is used to minimize the defect prediction error; The domain adversarial loss term L2 is used to maximize the domain classification error; The multi-objective loss L is the sum of the defect classification loss term and the domain adversarial loss term.
[0058] The loss function formula is: L=L1+(-λ)L2; λ is a weight coefficient, and the gradient inversion layer will multiply the input gradient by -1 when backpropagation, therefore λ takes a negative value. Specifically, in the process of coating product surface image processing, the hierarchical features output by the multi-scale feature extraction network are input into the feature decomposition network, and the domain-invariant features and the domain-specific features are respectively generated through the double-branch encoder. The domain-invariant feature encoder constrains the feature distribution to be irrelevant to the product type, for example, the maximum mean discrepancy loss function is used to align the feature distribution of different product lines; the specific feature encoder retains the reflectivity features related to the material or the texture features related to the process. The domain classifier in the domain adversarial training unit receives the domain-invariant features as input, and the gradient generated by the classifier is backpropagated to the feature encoder through the gradient inversion layer, forcing the encoder to generate features with domain confusion, thereby suppressing the interference of product-specific features on defect classification. The decoupling loss function optimizes the defect classification accuracy and the domain confusion degree at the same time, for example, in the training process, the defect classification loss uses the cross-entropy function to calculate the prediction error, and the domain adversarial loss uses the negative log-likelihood function of the classifier output to calculate the domain discrimination error.
[0059] In implementation, assuming that our detection system is used to detect surface defects of sprayed products from different manufacturers, the sprayed products from different manufacturers differ in spraying process, coating material used, etc. For example, some manufacturers use electrostatic spraying process, and the sprayed products have good surface coating uniformity but may have fine electrostatic adsorbed impurities; some manufacturers use ordinary spray guns for spraying, and the products may have surface sagging. These differences will cause the model to have uneven detection performance on the sprayed products from different manufacturers. Through the feature decoupling submodule 22, we can decompose the features of the sprayed product image into domain-invariant features and domain-specific features. The features learned by the invariant feature encoder, such as gradient features of defect edges, morphological features, and texture statistical features, are applicable to the sprayed products from different manufacturers. For example, regardless of the spraying process and coating material, the gradient change features of the edges of scratch defects appearing on the surface of the sprayed products are similar, and the morphological features such as the length and width of the scratches and the texture statistical features such as the texture roughness of the scratch area also have certain commonalities. These invariant features can help the model accurately identify the common defect types on the sprayed products from different manufacturers. The features learned by the specific feature encoder, such as surface reflectivity features, manufacturing process trace features, and material density distribution features, reflect the characteristics of the sprayed products from different manufacturers. For example, different coating materials used by different manufacturers will cause differences in the reflectivity of the surface of the sprayed products; different spraying processes will leave different process traces on the surface of the products, such as fine electrostatic lines that may be produced by electrostatic spraying and uneven spraying traces that may appear by ordinary spray gun spraying; and the material density distribution features may also differ due to differences in coating materials and spraying processes. The domain adversarial training unit makes the features learned by the invariant feature encoder insensitive to manufacturers through the gradient reversal mechanism. During training, the domain classifier tries to accurately distinguish from which manufacturer the sample comes from according to the domain-specific features, while the gradient reversal layer reverses the gradient sign of the domain classifier, making the features learned by the invariant feature encoder as difficult as possible for the domain classifier to distinguish, thereby enhancing the insensitivity of the features to manufacturers. At the same time, the defect classification loss term ensures that the model can accurately identify defects on the sprayed products. In this way, good detection performance can be achieved on the sprayed products from different manufacturers, improving the generalization ability and accuracy of the model. For example, when facing a sprayed product from a new manufacturer, the model can still accurately identify defects such as scratches and sagging on the product, without a significant decrease in detection performance due to the product coming from a new manufacturer.
[0060] As described above, the feature decoupling submodule can better adapt to the data distribution of different product fields and improve the generalization ability in different product fields by decomposing the features into domain-invariant features and domain-specific features and enhancing the domain invariance using the domain adversarial training mechanism. While enhancing the domain invariance, the feature decoupling submodule ensures the classification accuracy of defects through the defect classification loss term, so that the feature decoupling submodule can accurately identify defects in different product fields. Through the multi-objective loss function, the defect classification accuracy and the domain confusion degree are simultaneously optimized, so that the model can consider both objectives during the training process, thereby optimizing the training process of the feature decoupling submodule.
[0061] As an optional implementation, the small sample adaptation submodule 23 in the embodiment of the application comprises: The meta-learning optimizer 231 is configured to perform gradient update on the model parameters based on the Reptile algorithm, so that the model has the ability to quickly adapt to new fields. Reptile is a simple and efficient meta-learning algorithm that does not need to calculate the second-order derivative at each update like the MAML algorithm, greatly reducing the computational complexity. The meta-learning optimizer refers to the rapid migration of model parameters through the meta-learning framework, which can be implemented by using a model-independent meta-learning based parameter update strategy. The optimizer initializes the parameters in a multi-task scenario, so that the model can complete parameter fine-tuning with only a small number of samples when facing a new field, thereby solving the problem of repeated training in traditional methods.
[0062] The conditional generative adversarial network 232 is configured to generate defect simulation images with diversity according to a small number of samples of the target field, and the simulation images include defect morphologies under different lighting conditions and material characteristics. The conditional generative adversarial network refers to a generative model based on the conditional constraints of the target field, which can be implemented by using a generator network with material attribute labels. The network generates synthetic data consistent with the real defect distribution by fusing the lighting parameters and material characteristics of the target field, which is used to make up for the lack of data in the small sample scenario.
[0063] Specifically, the meta-learning optimizer uses an iterative parameter update mechanism to calculate the parameter update direction using a small number of labeled samples in the target field based on the pre-trained model in the source field. For example, in the automobile coating detection scenario, when the model needs to be migrated to the home appliance coating detection, the optimizer can complete parameter adaptation through three gradient updates. The conditional generative adversarial network generates simulation images containing defects such as scratches and bubbles by inputting the material encoding vector of the target product, such as generating an oxidation defect image under high light conditions on a metal material surface, or generating a crack defect image of a matte coating on a plastic material surface, effectively expanding the diversity of training data.
[0064] As described above, the meta-learning optimizer of the small sample adaptation submodule 23 in this case quickly updates the model parameters based on the Reptile algorithm, enabling the model to adapt to the data distribution of the new domain in a short period of time, so that the model can quickly adjust its own parameters without the need for retraining with a large amount of new domain data, greatly improving the practicality and flexibility of the model. Moreover, the small sample adaptation submodule 23 uses the meta-learning optimizer to enable the model to quickly adapt to the new domain using a small number of target domain samples, reducing the dependence on a large amount of labeled data and reducing the cost of data collection and labeling. Through the conditional generative adversarial network, it is possible to generate a variety of defect simulation images based on a small number of samples in the target domain. These images contain defect morphologies under different lighting conditions and material properties. For example, in the inspection of spray-painted products, various lighting environments and material surfaces may be encountered in actual production. By generating diverse simulated images, the model can learn the defect characteristics under these different conditions, thereby improving the ability to recognize defects in actual scenes. The diverse simulated images allow the model to be exposed to more different situations during the training process, enhancing the model's robustness to various interference factors. In practical applications, factors such as lighting changes and material differences may affect the detection effect of defects. By training with a data set containing diverse simulated images, the model can better cope with these interferences and improve the accuracy and stability of detection.
[0065] As an optional implementation manner, in the embodiment of the present invention, the feedback control module 3 includes: A real-time decision-making unit 31 is configured to generate control instructions based on the detection results, wherein the control instructions include defect location marking, repair path planning, or production line pause signal; The quality analysis unit 32 is configured to generate a defect statistics report across product lines, the report including defect type distribution, frequency trend and process correlation analysis.
[0066] As described above, the real-time decision-making unit of the feedback control module in this case possesses precise positioning and rapid response capabilities. Upon detecting a defect, it quickly marks its location, facilitating rapid location tracking by maintenance personnel or automated equipment. This can, for example, prevent production delays in electronic component manufacturing. In the event of severe or numerous defects, it promptly issues a production line pause signal to prevent defective products from flowing into subsequent stages, minimizing resource waste and increased costs. For example, in automotive manufacturing, this can reduce rework costs and safety risks. Furthermore, it can plan the optimal repair path based on defect type, location, and severity, improving repair efficiency and quality. The quality analysis unit provides a comprehensive understanding of quality status, displaying defect type distribution through cross-product line defect statistics reports, helping companies identify quality weaknesses. Furthermore, comprehensive cross-product line assessments provide management with comprehensive quality information, facilitating the rational allocation of resources, optimizing production layout, and enhancing the company's overall operational efficiency and competitiveness.
[0067] Example 2 like Figure 3 See Figure 3 , Figure 3 This is a flowchart of the steps of the real-time detection method for coating surface defects disclosed in an embodiment of the present invention. Figure 3 As shown, the real-time detection method for coating surface defects may include the following steps: S100: Image acquisition step, which uses a high-definition camera and an adaptive light compensation device to collect images of the surface of the painted product in real time. The specific steps include: Analyze the spectral distribution of ambient light in real time through spectral sensors; According to the results of spectral analysis, the intensity of the red, green, blue and white light sources of the multi-channel LED fill light array is dynamically adjusted; Perform illumination normalization preprocessing on the captured images, including histogram equalization and Retinex enhancement; S200: Multi-scale feature extraction step, using the multi-scale feature extraction network of ResNet50 architecture to extract different levels of features from the preprocessed image. The specific steps include: Extract local detail features of the image through low-level feature extraction layers, including: Use Gaussian difference filter to enhance edge and texture features; Use the oriented gradient histogram extractor to capture local gradient change features; The morphological features of the defects are extracted through the mid-level feature extraction layer, including: Use morphological operation units to perform dilation, erosion, opening and closing operations to highlight defect contours; Use the geometric feature calculator to calculate the area, perimeter, aspect ratio and other parameters of the defect; The advanced feature extraction layer extracts semantic features related to coating material properties, including: Use material classification units to identify different base materials of products; Use the gloss analysis unit to calculate the surface gloss change through the reflectance model; Multi-channel features are weighted and aggregated through the attention mechanism to generate a semantic feature vector containing at least one attribute such as surface gloss, coating thickness, material type, and coating adhesion; S300: Feature decoupling step, mapping the features of each level into two subspaces: domain-invariant and domain-specific. The specific steps include: Generate defect representations that are insensitive to product types through an invariant feature encoder; Generate feature representations related to materials, processes or physical properties through specific feature encoders; Domain confusion is achieved through domain adversarial training units, including: predicting a product field of a feature source using a domain classifier; In back propagation, the gradient direction of the domain classifier is reversed by the gradient reversal layer; A multi-objective loss function is calculated, including a defect classification loss term and a domain adversarial loss term, and is optimized by weighted summation; S400: A small sample adaptation step, with a small amount of labeled samples in the target domain, a pre-trained model in the source domain is used for rapid parameter adjustment, and data synthesis technology is used to generate additional samples to expand the training data, and the specific steps include: Based on the Reptile algorithm, the model parameters are updated by gradient, so that the model has the ability to quickly adapt to new fields; According to a small amount of samples in the target domain, a conditional generative adversarial network is used to generate defect simulation images with diversity, which include defect morphologies under different lighting conditions and material characteristics; S500: Defect detection and classification step, based on the decoupled domain-invariant features and the adapted model, the defects on the coating surface are detected and classified, and the specific steps include: The defect area is located by threshold segmentation or semantic segmentation algorithm; The feature vector of the defect area is extracted, including geometric features, texture features and semantic features; Based on a support vector machine or a neural network classifier, the defect type is classified, including cracks, bubbles, particles, sagging, etc.; S600: Feedback control step, the detection result is transmitted to the control system of the external production line in real time, triggering automatic marking or repair instructions, and the specific steps include: According to the detection result, a control instruction is generated, including defect position marking, repair path planning or production line suspension signal; A defect statistical report across product lines is generated, including defect type distribution, frequency trend and process correlation analysis; Based on the defect statistical report, the detection model parameters are optimized by reinforcement learning algorithm.
[0068] As described above, in the image acquisition link, the environmental light is analyzed in real time by the spectral sensor and the intensity of the light compensation array light source is dynamically adjusted, combined with illumination normalization preprocessing, which effectively eliminates the influence of uneven illumination on image quality, providing a high-quality image basis for subsequent accurate detection. In the multi-scale feature extraction step, ResNet50 architecture is used to extract features from different levels, covering local details, morphological and semantic features, and through attention mechanism aggregation, various information of the coating surface is comprehensively and accurately captured, improving the accuracy of defect detection.
[0069] The feature decoupling step maps the features to two subspaces that are invariant to the domain and specific to the domain, realizes domain confusion through domain adversarial training, enables the model to learn defect representations that are insensitive to product types, and enhances the universality of the model on different coating products. The small sample adaptation step uses the Reptile algorithm and the conditional generative adversarial network to quickly adjust the model parameters and generate diverse simulated images using a small amount of labeled samples, expands the training data, and improves the adaptability of the model to new domains. The defect detection and classification step accurately detects and classifies defect types based on the decoupled features and the adapted model. The feedback control step transmits the detection results in real time and generates control instructions to realize automatic labeling or repair, while generating a defect statistical report, and uses a reinforcement learning algorithm to optimize the model parameters, forming a closed-loop detection and optimization system that continuously improves the accuracy and efficiency of detection and enhances the overall performance of the product quality and production line.
[0070] In summary, the present application discloses a coating surface defect real-time detection system and method based on deep learning, aiming to improve cross-product line detection adaptability, reduce model training cost and enhance detection stability under complex lighting through multi-scale feature extraction, feature decoupling and small sample adaptation technology. The system acquires coating surface images through an image acquisition module, extracts low-level, intermediate and high-level features using a multi-scale feature extraction submodule of the ResNet50 architecture, decomposes the features into domain-invariant defect features and domain-specific features through a feature decoupling submodule, and suppresses interference features through adversarial training. The small sample adaptation submodule combines the Reptile algorithm and the conditional generative adversarial network to realize rapid parameter adjustment and data enhancement with a small amount of labeled samples, and the feedback control module triggers production line repair instructions in real time and generates a quality report. The system eliminates the influence of lighting differences through an adaptive lighting compensation device, forming a "detection - decision - optimization" closed-loop mechanism. This invention effectively solves the problems of cross-domain detection performance degradation, poor small sample adaptability and false detection caused by lighting interference in the prior art, reduces the cross-product line detection false detection rate, reduces the sample demand, improves the detection accuracy, and significantly improves the industrial quality inspection efficiency and deployment flexibility.
[0071] Embodiment three Please refer to Figure 4 , Figure 4 is a structural schematic diagram of a control system disclosed by an embodiment of the present application. As Figure 4 , the control system can include: a memory 201 storing executable program codes; a processor 202 coupled with the memory 201; wherein the processor 202 invokes the executable program codes stored in the memory 201 to execute Figure 1 a coating surface defect real-time detection system.
[0072] Example 4 An embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute Figure 3 Real-time detection method for coating surface defects.
[0073] Example 5 An embodiment of the present invention further discloses a computer program product, wherein when the computer program product is run on a computer, the computer is caused to execute part or all of the steps of the methods in the above method embodiments.
[0074] As mentioned above, this case protects a real-time detection system and method for coating surface defects based on deep learning. All technical solutions that are identical or similar to those in this case should be deemed to fall within the scope of protection of this case.
Claims
1. A real-time detection system for coating surface defects based on deep learning, characterized by: include: An image acquisition module (1) is used to acquire images of the surface of the coating product in real time; Cross-product line defect detection module (2), which includes: a multi-scale feature extraction submodule (21), configured to extract features from the collected surface image of the coated product to extract features at different levels; a feature decoupling submodule (22), configured to decompose the extracted features of each level into domain-invariant defect features that are independent of product type and domain-specific features that are related to the material, process or physical properties of the product, and suppress the influence of the domain-specific features on defect classification through adversarial training; The small sample adapter module (23) uses a small number of labeled samples in the target domain to quickly adjust parameters based on the pre-trained model of the source domain, and uses data synthesis technology to generate additional samples to expand the training data to achieve detection in the target domain; The feedback control module (3) is used to transmit the detection results to the control system of the external production line in real time, triggering automatic marking or repair instructions.
2. The real-time detection system for coating surface defects according to claim 1, characterized in that: The multi-scale feature extraction submodule (21) includes a multi-scale feature extraction network using a ResNet50 architecture; the multi-scale feature extraction network includes: A low-level feature extraction layer (211) is configured to extract local detail features of the coating surface to use these features as low-level features; a mid-level feature extraction layer (212) configured to extract morphological features of the defects to use these features as mid-level features; The high-level feature extraction layer (213) is configured to extract semantic features related to coating material properties to use these features as high-level features.
3. The real-time detection system for coating surface defects according to claim 2, characterized in that: The low-level feature extraction layer (211) is configured to extract local detail features of the image through a convolutional neural network, and includes: a Gaussian difference filter (2111) configured to enhance edge and texture features, and a directional gradient histogram extractor (2112) configured to capture local gradient change features; The intermediate feature extraction layer (212) is configured to extract morphological features of the defect through a region proposal network, and includes: a morphological operation unit (2121) configured to perform dilation, erosion, and opening and closing operations to highlight the defect outline; a geometric feature calculator (2122) configured to calculate the area, perimeter, and aspect ratio parameters of the defect; The advanced feature extraction layer (213) is configured to extract material property related features through a semantic segmentation network, and includes: a material classification unit (2131) configured to identify different base materials of the product, and a gloss analysis unit (2132) configured to calculate surface gloss changes through a reflectance model.
4. The real-time detection system for coating surface defects according to claim 2 or 3, characterized in that: The high-level feature extraction layer aggregates multi-channel features through the weighted attention mechanism to generate a semantic feature vector containing at least one of the following attributes: Surface gloss characteristics based on the distribution of highlight areas; Coating thickness characteristics based on color space distribution; Material type characteristics based on texture complexity; Coating adhesion characteristics based on defect edge morphology.
5. The real-time detection system for coating surface defects according to claim 1, characterized in that: The image acquisition module (1) acquires images of the surface of the coated product in real time through a high-definition camera and an image sensor; the high-definition camera is integrated with an adaptive illumination compensation device (11) capable of dynamically adjusting light source parameters according to ambient illumination.
6. The real-time detection system for coating surface defects according to claim 5, characterized in that: The adaptive illumination compensation device (11) comprises: A spectral sensor (111) configured to analyze the spectral distribution of ambient light in real time; A multi-channel LED fill light array (112) is configured to dynamically adjust the intensity of the four-color light sources of red, green, blue and white according to the spectrum analysis results; The image pre-processing unit (113) is configured to perform illumination normalization processing on the collected image, wherein the illumination normalization processing includes histogram equalization and Retinex enhancement.
7. The real-time detection system for coating surface defects according to claim 1, characterized in that: The feature decoupling submodule (22) includes: A feature decomposition network (221) is configured to map features at each level into two subspaces: domain-invariant and domain-specific. The feature decomposition network (221) includes: an invariant feature encoder (2211) configured to generate a defect representation that is insensitive to product type; A specific feature encoder (2212) configured to generate a feature representation related to a material, process, or physical property; A domain adversarial training unit (222) is configured to implement domain confusion through a gradient reversal mechanism, comprising: A domain classifier (2221), configured to predict the product domain of the feature source; a gradient reversal layer (2222) configured to reverse the gradient direction of the domain classifier (2221) during back propagation to form an adversarial training mechanism; The decoupling loss function calculation subunit (2223) is configured to optimize the defect classification accuracy and the domain confusion degree using the loss function to calculate the multi-objective loss; the loss function includes: Defect classification loss term, used to minimize the defect prediction error; Domain adversarial loss term, used to maximize domain classification error; The multi-objective loss is the sum of the defect classification loss term and the domain adversarial loss term.
8. The real-time detection system for coating surface defects according to claim 1, characterized in that: The small sample adapter module (23) includes: A meta-learning optimizer (231) is configured to perform gradient updates on model parameters based on the Reptile algorithm, enabling the model to quickly adapt to new domains; A conditional generative adversarial network (232) is configured to generate diverse defect simulation images based on a small number of samples in a target domain, wherein the simulation images include defect morphologies under different lighting conditions and material properties.
9. The real-time detection system for coating surface defects according to claim 1, characterized in that: The feedback control module (3) comprises: A real-time decision-making unit (31) is configured to generate a control instruction based on the detection result, wherein the control instruction includes a defect position mark, a repair path plan, or a production line pause signal; The quality analysis unit (32) is configured to generate a defect statistical report across product lines, the report including defect type distribution, frequency trend and process correlation analysis.
10. A method for real-time detection of coating surface defects, characterized in that: The detection system according to any one of claims 1 to 9 comprises the following steps: S100: Image acquisition step, using a high-definition camera and an adaptive illumination compensation device to capture images of the surface of the painted product in real time; S200: Multi-scale feature extraction step, using the multi-scale feature extraction network of ResNet50 architecture to extract different levels of features from the preprocessed image; S300: Feature decoupling step, mapping the features of each level into two subspaces: domain-invariant and domain-specific; S400: Small sample adaptation step, using a small number of labeled samples in the target domain, quickly adjusts parameters based on the pre-trained model in the source domain, and uses data synthesis technology to generate additional samples to expand the training data; S500: Defect detection and classification step, based on the decoupled domain-invariant features and the adapted model, detects and classifies coating surface defects; S600: Feedback control step, transmitting the detection results to the control system of the external production line in real time, triggering automatic marking or repair instructions.
Citation Information
Patent Citations
Coating defect detection system and method based on machine vision
CN113030108A
Intelligent coating defect detection and repair system
CN119757401A
Event detection model, event detection method, system, equipment and medium
CN118606833A
Paster abnormity detection method and system based on flexible circuit board
CN119067936A
Cited By
EPE co-extrusion adhesive film surface defect detection system based on image recognition
CN121392548A
High-speed particle intelligent identification and fault diagnosis method based on electrostatic-image feature fusion
CN122196516A
