Industrial Surface Defect Detection Method and Equipment Based on Unsupervised Architecture-Level Domain Adaptive Framework
Patent Information
- Application Number
- CN202510769456.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2045-06-10
AI Technical Summary
[0006]针对现有技术的以上缺陷或改进需求,本发明提供了一种基于无监督架构级域自适应框架的工业表面缺陷检测方法及设备,其旨在解决现有缺陷检测方法缓解域偏移时性能下降的解决方式的时间及劳动力成本较高的问题
[0033]1.使用DINOv2视觉大模型辅助教师NAS分支为无标签的工业产品的表面图像生成混合伪标签,混合伪标签指导学生NAS分支进行NAS搜索,进而实现了工业表面缺陷检测,其中所述解码器用于将DINOv2视觉大模型获取的编码特征还原为原始图像大小的分割标签,如此无需为每个新的目标域数据手动重新注释大量像素级缺陷样本,避免了大量的时间和劳动力投入,降低了时间成本及劳动力成本,改变了以往工业质量检测中严重依赖人工标注数据的局面,减轻了人力负担,缩短了检测模型开发周期,能够更为敏捷的部署在动态生产环境中。同时,使用DINOv2视觉大模型辅助混合伪标签生成,减少了跨域重建过程中的特征不匹配,有效解决了因历史知识对源数据过拟合而导致的潜在不匹配问题,使双分支自适应框架在不同数据分布的目标域中都能保持良好的检测性能,增强了泛化能力和鲁棒性。
Smart Images

Figure CN120766089B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of defect detection technology, and more specifically, relates to an industrial surface defect detection method and device based on an unsupervised architecture-level domain adaptive framework. Background Technology
[0002] Industrial surface defect detection is a core component of quality control in smart manufacturing. While deep learning-based methods offer advanced defect detection performance, their effectiveness remains limited by manually customized network architectures. Specialized defects—such as cracks on metal surfaces or scratches on electronic components—require specialized neural architectures and fine-tuned parameters for optimal identification. However, current methods heavily rely on human expertise in architecture design and hyperparameter optimization, often requiring days or even weeks of iterative refinement. This dependence on expert intervention and extended development cycles hinder the agile deployment of detection models in dynamic production environments.
[0003] Against this backdrop, Neural Architecture Search (NAS) offers a promising solution for overcoming the bottlenecks in network design. By treating network construction as an optimization problem within a predefined search space, NAS can automatically generate high-performance networks tailored to the features of specific datasets. Compared to traditional manual design paradigms, NAS not only reduces the complexity of architecture customization but also improves the efficiency of customization in complex inspection tasks. Recent studies have shown that NAS-generated models outperform manually designed networks in various surface defect detection applications, such as photovoltaic cell defect detection, steel defect identification, and wood veneer inspection. These findings highlight the potential of NAS in reducing the labor-intensive nature of network design in industrial quality inspection systems.
[0004] Despite its advantages, NAS's data-driven nature presents a fundamental challenge: architecture-data co-adaptation. NAS assumes that the data distributions in the training and testing domains remain identical, but this assumption clashes with real-world industrial environments. In actual manufacturing environments, factors such as batch variations, process parameter adjustments, imaging condition fluctuations, and equipment aging inevitably lead to domain variations in the data distribution. Because NAS searches for architectures specifically optimized for training data (source domain data), these models risk encountering architecture-feature mismatches when exposed to changes in the distribution of newly acquired detection data (target domain data), resulting in performance degradation. Existing NAS research primarily assumes a static data distribution, failing to address the inherent data variability in industrial defect detection. Ensuring the robustness of the searched model in the presence of domain shifts remains an unresolved challenge.
[0005] A simple solution to mitigate performance degradation due to domain shift is to reapply the NAS process for each new target domain, thereby obtaining a new detection network for a specific subtask. However, this approach has two key drawbacks: (1) it requires manually re-annotating a large number of pixel-level defect samples for the target domain, resulting in significant time and labor costs; and (2) it ignores the potential correlation between historical NAS search models and the current task. In practice, domain changes in industrial environments (e.g., batch changes, production updates, or equipment wear and tear) often exhibit inherent correlations rather than being completely independent. The inability to leverage cross-domain prior search knowledge leads to resource inefficiency and redundant searches. Summary of the Invention
[0006] In view of the above-mentioned defects or improvement needs of the existing technology, the present invention provides an industrial surface defect detection method and device based on an unsupervised architecture-level domain adaptive framework, which aims to solve the problems of high time and labor costs in the existing defect detection methods for mitigating performance degradation when the domain shifts.
[0007] To achieve the above objectives, according to one aspect of the present invention, an industrial surface defect detection method based on an unsupervised architecture-level adaptive framework is provided, the method comprising the following steps:
[0008] The DINOv2 visual large model is used to assist the teacher NAS branch in generating hybrid pseudo-labels for surface images of unlabeled industrial products. The hybrid pseudo-labels guide the student NAS branch to perform NAS search, thereby realizing the detection of industrial surface defects. The teacher NAS branch and the student NAS branch form a bi-branch adaptive framework, and both the teacher NAS branch and the student NAS branch are composed of an initialized search space. The DINOv2 visual large model is equipped with a decoder.
[0009] Furthermore, the search space is composed of multiple stacked repeating basic units. Each basic unit is a directed acyclic graph containing N nodes, and there are multiple candidate operations between each pair of adjacent nodes. All possible operations between each node are introduced into the architecture parameter α, which makes the search space continuous. Then, the architecture parameter α is updated through gradient descent, and the operation with the highest weight is selected to construct the optimal subnet A(α), so that the architecture parameter α and the corresponding weight parameters can be optimized through gradient descent.
[0010] Furthermore, the original defect images of labeled industrial products are used as source domain data to form the source domain, and the newly obtained surface images of unlabeled industrial products are used as target domain data to form the target domain; during the initialization of the search space, the source domain network A is... s Architecture parameter α s Mapping to the search space, the source domain network A sThe weight parameter w is further inherited into the search space, making the search space evolve into a search space containing source domain search knowledge.
[0011] Furthermore, before generating hybrid labels, the parameters of the decoder are adjusted based on the source domain data to establish a mapping relationship between the general features obtained from the DINOv2 visual large model and defect detection, thereby achieving task-level semantic alignment.
[0012] Furthermore, the DINOv2 visual big model and the teacher NAS branch independently process the unlabeled target domain data X. t Generate prediction probability distribution and Then, calculate separately and The information entropy corresponding to each pixel in the image;
[0013] Next, based on the obtained information entropy, a target domain pseudo-label is generated through an entropy-guided selection mechanism. Target domain pseudo-tags This is a mixed tag.
[0014] Furthermore, the NAS domain adaptation loss function during the search process is:
[0015] L total =β·L s +γ*L m
[0016] Where β and γ represent the balance coefficients of the balance loss; L s Provides a portion of the supervised loss for labeled source domain data; L m This is a mixed supervision loss.
[0017] Furthermore, the steps for obtaining the NAS domain adaptation loss function are as follows:
[0018] First, the labeled source domain data provides part of the supervised loss:
[0019] L s =Loss(Y) s ,y pred )
[0020] Loss is composed of loss functions commonly used in industrial defect detection, Y s The label representing the source domain data, y pred This represents the result predicted by the NAS network;
[0021] Next, leveraging the cross-domain feature association between the source and target domain data, a two-branch adaptive framework is used to generate pseudo-labels for the target domain data, building upon the source domain supervised loss. Thus, an unsupervised loss function for the target domain is constructed:
[0022]
[0023] Subsequently, a class-level fusion strategy was used to process the image and label pairs (X) of the source domain data. s ,Y s ) and the image and label pairs of the target domain data Perform random classification mixing:
[0024]
[0025] Among them, (X) m ,Y m ) represent the mixed image and its corresponding label set, It is a dynamically and randomly selected classification mask with values in [0,1]; based on Defined unsupervised loss L t Capable of being mixed data (X) m ,Y m Update to hybrid supervised loss L m This leads to the NAS domain adaptation loss function, where:
[0026] L m =Loss(Y) m ,y pred ).
[0027] Furthermore, the process of NAS exploring the search space is essentially the process of applying the loss function L... total Under supervision, the process of updating the architecture parameters α and the corresponding weight parameters w using gradient descent backpropagation is as follows:
[0028]
[0029] Where τ represents the learning rate.
[0030] The present invention also provides an industrial surface defect detection system based on an unsupervised architecture-level adaptive framework. The system includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the industrial surface defect detection method based on the unsupervised architecture-level adaptive framework as described above.
[0031] The present invention also provides a computer-readable storage medium storing machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the industrial surface defect detection method based on an unsupervised architecture-level adaptive framework as described above.
[0032] In summary, compared with the prior art, the industrial surface defect detection method and equipment based on an unsupervised architecture-level domain adaptive framework provided by this invention have the following advantages:
[0033] 1. The DINOv2 visual large-scale model is used to assist the teacher's NAS branch in generating hybrid pseudo-labels for unlabeled industrial product surface images. These hybrid pseudo-labels then guide the student's NAS branch in performing NAS searches, thereby achieving industrial surface defect detection. The decoder is used to restore the encoded features acquired by the DINOv2 visual large-scale model to segmentation labels of the original image size. This eliminates the need for manually re-annotating a large number of pixel-level defect samples for each new target domain, avoiding significant time and labor costs. It changes the previous reliance on manually labeled data in industrial quality inspection, reducing manpower burden, shortening the detection model development cycle, and enabling more agile deployment in dynamic production environments. Simultaneously, using the DINOv2 visual large-scale model to assist in hybrid pseudo-label generation reduces feature mismatch during cross-domain reconstruction, effectively solving the potential mismatch problem caused by overfitting historical knowledge to source data. This allows the dual-branch adaptive framework to maintain good detection performance in target domains with different data distributions, enhancing generalization ability and robustness.
[0034] 2. During the initialization of the search space, the source domain network A is... s Architecture parameter α s Mapping to the search space, the source domain network A s The weight parameter w is further inherited into the search space, making the search space evolve into a search space containing source domain search knowledge. This source domain search knowledge inheritance mechanism makes full use of historical search experience, transfers historical search parameters to the target domain, avoids a complete re-search for each new domain, reduces redundant calculations and resource waste, improves resource utilization efficiency, and makes NAS more economical and sustainable in industrial applications.
[0035] 3. By incorporating all possible operations between each node into the architecture parameter α, the search space is made continuous. The architecture parameter α is updated through gradient descent, and the operation with the highest weight is selected to construct the optimal subnet A(α). This effectively transforms the discrete search space into a differentiable space, allowing the architecture parameter α and the corresponding weight parameters to be optimized through gradient descent.
[0036] 4. Before generating hybrid labels, the parameters of the decoder are adjusted based on the source domain data to establish a mapping relationship between the general features obtained from the DINOv2 visual big model and defect detection, thereby achieving task-level semantic alignment. At the same time, the decoding process of the DINOv2 auxiliary judgment branch can understand the surface defect detection task. During the adjustment process, the weight parameters of DINOv2 itself are kept frozen to ensure that the visual features it extracts are not affected by the distribution of the source domain data.
[0037] 5. Considering that the quality of pseudo-labels directly determines the performance of NAS cross-domain reconstruction, and that NAS is essentially a data-driven method, its source domain network forms a highly compatible mapping relationship with the source domain features, directly using the teacher NAS branch containing source domain knowledge to generate pseudo-labels for target domain data can easily lead to feature space mismatch due to differences in inter-domain distribution during the search process based on source domain search knowledge, thus affecting the quality of pseudo-label generation. To address this issue, the DINOv2 visual large model is introduced to assist in generating hybrid labels. By integrating the generalization representation advantages of the visual large model with the defect identification capabilities of the teacher NAS branch, a dual-path collaborative hybrid pseudo-label generation method is constructed, thereby ensuring the quality of pseudo-label generation, bridging the challenges brought by inter-domain differences, and providing a more accurate optimization direction for unsupervised cross-domain search reconstruction.
[0038] 6. Calculate separately and The information entropy of each pixel is used to generate pseudo-labels for the target domain through an entropy-guided selection mechanism. Target domain pseudo-tags This is a hybrid label, so an information entropy-based fusion strategy is used to effectively integrate these predicted probabilities.
[0039] 7. A NAS domain adaptation loss function was designed based on the real labels of the source domain data and the pseudo labels of the target domain data to guide the specific search of the search space.
[0040] 8. Leveraging the cross-domain feature association between source and target domain data, and building upon the source domain supervised loss, a bipartite adaptive support framework is used to generate pseudo-labels for the target domain data. This allows for the construction of an unsupervised loss for the target domain, enabling the NAS search domain to adapt to the features of the unlabeled target domain.
[0041] 9. Considering that changes in industrial production line data may cause differences in background texture or defect features of the images to be inspected, a class-level blending strategy is used to blend the image and label pairs (X...) of the source domain data. s ,Y s ) and the image and label pairs of the target domain data By performing random classification and mixing, the search process of NAS domain adaptation is enhanced to adapt to changes in the background and to identify features different from defects.
[0042] 10. The process of NAS exploring the search space is the process of applying the loss function L... total Under supervision, the process of updating the architecture parameters α and corresponding weight parameters w using gradient descent backpropagation is employed. This backpropagation process applies only to the student NAS branch. Simultaneously, the teacher NAS branch generates pseudo-labels and updates its parameters using the exponential moving average (EMA) of α and w in the student NAS branch network to ensure the stability of knowledge transfer. Therefore, the entire search process can be performed without actual target domain labels. Attached Figure Description
[0043] Figure 1 This is a flowchart of an industrial surface defect detection method based on an unsupervised architecture-level domain adaptive framework provided by the present invention. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0045] Neural Architecture Search (NAS) enables automatic optimization of network design, significantly improving the efficiency and performance of surface defect detection using manually customized models. However, its data-driven nature heavily relies on the assumption of the same training-test data distribution, making it susceptible to performance degradation under varying industrial data conditions. Fluctuations in data distribution domains caused by product batches, manufacturing processes, or environmental factors often compromise detection reliability. To address this limitation, this invention proposes an architecture-level unsupervised adaptive framework for domain-shifted surface defect detection. The overall approach extends the traditional NAS training paradigm by integrating an unsupervised domain adaptation (UDA) search workflow: a two-branch teacher-student structure is designed within a self-training UDA pipeline. The teacher branch generates pseudo-labeled target data to guide the architecture search of the student branch, thus achieving a label-free NAS process for the target domain. Building upon this, a source domain search knowledge inheritance mechanism is proposed to reduce redundant computation and resource waste. By considering the correlation between cross-domain detection data, this mechanism solves the problem that traditional NAS methods require a complete re-search for each new domain. Finally, to address the potential mismatch caused by overfitting of historical knowledge to the source data during the adaptation process, a bias correction module based on Visual Large Model (VFM) was employed. This module utilizes DINOv2 as an auxiliary branch for pseudo-label generation, stabilizing the optimization process during search and reconstruction. It should be noted that this invention achieves architecture-level knowledge transfer by dynamically reconstructing the topology and weight parameters of the optimal network in the source domain to generate a target domain-specific detection network. Unlike traditional methods, this approach does not rely on simple weight parameter updates, incremental network adjustments, or manual redesign of the detection model. This method can automatically complete network reconstruction and cross-domain application without relying on new domain labels when production line quality inspection data changes. This not only significantly reduces the cost of expert annotation and network redesign in industrial applications but also ensures the adaptability and high efficiency of the detection model on new data.
[0046] This invention mainly comprises four steps: network framework construction, search space initialization, pseudo-label generation, and search space exploration. First, the network framework is defined, designing a dual-branch teacher-student NAS network structure. Each branch consists of an independent and identical NAS search space, initialized using the same search space. The student NAS branch updates the architecture and weight parameters in the search space via gradient descent, while the teacher NAS branch generates pseudo-labels for unlabeled target domain data and updates these parameters using an exponential moving average of the architecture and weight parameters of the student branch NAS network to ensure the stability of knowledge transfer. During search space initialization, to enable the domain adaptation search process to reconstruct based on historical search knowledge rather than repeatedly searching from scratch, thus improving cross-domain adaptation efficiency, a parameter sharing mechanism is introduced. This mechanism inherits the search knowledge from the source domain network into the original search space, constructing a search space with prior knowledge to quickly find the optimal solution for the target domain. In the process of generating pseudo-labels for unlabeled target domain data, a bias correction mechanism based on a large visual model is introduced. By integrating the generalization representation advantages of the large visual model with the defect identification capabilities of the teacher's NAS branch, a hybrid pseudo-label generation method with dual-path collaboration is constructed. This ensures the quality of pseudo-label generation, bridges the challenges posed by inter-domain differences, and provides a more accurate optimization direction for unsupervised cross-domain search reconstruction. Ultimately, under the joint supervision of source domain data and corresponding real labels, as well as target domain data and corresponding pseudo-labels, the search process completes the exploration and reconstruction of the search space containing source domain knowledge points, thereby achieving an unsupervised architecture-level transformation from the source domain network to the target domain network.
[0047] Please see Figure 1 This invention provides an industrial surface defect detection method based on an unsupervised architecture-level adaptive framework. The detection method mainly includes the following steps:
[0048] The DINOv2 visual large model is used to assist the teacher NAS branch in generating hybrid pseudo-labels for surface images of unlabeled industrial products. The hybrid pseudo-labels guide the student NAS branch to perform NAS search, thereby realizing the detection of industrial surface defects. The teacher NAS branch and the student NAS branch form a bi-branch adaptive framework, and both the teacher NAS branch and the student NAS branch are composed of an initialized search space. The DINOv2 visual large model is equipped with a decoder.
[0049] The decoder is used to restore the encoded features obtained from the DINOv2 large visual model to segmentation labels of the original image size. The teacher NAS branch and the student NAS branch each adopt independent but identical search space configurations and are initialized using a common-source search space strategy.
[0050] The search space A consists of multiple stacked repeating basic units. Each basic unit is a directed acyclic graph containing N nodes. There are multiple candidate operations (such as convolution and pooling) between each pair of adjacent nodes. By selecting the candidate operations and their connections within the basic unit, the optimal performance subnet can be determined within the search space. To ensure gradient descent can be successfully applied to the search process in this discrete search space, this invention introduces all possible operations between each node into the architecture parameter α, making the search space continuous. At this point, the number of nodes n in the basic unit... j It can be expressed mathematically as:
[0051]
[0052] in Indicates from node n i to node n j The weighted sum of all candidate operations, α o Let α represent the architecture parameters associated with the candidate operations. At this point, the architecture parameters α can be updated using gradient descent, and the operation with the highest weight can be selected to construct the optimal subnet A(α). This effectively transforms the discrete search space into a differentiable space, allowing the architecture parameters α and the corresponding weight parameters to be optimized through gradient descent.
[0053] In this implementation, the original defect images of industrial products serve as the source domain data, while the newly obtained surface images of unlabeled industrial products serve as the target domain data. In this embodiment, the operating conditions corresponding to the surface images of the unlabeled industrial products differ from those corresponding to the defect images. To improve the efficiency of cross-domain search by enabling domain adaptation search based on historical search knowledge rather than repeatedly searching from scratch, an inheritance mechanism based on source domain search knowledge is used during the initialization of the search space to transfer historical search parameters to the target domain.
[0054] Specifically, source domain network A s Architecture parameter α s This is mapped into the search space A. This process applies operation-specific masks to selectively preserve active architectural components in the source domain network while suppressing other candidate operations. Specifically, for each connected node n... i and n j Candidate operations o∈O, define initial architecture parameters α (i,j) (o) is:
[0055]
[0056] Next, the source domain network A s The weight parameter w is further inherited into the search space A. For node n i and n jFor each operation o on the edge between them, the weight parameter w (i,j) The initialization rule for (o) is defined as follows:
[0057]
[0058] By inheriting the source domain network A s weight w s (i,j) (o) and randomly initialize unexplored operations. This process ensures the stability of knowledge transfer while preserving the flexibility of exploration.
[0059] Based on the above steps, the original search space A further evolves into a search space A(α) containing source domain search knowledge. s ,w s Therefore, the NAS process is reformulated as a reconstruction task, that is, refactoring the source network A. s Evolved into target network A t Instead of starting from scratch and directly searching the target domain A t .
[0060] To enable architecture domain adaptation without target domain labels when source domain data features shift, thus reducing the cost of manual re-labeling, a self-training approach is adopted to explore the NAS search space. Specifically, during the NAS search process, the teacher branch generates pseudo-labels for the unlabeled target domain data to guide the student branch's NAS search, thereby achieving a label-free NAS search process for the target domain data.
[0061] Considering that the quality of pseudo-labels directly determines the performance of NAS cross-domain reconstruction, and that NAS is essentially a data-driven method where the source domain network forms a highly compatible mapping with the source domain features, directly using the teacher NAS branch containing source domain knowledge to generate pseudo-labels for the target domain data can easily lead to feature space mismatch due to differences in inter-domain distribution during the search process based on source domain search knowledge, thus affecting the quality of pseudo-label generation. To address this issue, an additional bias correction mechanism based on a large visual model is introduced. By integrating the generalization representation advantages of the large visual model with the defect identification capabilities of the teacher NAS branch, a dual-path collaborative hybrid pseudo-label generation method is constructed. This ensures the quality of pseudo-label generation, bridges the challenges posed by inter-domain differences, and provides a more accurate optimization direction for unsupervised cross-domain search reconstruction.
[0062] The steps for generating hybrid pseudo-tags are as follows:
[0063] First, an auxiliary decision branch based on the DINOv2 visual large model is introduced as a pseudo-label. The decoder equipped for the DINOv2 visual large model in this invention consists of three 4×4 deconvolutional layers and one 1×1 convolutional layer. The decoder is used to restore the encoded features obtained by the DINOv2 visual large model into segmentation labels of the original image size.
[0064] To ensure the decoding process of the DINOv2 visual model's auxiliary decision branch understands the surface defect detection task, the parameters of the DINOv2 visual model's decoder were fine-tuned before use. This involved 10 rounds of source domain data-supervised decoding to establish a mapping between the general features acquired from the DINOv2 visual model and the defect detection task, achieving task-level semantic alignment. It's important to note that the weight parameters of the DINOv2 visual model itself were frozen during the fine-tuning phase to ensure that the visual features extracted by the DINOv2 visual model were not affected by the distribution of the source domain data.
[0065] After fine-tuning, the DINOv2 auxiliary branch and the teacher NAS branch independently target the unlabeled target domain data X. t Generate prediction probability distribution and
[0066] To effectively integrate these predicted probabilities, an information entropy-based fusion strategy was used. Specifically, for each pixel, the following calculations were performed: and The information entropy of each pixel is used to quantify the prediction reliability of each branch:
[0067]
[0068] Where H Branch (h,w) represents the uncertainty of the predicted probability distribution at the measured pixel location (h,w).
[0069] Finally, pseudo-labels for the target domain are generated through an entropy-guided selection mechanism. (Hybrid pseudo-tags):
[0070]
[0071] Where the subscript c represents the target image X t The pixel classification index at position (h, w) uses a dynamic selection mechanism that employs pixel-wise minimum entropy decision-making to ensure that the most reliable prediction result is selected for each pixel. In other implementations, the average or the label with the best prediction reliability can be used as a hybrid pseudo-label.
[0072] By leveraging the complementary strengths of the DINOv2 auxiliary branch and the teacher NAS branch, the hybrid pseudo-label generation method can effectively correct biases in pseudo-labels.
[0073] The dual-branch adaptive framework completes the architectural adaptation from the source domain model to the target domain model. It designs a self-training process that does not require target domain labels. That is, during the NAS search process, the teacher branch generates pseudo-labels for the unlabeled target domain data to guide the NAS search of the student branch, thereby realizing the NAS search process for target domain data without labels.
[0074] In one implementation, based on the true labels of the source domain data and the pseudo labels of the target domain data, a NAS domain adaptation loss function is designed during the search process to guide the specific exploration of the search space. The specific design steps are as follows:
[0075] First, source domain data with accurate labels provides part of the supervised loss:
[0076] L s =Loss(Y) s ,y pred )
[0077] Loss can be composed of loss functions commonly used in industrial defect detection, such as the cross-entropy loss function. s The exact label of the source domain data, y pred This represents the result predicted by the NAS network.
[0078] Next, to adapt the NAS search domain to the features of the unlabeled target domain, a two-branch adaptive framework is used to generate pseudo-labels for the target domain data, leveraging the cross-domain feature association between the source and target domain data, based on the source domain supervised loss. Thus, an unsupervised loss function for the target domain is constructed:
[0079]
[0080] Considering that changes in industrial production line data may cause differences in background texture or defect features in the images to be inspected, to enhance the adaptability of the NAS domain adaptation search process to background changes and its ability to identify features different from defects, a class-level fusion strategy is used to combine the image and label pairs (X) of the source domain data. s ,Y s ) and the image and label pairs of the target domain data Perform random classification mixing:
[0081]
[0082] Among them, (X) m ,Y m) represent the blended image and its corresponding label set, respectively. Here, It is a dynamically and randomly selected classification mask with values in the range [0,1]. Specifically:
[0083] when At that time, X m From X s Select the pixels marked as normal pixels, and the remaining pixels are selected by X. t filling;
[0084] when At that time, X m From X s Select the defect area, and the remaining pixels are determined by X. t filling.
[0085] Therefore, based solely on Defined unsupervised loss L t Data can be mixed (X) m ,Y m Update to hybrid supervised loss L m :
[0086] L m =Loss(Y) m ,y pred )
[0087] Then, the loss function for the NAS search process is obtained:
[0088] L total =β*L s +γ*L m
[0089] Where β and γ represent the balance coefficients of the balance loss.
[0090] Therefore, the process of NAS exploring the search space is to explore the loss function L. total Under supervision, the process of updating the architecture parameters α and the corresponding weight parameters w using gradient descent backpropagation is as follows:
[0091]
[0092] Where τ represents the learning rate.
[0093] The backpropagation process described above applies only to the student NAS branch. Meanwhile, the teacher NAS branch generates pseudo-labels and updates its own parameters using the exponential moving average (EMA) of α and w from the student NAS branch to ensure the stability of knowledge transfer. Therefore, the entire search process can be performed without actual target domain labels.
[0094] The present invention also provides an industrial surface defect detection system based on an unsupervised architecture-level adaptive framework. The system includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the industrial surface defect detection method based on the unsupervised architecture-level adaptive framework as described above.
[0095] The present invention also provides a computer-readable storage medium storing machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the industrial surface defect detection method based on an unsupervised architecture-level adaptive framework as described above.
[0096] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. An industrial surface defect detection method based on an unsupervised architecture-level adaptive framework, characterized in that, The method includes the following steps: The DINOv2 large-scale visual model is used to assist the teacher NAS branch in generating hybrid pseudo-labels for surface images of unlabeled industrial products. The hybrid pseudo-labels guide the student NAS branch to perform NAS search, thereby realizing the detection of industrial surface defects. The teacher NAS branch and the student NAS branch form a bi-branch adaptive framework, and both the teacher NAS branch and the student NAS branch are composed of an initialized search space. The DINOv2 large-scale visual model is equipped with a decoder. The search space consists of multiple stacked repeating basic units, each of which is a directed acyclic graph containing N nodes. There are multiple candidate operations between each pair of adjacent nodes; all possible operations between each node are incorporated into the architecture parameters. This makes the search space continuous, and then updates the architecture parameters through gradient descent. The operation with the highest weight is selected to construct the optimal subnet A. ), making the architecture parameters The corresponding weight parameters can be optimized using gradient descent; The existing defect images of labeled industrial products serve as the source domain data, while the newly obtained surface images of unlabeled industrial products serve as the target domain data. During the initialization of the search space, the source domain network... A s Architecture parameter α s Mapping the source domain network into the search space A s Weight parameters This is further inherited into the search space, causing the search space to evolve into a search space containing source domain search knowledge; Before generating hybrid labels, the parameters of the decoder are adjusted based on the source domain data to establish a mapping relationship between the general features obtained from the DINOv2 visual large model and defect detection, thereby achieving task-level semantic alignment. The DINOv2 visual large model and the teacher NAS branch are independent for unlabeled target domain data. Generate prediction probability distribution and Then, calculate separately. and The information entropy corresponding to each pixel in the image; Next, based on the obtained information entropy, a target domain pseudo-label is generated through an entropy-guided selection mechanism. Target domain pseudo-tags This is a mixed tag.
2. The industrial surface defect detection method based on an unsupervised architecture-level adaptive framework as described in claim 1, characterized in that: The NAS domain adaptation loss function during the search process is: + in, and The balance coefficient represents the balance loss; Provides a portion of the supervised loss for labeled source domain data; This is a mixed supervision loss.
3. The industrial surface defect detection method based on an unsupervised architecture-level adaptive framework as described in claim 2, characterized in that: The steps to obtain the NAS domain adaptation loss function are as follows: First, the labeled source domain data provides part of the supervised loss: in, It is composed of loss functions commonly used in industrial defect detection. Labels representing source domain data, This represents the result predicted by the NAS network; Next, leveraging the cross-domain feature association between the source and target domain data, a two-branch adaptive framework is used to generate pseudo-labels for the target domain data, building upon the source domain supervised loss. Thus, an unsupervised loss function for the target domain is constructed: Subsequently, a class-level fusion strategy was used to process the image and label pairs of the source domain data. And the image and label pairs of the target domain data Perform random classification mixing: in, These represent the blended image and its corresponding label set, It is a dynamically and randomly selected classification mask with values in [0,1]; based on Defined unsupervised loss Data that can be mixed Update to hybrid supervised loss This leads to the NAS domain adaptation loss function, where: 。 4. The industrial surface defect detection method based on an unsupervised architecture-level adaptive framework as described in claim 2, characterized in that: The process of NAS exploring the search space is the process of applying the loss function. Under supervision, gradient descent backpropagation is used to update the architecture parameters. The process of determining the corresponding weight parameter w: in, This represents the learning rate.
5. An industrial surface defect detection system based on an unsupervised architecture-level adaptive framework, characterized in that: The system includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it performs the industrial surface defect detection method based on an unsupervised architecture-level adaptive framework as described in any one of claims 1-4.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the industrial surface defect detection method based on an unsupervised architecture-level adaptive framework as described in any one of claims 1-4.
Citation Information
Patent Citations
Unsupervised domain adaptive method based on neural network architecture search
CN113313255A
Knowledge distillation-based unsupervised industrial anomaly detection method and system
CN119991555A