An industrial image defect recognition method based on prototype comparison and double-view screening

By using a prototype comparison and dual-view screening method, the problems of overfitting and semantic anchor contamination caused by noise labels in industrial defect identification are solved. Robustness and fine-grained detection in noisy environments are achieved, and it is applicable to scenarios such as mechanical parts, PCB boards and steel surface damage.

CN122391210APending Publication Date: 2026-07-14TIANJIN POLYTECHNIC UNIV +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TIANJIN POLYTECHNIC UNIV
Filing Date
2026-06-10
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing deep learning models are easily affected by noise labels in industrial defect identification, leading to overfitting and degradation of generalization ability. Especially in fine-grained scenarios, traditional noise label learning methods and prototype contrast learning suffer from semantic anchor contamination and category conflict, making it difficult to adapt to the dynamically changing noise perception level in industrial production.

Method used

We adopt a prototype comparison and dual-view screening method. Through a purity-guided dynamic prototype initialization strategy, combined with a two-dimensional Gaussian mixture model (2D-GMM) screening mechanism that combines classification confidence and prototype semantic consistency, we dynamically adjust the tolerance threshold and use adaptive class prototype comparison loss and local topological consistency loss to construct a robust feature space, achieving intra-class compactness and inter-class separation.

Benefits of technology

It significantly reduces the false positive rate in fine-grained scenarios, successfully salvages difficult clean samples, and improves the robustness and cross-domain generalization ability of the model, making it suitable for industrial defect detection such as mechanical parts, PCB boards and steel surface damage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391210A_ABST
    Figure CN122391210A_ABST
Patent Text Reader

Abstract

This invention relates to the field of image processing technology, providing a method for industrial image defect recognition based on prototype comparison and dual-view screening. The method includes: initializing and fusing semantic prediction centers and visual clustering centers using a purity-guided dynamic prototype; constructing a two-dimensional evaluation vector using a classification confidence view and a semantic consistency view; dividing industrial defect images into clean-labeled and unlabeled datasets through dual-view adaptive screening and an adaptive tolerance threshold based on global prediction noise rate; introducing adaptive prototype comparison loss, local topological consistency constraints, and mean prior distribution penalties to perform prototype comparison hybrid training on a preheated model; and inputting the industrial defect images into a deep neural network classifier for defect classification. This invention exhibits strong cross-domain generalization ability and noise robustness, and can be widely applied to various industrial defect detection scenarios such as surface defects in mechanical parts, PCB board defects, and surface damage in steel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an industrial image defect identification method based on prototype comparison and dual-view screening. Background Technology

[0002] In industrial defect images, automatic surface defect detection based on deep learning has become a key technology for ensuring product quality. In fields such as hot-rolled strip steel, electronic wafers, and textile production, deep convolutional neural networks (CNNs) have demonstrated superior performance in defect classification and object detection tasks. However, the success of these deep models heavily relies on large-scale and accurately labeled datasets. In real-world industrial scenarios, obtaining perfectly clean labels is an extremely expensive and time-consuming task, typically requiring individual verification by senior domain experts. To reduce costs, researchers often construct datasets using low-cost annotation or crowdsourcing platforms, which inevitably introduces a large amount of label noise. Defective, noisy labels severely interfere with the optimization process of neural networks, leading to overfitting and significant degradation in generalization ability.

[0003] Currently, the mainstream paradigm for Learning with Noisy Labels (LNL) is based on "Small-loss Selection," which leverages the "memory effect" of the model prioritizing the learning of simple patterns and distinguishes clean samples from noisy samples by the magnitude of the cross-entropy loss value. However, when these general methods are applied to industrial defect identification with "fine-grained feature confusion," they often face a significant risk of failure. In industrial inspection, different categories of defects (such as minor scratches and filamentous indentations) often have high inter-class similarity, and the same type of defect exhibits significant intra-class differences under different lighting conditions. In such fine-grained scenarios, the traditional "small-loss" assumption is prone to collapse: many "difficult clean samples" with insignificant features generate large loss values ​​in the early stages of training, thus being misclassified as noise and eliminated. Furthermore, in extreme industrial environments with high proportions of noise, the model is highly susceptible to "confirmation bias," leading to the complete collapse of the feature manifold.

[0004] Traditional instance-level contrastive learning can extract robust low-level visual features without relying on labels. However, because it treats all other samples in the same batch as negative samples and pushes them away, it is prone to destroying intra-class compactness in fine-grained scenarios, leading to "class conflicts." Although prototype contrastive learning theoretically provides strong noise-resistant semantic constraints, existing methods still have fatal limitations in real-world industrial scenarios. First, there are the challenges of "cold start" and "anchor contamination" in prototype initialization: in the early stages of training, directly using prediction probabilities with a lot of noise to build prototypes inevitably introduces serious semantic biases, resulting in the "semantic anchors" of contrastive learning being incorrect from the start. On the other hand, relying entirely on unsupervised visual clustering (such as K-Means) can easily lead to "semantic misalignment" between clusters and the true categories due to the lack of upper-level semantic guidance. When the prototype itself loses its purity, subsequent prototype contrastive constraints not only fail to correct the bias but also exacerbate the aggregation of erroneous features. Second, existing multi-dimensional screening mechanisms and prototype constraints often use static tolerance thresholds, which are difficult to adapt to the dynamically changing noise levels in industrial production, easily causing the model's performance to collapse under extreme noise. Summary of the Invention

[0005] This invention aims to at least solve one of the technical problems existing in related technologies. To this end, this invention provides an industrial image defect recognition method based on prototype comparison and dual-view screening. It utilizes visual priors to salvage semantic structure, identifying and rescuing difficult samples in fine-grained industrial defects. Addressing the "cold start" and semantic misalignment problems that easily occur during prototype initialization in noisy environments, a purity-guided dynamic prototype initialization strategy aligns unsupervised visual clusters with semantic predictions to construct a robust initial prototype. This invention abandons traditional one-dimensional loss screening and combines classification confidence with dual-view screening based on prototype semantic consistency. Figure 2 The 2D-GMM screening mechanism effectively reduces the false positive rate in fine-grained scenarios and successfully rescues difficult clean samples. Combined with an adaptive tolerance threshold that dynamically adjusts with the estimated noise rate, this mechanism accurately intercepts extreme outliers and successfully rescues difficult clean defective samples at the classification boundary. In the semi-supervised training stage, a prototype contrastive loss that adaptively adjusts with the noise rate is used to force the feature space to achieve intra-class compactness and inter-class separation, directly combating feature divergence caused by industrial noise.

[0006] This invention provides an industrial image defect recognition method based on prototype comparison and dual-view screening, comprising: S1: Acquire industrial defect images; perform self-supervised contrastive learning on a convolutional neural network based on the industrial defect images to obtain a backbone network; extract features from the industrial defect images through the backbone network to obtain low-level visual features; freeze the parameters of the backbone network and train a classification layer to obtain a preheating model; add noise to the industrial defect images and input the noisy industrial defect images into the preheating model to obtain predicted sample features. S2: Obtain the semantic prediction center by calculating the mean of the predicted sample features, and obtain the visual cluster center by extracting the data distribution clusters of the underlying visual features through unsupervised clustering; obtain the initial class prototype by fusing the semantic prediction center and the visual cluster center through purity-guided dynamic prototype initialization. S3: Calculate the classification confidence view of industrial defect images through cross-entropy loss, extract high-dimensional backbone features of industrial defect images through convolutional neural networks, and calculate the similarity between high-dimensional backbone features and initial class prototypes through a contrastive loss function with temperature hyperparameter to obtain a semantic consistency view. S4: Construct a two-dimensional evaluation vector using a classification confidence view and a semantic consistency view. Adaptively filter the two-dimensional evaluation vector using the dual-view adaptive filtering to obtain the filtered vector. S5: Set an initial tolerance threshold, and dynamically adjust the initial tolerance threshold using an adaptive tolerance threshold strategy based on the global prediction noise rate to obtain a dynamic tolerance threshold; divide the industrial defect images into clean labeled datasets and unlabeled datasets according to the dynamic tolerance threshold and the filtering vector; S6: Based on the clean labeled dataset and the unlabeled dataset, an adaptive class prototype contrast loss, a local topological consistency loss, and a mean prior distribution penalty term are introduced to perform prototype contrast hybrid training on the preheating model to obtain a deep neural network classifier. Industrial defect images are then input into the deep neural network classifier for defect classification.

[0007] Furthermore, by initializing the fusion semantic prediction center and visual clustering center using a purity-guided dynamic prototype, the initial class prototypes obtained include: S21: The Hungarian algorithm is used to perform optimal matching between semantic prediction centers and visual clustering centers to obtain the aligned cluster category mapping relationship; S22: Based on the aligned cluster category mapping relationship, calculate the average prediction confidence, intra-cluster sample size, and intra-cluster feature variance for each cluster, and calculate the comprehensive purity score of the cluster based on the average prediction confidence, intra-cluster sample size, and intra-cluster feature variance. S23: Calculate the adaptive fusion weight of the category based on the comprehensive purity score of the cluster and the aligned cluster category mapping relationship; S24: Based on the adaptive fusion weights of the categories, fuse the semantic prediction center and the visual clustering center to obtain the initial class prototype.

[0008] Furthermore, step S21 includes: S211: Calculate the cosine distance between the semantic prediction center and the visual clustering center; S212: The cost matrix is ​​weighted by the confidence scores of the clusters, using the cosine distance as the cost matrix. S213: Solve for the optimal matching based on the weighted cost matrix, complete the alignment of the semantic prediction center and the visual clustering center, and obtain the aligned cluster category mapping relationship.

[0009] Furthermore, in step S22, the expression for calculating the overall purity score of the cluster is: in, For the first The overall purity score of each cluster, For the first The average prediction confidence of each cluster For normalization function, For the first Sample size within each cluster For the first The within-cluster characteristic variance of each cluster, To prevent extremely small smooth terms with a denominator of zero.

[0010] Furthermore, in step S4, constructing a two-dimensional evaluation vector using the classification confidence view and the semantic consistency view includes: Normalize the classification confidence view to obtain the normalized classification confidence vector; Normalize the semantically consistent view to obtain the normalized semantically consistent view vector; By concatenating the normalized classification confidence vector and the normalized semantic consistency view vector, a two-dimensional evaluation vector is obtained.

[0011] Furthermore, the dual-view adaptive filtering is to construct a binary Gaussian mixture model containing two Gaussian components using expectation maximization, with the two Gaussian components corresponding to the clean cluster and the noisy cluster, respectively.

[0012] Furthermore, the L2 norm of the mean vectors of the two Gaussian components is calculated, and the component with the smaller norm is identified as a clean cluster. The posterior probability of each sample belonging to a clean cluster is calculated according to Bayes' theorem, and the posterior probability is used as the sample weight.

[0013] Furthermore, the adaptive tolerance threshold strategy based on global prediction noise rate defines the tolerance threshold as a piecewise decay function of the global prediction noise rate, wherein when the global prediction noise rate is higher than or equal to a first preset threshold, the tolerance threshold decays at a first rate; when the global prediction noise rate is lower than the first preset threshold but higher than a second preset threshold, the tolerance threshold decays at a second rate; and when the global prediction noise rate is lower than or equal to the second preset threshold, the tolerance threshold decays at a third rate, wherein the first rate is less than the second rate and the second rate is less than the third rate.

[0014] Furthermore, the prototype-contrast hybrid training in step S6 includes: S61: The MixMatch strategy is used to perform linear interpolation between the clean labeled dataset and the unlabeled dataset to obtain the mixed labeled batch and the mixed unlabeled batch; S62: Calculate the basic supervised classification loss of the mixed labeled batches and the unsupervised consistency loss of the mixed unlabeled batches; S63: By forcing the high-dimensional backbone features of the sample to converge tightly to the real class prototype to which the sample belongs on the hypersphere, while pushing away the distance from the heterogeneous prototype, we obtain the adaptive class prototype contrast loss. S64: Taking the weak enhancement output probability of the same image as the target and the strong enhancement output probability as the prediction, the local topological consistency loss is obtained by approximating the consistency of the weak enhancement output probability and the strong enhancement output probability in semantic assignment through KL divergence. S65: Obtain the mean prior distribution penalty term by calculating the KL divergence between the mean distribution and the uniform prior distribution of the predicted probabilities of all samples in the current batch. S66: Construct a joint loss using basic supervised classification loss, unsupervised consistency loss, adaptive prototype contrast loss, local topological consistency loss, and mean prior distribution penalty term.

[0015] Furthermore, the initial class prototype is dynamically updated through a momentum queue and an exponential moving average.

[0016] The above-described one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects: To address the challenge of cold start for prototypes in industrial scenarios, a purity-guided dynamic prototype initialization strategy utilizes objective visual physical structure to correct subjective prediction biases. This effectively solves the problem of semantic anchor contamination in real-world noisy environments, significantly reduces the contamination of prototypes by noise labels and clustering biases, and substantially improves the model's robustness to noise labels.

[0017] Binocular vision Figure 2The Gaussian Mixture Model (2D-GMM) screening mechanism effectively reduces the false positive rate in fine-grained scenarios, successfully rescuing difficult clean samples. Combined with an adaptive tolerance threshold that dynamically adjusts with the estimated noise rate, this mechanism accurately intercepts extreme outliers and successfully rescues difficult clean defect samples at the classification boundary. During the semi-supervised training phase, a class-prototype contrastive loss that adaptively adjusts with the noise rate is used to force the feature space to achieve intra-class compactness and inter-class separation, directly combating feature divergence caused by industrial noise. This invention exhibits strong cross-domain generalization ability and noise robustness, and can be widely applied to various industrial defect detection scenarios such as surface defects in mechanical parts, PCB board defects, and surface damage in steel.

[0018] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating an industrial image defect recognition method based on prototype comparison and dual-view screening provided by the present invention.

[0021] Figure 2 This is a schematic diagram of a network architecture for industrial image defect recognition based on prototype comparison and dual-view screening provided by the present invention.

[0022] Figure 3 This is a schematic diagram of the classification probability distribution of the input defect samples in this invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention. The following embodiments are used to illustrate this invention but cannot be used to limit the scope of this invention.

[0024] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0025] The following is combined with Figures 1 to 3 This invention describes an industrial image defect recognition method based on prototype comparison and dual-view screening.

[0026] For standard industrial image classification tasks, it is assumed that the training set has noisy labels. , ,Include One defect sample. Among them, , For the first One input image, This is the corresponding noise label (NoisyLabel). , The height of the image. The width of the image. For the number of channels, The total number of defect categories, for Potential real-world labels, in a real-world industrial noise label learning setting. It is invisible during training, and May not equal The objective of this invention is to utilize a training set with noise labels. Train a deep neural network classifier ,in The network parameters are designed to maximize classification accuracy on the test set, i.e., minimize the risk regarding the true label: in, For loss function, To find the minimum value, The expected value of the predicted value and the true value on the test set. For the test set, This is a real image.

[0027] To better distinguish industrial defects in a fine-grained space, Decomposed into feature extractor and classification head , In industrial settings, feature extractors are responsible for capturing the underlying physical information of defects, such as texture and shape. For any input... Its high-dimensional features are represented as , , for 3D real vectors, for prototype learning, will Mapped onto the unit hypersphere, i.e. , High-dimensional backbone features, global class prototype , ,in , For the first The semantic center of the class, and satisfying During training, class prototypes typically evolve using a momentum queue, storing recent predictions. The sample features of the class are analyzed and updated smoothly using an exponential moving average (EMA). .

[0028] like Figure 1 and Figure 2 As shown, an industrial image defect recognition method based on prototype comparison and dual-view screening includes: S1: Acquire industrial defect images; perform self-supervised contrastive learning on a convolutional neural network based on the industrial defect images to obtain a backbone network; extract features from the industrial defect images through the backbone network to obtain low-level visual features; freeze the parameters of the backbone network and train a classification layer to obtain a preheating model; add noise to the industrial defect images and input the noisy industrial defect images into the preheating model to obtain predicted sample features. Self-supervised phase: The backbone network is trained and the underlying visual features extracted by the backbone network are used.

[0029] Warm-up phase: Use the backbone as the main body of the warm-up model and freeze the parameters. Train only the classification layer to obtain the final warm-up model.

[0030] Feature prediction: Finally, the preheating model is used to extract predicted sample features from the industrial defect images with added noise.

[0031] A self-supervised pre-training model (SimCLR) is used on an industrial defect image set. This model completely discards potentially contaminated label information and instead relies on the contrastive learning paradigm of the SimCLR framework to uncover the inherent objective patterns in the data. Specifically, strong data augmentation strategies such as random cropping are applied to the same unlabeled image to construct positive sample pairs, and features are extracted using a CNN encoder. Subsequently, contrastive loss is used to shorten the distance between homogeneous samples in the latent space and widen the distance between different samples. This unsupervised feature representation learning effectively shields against the misleading influence of incorrect labels, enabling the network to capture highly robust underlying visual representations, thereby constructing visual clusters that reflect the true distribution of the data.

[0032] S2: Obtain the semantic prediction center by calculating the mean of the predicted sample features, and obtain the visual cluster center by extracting the data distribution clusters of the underlying visual features through unsupervised clustering; obtain the initial class prototype by fusing the semantic prediction center and the visual cluster center through purity-guided dynamic prototype initialization. The semantic prediction center is obtained by calculating the mean of the predicted sample features. , ,in, For the first Class semantic feature probability; obtain the data distribution clusters of underlying visual features through unsupervised clustering, and obtain the visual cluster centers. , ,in, For the first Probability of visual clusters; The initial class prototypes obtained by initializing the fusion semantic prediction center and visual clustering center using purity-guided dynamic prototypes include: S21: The Hungarian algorithm is used to perform bipartite graph optimal matching between semantic prediction centers and visual clustering centers to obtain the aligned cluster category mapping relationship; S211: Calculate the cosine distance between the semantic prediction center and the visual clustering center; S212: The cost matrix is ​​weighted by the confidence scores of the clusters, using the cosine distance as the cost matrix. S213: Solve for the optimal matching based on the weighted cost matrix, complete the alignment of the semantic prediction center and the visual clustering center, and obtain the aligned cluster category mapping relationship.

[0033] The Hungarian algorithm is used to perform optimal matching of the bipartite graph, thereby providing a semantic category for each prediction. Find the globally optimal matching unsupervised visual cluster .

[0034] S22: Based on the aligned cluster category mapping relationship, calculate the average prediction confidence, intra-cluster sample size, and intra-cluster feature variance for each cluster, and calculate the comprehensive purity score of the cluster based on the average prediction confidence, intra-cluster sample size, and intra-cluster feature variance. For any view, the first Clusters (assuming they contain) (Number of samples), its comprehensive purity assessment abandons the limitations of a single dimension, and instead deeply integrates the average prediction confidence that reflects semantic certainty. , ,in For the first The semantic center of a class To find the maximum value function, which reflects the within-cluster sample size for statistical significance. and the intra-cluster characteristic variance reflecting the compactness of the underlying physical manifold. .

[0035] Using a weighted average mechanism, clusters with "high semantic confidence, large sample size, and extremely compact feature distribution" are assigned higher confidence weights. The formula for calculating the overall purity score of a cluster is as follows: in, For the first The overall purity score of each cluster, For the first The average prediction confidence of each cluster For normalization function, For the first Sample size within each cluster For the first The within-cluster characteristic variance of each cluster, To prevent extremely small smooth terms with a denominator of zero, Take a very small constant greater than 0, and choose the Min-Max function as the normalization function.

[0036] S23: Calculate the adaptive fusion weight of the category based on the comprehensive purity score of the cluster and the aligned cluster category mapping relationship; For unsupervised visual clustering views, due to the lack of explicit classification semantics, The term is set to a constant 1. The overall purity from the supervised perspective is calculated separately. Combined purity with unsupervised perspective Then, the adaptive fusion weights can be solved. , The calculation expression is: in, This is a bidirectional truncation operation. The overall purity score for the supervised view. The overall purity score for the unsupervised view. To prevent smooth terms with a denominator of zero, Preset static weights The lower limit of the cutoff, Preset static weights The upper limit of the cutoff.

[0037] The Clamp mechanism includes a crash prevention mechanism, setting... Setting it to 0.7 forces the model to retain a certain proportion of underlying objective physical manifold features to regulate subjective semantic predictions, even when facing clusters with extremely high prediction purity; this effectively blocks self-confirmation bias from a single perspective. A value of 0.3 sets a minimum threshold for preventing collapse in extremely noisy and confusing environments, ensuring that even if unsupervised visual clustering suffers severe distortion due to noise interference, the high-level semantic center can still maintain the most basic category anchoring function.

[0038] S24: Based on the adaptive fusion weights of the categories, fuse the semantic prediction center and the visual clustering center to obtain the initial class prototype. The calculation expression is as follows: in, For the first Class initial prototype, For the first The probability of a visual cluster.

[0039] Purity-guided dynamic prototype initialization strikes a balance between strong semantic judgment in the model and the underlying unsupervised manifold structure. It uses a pure, objective visual-physical structure to correct potential manifold distortions caused by noisy labels, thus providing a robust and misaligned initial global semantic anchor for subsequent 2D-GMM sample selection and semi-supervised feature constraints.

[0040] S3: Calculate the classification confidence view of industrial defect images through cross-entropy loss, extract high-dimensional backbone features of industrial defect images through convolutional neural networks, and calculate the similarity between high-dimensional backbone features and initial class prototypes through a contrastive loss function with temperature hyperparameter to obtain a semantic consistency view. For input industrial samples and their corresponding target labels Calculate its two-dimensional evaluation vector , It consists of two orthogonal views. ,in, For the classification confidence view, To provide a semantically consistent view, a classification confidence view of industrial defect images is calculated using cross-entropy loss. This is used to measure the objective difficulty of a network fitting the current sample to the observed label; High-dimensional backbone features of industrial defect images are extracted using a convolutional neural network. A contrastive loss between the high-dimensional backbone features and the initial class prototype is calculated using a contrastive loss with a temperature hyperparameter to obtain a semantic consistency view, which is used to measure the high-dimensional backbone features of the samples. Does the hypersphere deviate from the center of its corresponding global class prototype? .

[0041] in, For temperature hyperparameters, For the first The semantic center of the class.

[0042] S4: Construct a two-dimensional evaluation vector using a classification confidence view and a semantic consistency view. Adaptively filter the two-dimensional evaluation vector using the dual-view adaptive filtering to obtain the filtered vector. Constructing a two-dimensional evaluation vector using a classification confidence view and a semantic consistency view includes: Normalize the classification confidence view to obtain the normalized classification confidence vector; Normalize the semantically consistent view to obtain the normalized semantically consistent view vector; To eliminate the dimensional differences between the two heterogeneous losses, Min-Max normalization is used to strictly map the classification confidence view and the semantic consistency view to the [0, 1] interval; By concatenating the normalized classification confidence vector and the normalized semantic consistency view vector, a two-dimensional evaluation vector is obtained.

[0043] The dual-view adaptive filtering method uses expectation maximization to construct a fitting binary Gaussian mixture model (2D-GMM) containing two Gaussian components, which implicitly correspond to clean and noisy clusters.

[0044] This is equivalent to introducing an independent visual referee, whose joint probability density function Defined as: in, For the first The mixing coefficient of the Gaussian components, For the first The mean vector of Gaussian components, For the first The covariance matrix of Gaussian components, For the first Feature vectors of an image It follows a Gaussian distribution.

[0045] After the fit converges, considering that the loss of high-fidelity clean samples should approach a minimum in both the classification and feature dimensions, the L2 norm of the two Gaussian component mean vectors is calculated. The component with the smaller norm is identified as a clean cluster, denoted as c.

[0046] The posterior probability of each sample belonging to a clean cluster is calculated using Bayes' theorem, and this posterior probability is used as the sample weight. The calculation expression is as follows: in, No. The posterior probability of an image. For the first Prior probabilities of Gaussian components For the first The mean vector of Gaussian components, For the first The covariance matrix of Gaussian components, No. Prior probabilities of Gaussian components For the first The mean vector of Gaussian components, For the first The covariance matrix of Gaussian components, For a given Under the conditions The probability of.

[0047] Traditional Gaussian Mixture Model (GMM)-based screening mechanisms rely solely on cross-entropy loss for data partitioning. However, in scenarios with fine-grained feature obfuscation, the network is prone to overfitting to incorrect labels with simple backgrounds or specific textures (resulting in minimal loss), while truly difficult, clean samples often produce significant classification losses. To eliminate this persistent overfitting noise and salvage difficult samples as much as possible, this invention explicitly introduces geometric semantic consistency constraints, constructing a two-dimensional feature space with dual views to perform "cross-quality checking" on the samples.

[0048] S5: Set an initial tolerance threshold, and dynamically adjust the initial tolerance threshold using an adaptive tolerance threshold strategy based on the global prediction noise rate to obtain a dynamic tolerance threshold; divide the industrial defect images into clean labeled datasets and unlabeled datasets according to the dynamic tolerance threshold and the filtering vector; Obtain the posterior probability for each sample Subsequently, traditional screening mechanisms typically only compare it with a static empirical probability threshold. To divide the data, perform simple comparisons, such as To maintain robustness in screening within complex industrial environments, this invention proposes a method based on global prediction noise rate. Adaptive tolerance threshold strategy The tolerance threshold is dynamically adjusted. The adaptive tolerance threshold strategy based on the global predicted noise rate defines the tolerance threshold as a piecewise decay function of the global predicted noise rate. When the global predicted noise rate is higher than or equal to a first preset threshold, the tolerance threshold decays at a first rate; when the global predicted noise rate is lower than the first preset threshold but higher than a second preset threshold, the tolerance threshold decays at a second rate; and when the global predicted noise rate is lower than or equal to the second preset threshold, the tolerance threshold decays at a third rate. The first rate is less than the second rate, and the second rate is less than the third rate.

[0049] In some specific embodiments of the present invention, the first preset threshold is 0.7, the second preset threshold is 0.4, the first rate is 0.02, the second rate is 0.05, and the third rate is 0.10. Then, the calculation expression for the adaptive tolerance threshold strategy based on the global prediction noise rate is: When the model predicts that the current environment is in a high-noise environment, a stricter tolerance standard is adopted to prevent erroneous samples from being classified into the clean set; while when the noise level is in the low to medium range, the threshold is actively relaxed to more aggressively salvage those fine-grained, difficult clean samples near the classification boundary.

[0050] Setting the segmentation nodes to 0.4 and 0.7 is not random, but based on an intuitive division of the stages of industrial noise deterioration. When the model is in a safe range with low to medium noise and its cognition is relatively reliable, actively relaxing the tolerance can more aggressively salvage difficult clean samples at the classification boundary; when When noise enters a high-risk confusion zone, standards must be appropriately tightened to prevent misreception; and when At that time, the system was on the verge of collapse, and the vast majority of labels were unreliable.

[0051] Only when the posterior probability of the sample simultaneously satisfies The number after division shall not exceed or be less than Only when the data falls within a certain range will it be classified as labeled data. This mechanism provides a reliable and high-quality data stream for subsequent semi-supervised hybrid training.

[0052] S6: Based on the clean labeled dataset and the unlabeled dataset, an adaptive class prototype contrast loss, local topological consistency constraint and mean prior distribution penalty are introduced to perform prototype contrast hybrid training on the preheating model to obtain a deep neural network classifier. The industrial defect images are then input into the deep neural network classifier for defect classification.

[0053] Prototype-contrast hybrid training includes: S61: Using the MixMatch (mixed matching algorithm) strategy, linear interpolation is performed between the clean labeled dataset and the unlabeled dataset to obtain the mixed labeled batch and the mixed unlabeled batch; Regarding basic semi-supervised hybrid data augmentation, for partitioning to labeled sets... For the samples in the dataset, the observed labels from the pre-warming period or the high-confidence predictions from the model are used as pseudo-labels; for the unlabeled set... The samples in the dataset are averaged and temperature-sharpened based on the predicted distribution of various data augmentation views to generate low-entropy soft pseudo-labels. Subsequently, a MixMatch strategy is applied... and Linear interpolation is performed between them to generate mixed labeled batches. and unmarked batches .

[0054] S62: Calculate the basic supervised classification loss of the mixed labeled batches and the unsupervised consistency loss of the mixed unlabeled batches; Basic Supervision Classification Loss of Networks loss of consistency with unsupervised They are defined as follows: in, For standard cross-entropy, To label the input samples in the batch, for The corresponding tags For input samples in unlabeled batches, for The corresponding pseudo-tag.

[0055] Labeled samples provide classification supervision signals. Mean squared error is used to constrain the robustness of the model's output to unlabeled samples.

[0056] S63: By forcing the high-dimensional backbone features of the sample to converge tightly to the class prototype to which the sample belongs on the hypersphere, while pushing away the distance between it and other class prototypes, we obtain an adaptive class prototype contrast loss. To directly combat the fine-grained feature divergence caused by complex industrial noise, an adaptive prototype contrastive loss was further introduced for the selected high-quality labeled samples. This loss forces the high-dimensional backbone features of the samples. On the hypersphere, towards its corresponding real class prototype Tight convergence, while simultaneously widening the distance between itself and other outlier prototypes: in, This is a temperature scalar. Considering different... Given the discrepancy between the purity and reliability of the prototype, this invention introduces an adaptive weight that decays with the noise rate. When the model evaluates the current noise level as low, it assigns a high weight to the loss to maximize the inter-class separation; when the noise level increases, it appropriately reduces the weight to prevent overfitting to incorrect features under the guidance of a few prototypes that have undergone semantic shift.

[0057] S64: Taking the weak enhancement output probability of the same image as the target and the strong enhancement output probability as the prediction, the local topological consistency loss is obtained by approximating the consistency of the weak enhancement output probability and the strong enhancement output probability in semantic assignment through KL divergence. in, For local topological consistency loss, To weakly enhance the output probability, To significantly increase the output probability, Let KL divergence be denoted as KL divergence.

[0058] Local topological consistency loss reinforces fine-grained boundaries.

[0059] S65: Obtain the mean prior distribution penalty term by calculating the KL divergence between the mean distribution and the uniform prior distribution of the predicted probabilities of all samples in the current batch. To prevent the model from falling into the mode collapse (predicting only the majority class) trivial solution when facing difficult samples, a mean prior distribution penalty term is introduced. By calculating the mean distribution of the predicted probabilities of all samples in the current batch. With uniform prior distribution The KL divergence between classes forces the network to maintain class balance in global predictions, with a mean prior distribution penalty term. The calculation expression is: in, It is a mean distribution The Middle The probability value of the class. This refers to the batch size.

[0060] S66: A joint loss is constructed using basic supervised classification loss, unsupervised consistency loss, adaptive prototype contrast loss, local topological consistency loss, and a mean prior distribution penalty term. in, For the total loss, To fix the unsupervised weights, The adaptive weights are dynamically adjusted according to the global prediction noise rate. For local topological consistency loss, in order to maintain the consistency between features and manifold, .

[0061] Furthermore, to ensure the real-time performance and stability of the global class prototype throughout the joint optimization process and to prevent residual dirty features from contaminating the semantic center, this invention designs a momentum queue update operation process for the class prototype. Specifically, after the backpropagation of parameters in each batch is completed, the system first extracts sample features and pseudo-labels, and sequentially passes them through "multiple gating screening," "topology consistency judgment," and "confidence filtering" to allow only highly reliable sample features to enter the momentum queue. Subsequently, the system checks the queue's fill status. If the queue does not meet the update criteria, the update is skipped to maintain the stability of the prototype; if the queue fill meets the criteria, after a rigorous "secondary queue cleaning," the mean of the weakly enhanced features of the clean samples in the current batch is extracted. The global class prototype is updated online using an exponential moving average.

[0062] Furthermore, to ensure the real-time performance and stability of the global class prototype throughout the joint optimization process, after the backpropagation of parameters in each batch is completed, the mean of the weakly enhanced features of the clean samples in the current batch is utilized. The global class prototype is updated online using an exponential moving average. The calculation expression is as follows: in, For the first Class in The updated class prototype For the first Class in The updated class prototype is the momentum coefficient, which is usually set to 0.9.

[0063] This smooth update strategy ensures that the prototype always represents the purest class center under the current model's understanding, and ultimately, together with the aforementioned losses, it contributes to a virtuous cycle of efficient denoising.

[0064] Industrial defect images are input into a deep neural network classifier for defect classification. The final classification probability distribution is as follows: Figure 3As shown, samples with a confidence level of 0.85 were classified as belonging to the roll-in scale (Rs) category, while the predicted probabilities of other interference categories, such as scratches (Sc), pitted surfaces (Ps), patches (Pa), inclusions (In), and streaks (Cr), were effectively suppressed. The significant probability discrepancy indicates that the model can provide clear, decisive, and highly confident judgments when dealing with industrial defect classification tasks.

[0065] This invention aims to deeply integrate objective unsupervised visual priors with subjective supervised semantic prediction, and deeply reconstructs each core stage of traditional expectation-maximization (EM) algorithm training.

[0066] After a brief warm-up period, the model proposes to dynamically fuse unsupervised visual clustering with the purity of predicted categories to reconstruct a highly robust initial global class prototype, breaking the cold start trap. Subsequently, the model officially enters an alternating loop: in the Dual-view Adaptive Selection (DAS) stage, a 2D-GMM with adaptive tolerance adjustment based on noise rate is used to accurately partition the dataset in a dual-view space that fuses classification confidence and semantic consistency, successfully rescuing fine-grained difficult samples near the classification boundary; finally, in the prototype contrastive mixed training stage, learning is performed based on the posterior probability of the selection output combined with MixMatch, and adaptive prototype contrastive loss and local topological mixing constraints are introduced to force the network to learn a more compact and clear discrimination boundary in the fine-grained feature space.

[0067] To adaptively adjust the model's ability to cope with different noise environments, the predicted noise rate of the current training set is recalculated every 5 epochs after the warm-up phase. This periodic update strategy can effectively avoid training instability caused by noise estimation oscillations, while providing a reliable statistical basis for subsequent adaptive parameter adjustment.

[0068] At the end of the warm-up phase, although the model possesses preliminary class discrimination capabilities, directly initializing class prototypes based on the network's fragile prediction confidence under complex noise interference introduces severe semantic bias. On the other hand, while relying entirely on unsupervised clustering (such as K-Means) to extract feature clusters can extract objective physical texture distributions, it is highly susceptible to "class misalignment" due to the lack of high-level semantic guidance. To overcome this cold start impasse, this paper proposes a Purity-Guided Initialization (PGI) strategy that integrates objective visual structure priors with subjective semantic prediction posteriors.

[0069] To verify the effectiveness of this invention, it was evaluated on the real-world industrial datasets NEU-CLS and Screw. Before the formal semi-supervised training phase, the network underwent self-supervised contrastive pre-training. The self-supervised pre-training phase of this invention strictly adopted the same unsupervised learning architecture and hyperparameter configuration (including the basic settings for instance-level contrastive loss, data augmentation strategies, and the number of training epochs) as the baseline model ScanMix. All experiments were run on a computer with an Intel Xeon Platinum 8474C processor, 80GB of memory, and a single NVIDIA GeForce RTX 4090D (24GB) graphics card.

[0070] NEU-CLS is an open-access dataset of hot-rolled strip steel collected by Northeastern University. Defects in hot-rolled strip steel are caused by various factors such as uneven cooling, improper rolling parameters, or contaminants present during the manufacturing process. The NEU-CLS dataset contains six typical defects, with 300 images for each defect type. All images are grayscale images collected by a dedicated image acquisition system, including scratches (Sc), roll-in marks (Rs), pitted surfaces (Ps), patches (Pa), inclusions (In), and streaks (Cr). First, in the unsupervised pre-training phase, SimCLR is used for 500 training rounds with an SGD optimizer of batch size 64 and an initial learning rate of 0.1, supplemented by strong data augmentation with cropping to fully extract the underlying physical visual representation (color changes are prohibited). Then, in the core backbone noise reduction training phase, the ScanMix network performs 150 rounds of robust learning with a batch size of 16. Specifically for industrial scenarios, a prototype momentum parameter of 0.9 with piecewise control according to noise level, adaptive contrastive loss weights, and a learning rate that changes in the 80th round are introduced to achieve precise denoising in fine-grained high-noise environments.

[0071] The Screw dataset consists of surface defects collected from real industrial production lines, designed to evaluate the model's feature extraction capabilities and robustness to noisy label learning under complex and irregular micro-textures. At the visual and preprocessing levels, the images exhibit typical low-contrast granular textures. In experiments, they were uniformly adjusted to 112×112 resolution and global channel normalization was implemented to balance computational overhead and maximize the preservation of local high-frequency weak defect features. At the labeling level, unlike traditional independent discrete morphology classification, this dataset constructs a highly physically ordered 10-level defect severity system (classes 0 to 9 mapped from consecutive defect scores). This strictly progressive label structure increases the probability of visual confusion between adjacent classes, posing a severe challenge to the model's fine-grained discrimination ability at the decision boundary. Furthermore, to efficiently adapt to subsequent dynamic sample partitioning frameworks, this dataset adopts a decoupled architecture separating physical image storage from logical annotation (external JSON configuration file). The training set contains 9731 images, and the validation set contains 2433 images. First, in the unsupervised pre-training phase, SimCLR is used for 500 training rounds with an SGD optimizer of batch size 256 and an initial learning rate of 0.1, supplemented by strong data augmentation with cropping to fully extract the underlying physical visual representation (color changes are prohibited). Then, in the core backbone noise reduction training phase, the ScanMix network performs 150 rounds of robust learning with a batch size of 128. Specifically for industrial scenarios, a prototype momentum parameter of 0.9 with piecewise control according to noise level, adaptive contrastive loss weights, and a learning rate that changes in the 80th round are innovatively introduced to achieve precise denoising in fine-grained high-noise environments.

[0072] To comprehensively and objectively evaluate the superiority of this invention in handling complex noise and fine-grained feature obfuscation, representative state-of-the-art noise label learning methods were selected for baseline comparison. For the highly challenging fine-grained industrial defect obfuscation (such as extremely difficult-to-distinguish scratches and mesh patterns) in the NEU-CLS dataset, this invention introduces a series of robust learning and error correction algorithms for extreme evaluation. These methods include the Activation Trend Tracking-based Robust Learning Algorithm (ATTRL), improved Robust Auxiliary Classifier Generative Adversarial Networks (rAC-GANs), Reliable Vector Guided Softmax Loss Algorithm (RVFace), Joint Training and Co-regularization Algorithm (JoCoR), Sequence Ensemble Noise Filtering Algorithm (SENF), and Parallel Hybrid Penalty Network Algorithm (PHL-Net).

[0073] The NEU-CLS industrial defect dataset poses a fatal threat to traditional noise screening mechanisms due to extremely small inter-class differences (such as the high visual similarity between scratches and mesh patterns). Baseline methods relying solely on one-dimensional cross-entropy screening on this dataset easily discard genuine, difficult defect samples as noise, leading to a significant drop in recall. To comprehensively evaluate the model's balanced identification capability for various defects under complex industrial noise, this invention injects 30% symmetric noise, as shown in Table 1, following the PHL-Net specification. Furthermore, macro-average precision (mP), macro-average recall (mR), and macro-average F1 score (mF) are introduced for multi-dimensional joint comparison.

[0074] Table 1. Noise transfer matrix for 30% symmetric noise

[0075] Table 2 shows the experimental and comparative results on the NEU-CLS dataset. Early robust learning and error correction algorithms (such as ATTRL, rAC-GANs, RVFace, and JoCoR) achieved overall accuracy in the range of 80%–83%, but their multidimensional evaluation metrics revealed significant imbalances. For example, JoCoR achieved a macro-average precision (mP) of 0.864, but its macro-average recall (mR) was only 0.836; ATTRL achieved an mP of 0.850, while its mR was even lower at 0.808. This phenomenon of acceptable precision but low recall indicates that these methods tend to sacrifice marginal, difficult samples at the classification boundary in fine-grained scenarios, resulting in severely insufficient recall ability for difficult-to-distinguish defect categories. Although SENF improved the accuracy to 87.7% (mF reaching 0.853), it still struggled to completely overcome the manifold divergence caused by extreme similarity.

[0076] In contrast, this invention demonstrates comprehensive and balanced performance dominance. Without customizing the network structure to address specific defects, it achieves a test accuracy of up to 91.8%, with mP, mR, and mF scores of 0.931, 0.928, and 0.914, respectively. When directly compared to PHL-Net, this invention not only improves overall accuracy by 0.4%, but also achieves significant improvements in macro average precision (mP) and recall (mR) of 0.012 and 0.014, respectively.

[0077] Table 2. Experimental and comparative results on the NEU-CLS dataset.

[0078] This invention achieves a balanced and excellent performance on both mR and mF metrics, demonstrating the scientific validity of its underlying mechanism. The dual-view adaptive filtering effectively acts as a visual judge, accurately rescuing edge-hard features that are easily discarded by traditional methods, and significantly improving recall. The purity-guided dynamic prototype initialization forces all categories of features to achieve equally compact convergence, effectively preventing mode collapse under extreme noise. In highly confused industrial noise environments, this invention establishes a new benchmark for multi-dimensional comprehensive performance.

[0079] To verify the effectiveness and robustness of this invention in real-world industrial defect scenarios, a comprehensive comparison was conducted on the Screw dataset with existing representative noisy label learning methods. The experimental and comparative results on the Screw dataset are shown in Table 3. This invention achieved an overwhelming advantage in peak performance (Best), with a highest test accuracy of 74.7%. It also comprehensively outperformed JoCoR and RVFace in multiple comprehensive evaluation metrics, including mean precision (mP), recall (mR), and F1 score (mF), fully demonstrating the high-precision and balanced classification ability of this invention when dealing with complex defect features. In the robustness test investigating whether the model would fall into the noisy memory effect, compared to the catastrophic performance collapse of JoCoR in the later stages of training due to overfitting to incorrect labels (accuracy dropped from 72.5% to 33.8%), this invention exhibited extremely excellent training stability, maintaining a high accuracy of 73.2% at the end of training, with no significant drop in any key metrics.

[0080] With its efficient sample selection and multi-dimensional fusion mechanism, this invention not only significantly improves the performance ceiling of industrial defect identification, but also better curbs the model's tendency to memorize noise during long-term training. This allows the model to converge stably without relying on a strict early stopping strategy, demonstrating extremely strong reliability for practical industrial applications.

[0081] Table 3. Experimental and comparative results on the screw dataset.

[0082] In Table 3, Last represents the final performance result when the model training is completely finished.

[0083] This invention conducted rigorous component ablation experiments on the NEU-CLS dataset with 30% added symmetric noise and the CIFAR-10 dataset with 20% added symmetric noise. As shown in Table 4, the traditional “one-dimensional GMM screening + basic Mixup (hybrid augmentation algorithm) semi-supervised augmentation” was used as the initial baseline model, and the proposed core architecture was gradually replaced and its performance was measured.

[0084] Table 4 Ablation Experiment Results

[0085] Validation of the effectiveness of Dual-View Adaptive Selection (DAS): Based on the baseline model, when the one-dimensional GMM is replaced with the Dual-View Adaptive Selection (DAS) mechanism, the model's test accuracy on the CIFAR-10 dataset steadily improves from 96.0% to 96.23%, an improvement of 0.23%, while keeping the subsequent basic mixup training unchanged. On the NEU-CLS industrial dataset with extremely high fine-grained confusion, a 1.67% improvement is achieved (from 81.11% to 82.78%). This substantial performance increase demonstrates the necessity of introducing a "semantic consistency" view. Traditional one-dimensional cross-entropy selection is prone to "overconfidence," misclassifying high-loss, clean samples as noise. DAS, by constructing a 2D-GMM and using an adaptive tolerance threshold, acts as a strict visual judge, successfully rescuing these valuable samples located at the classification boundary, thus providing a larger-scale, higher-quality stream of clean labeled data for subsequent mixed training.

[0086] After successfully deploying the DAS module, the backend feature learning paradigm was further upgraded to a complete Prototype-Contrastive Hybrid Training (PCMT) module. At this point, the model's performance saw a second significant improvement, with accuracy jumping from 96.23% to a final 96.70%, a substantial increase of 0.47%, and a total improvement of 0.70% compared to the initial baseline. On NEU-CLS, a significant performance improvement was achieved, with accuracy reaching 91.80%. High-quality data partitioning at the front end alone is insufficient; the adaptive prototype-contrastive loss and local topological constraints introduced in the PCMT module played a decisive role in manifold regularization. It forces network features to converge tightly to their corresponding real-class prototypes on the hypersphere, effectively resisting feature divergence caused by the few remaining hidden noises, and sculpting highly compact and clear discriminative boundaries in a fine-grained feature space.

[0087] To verify the impact of the visual-to-semantic fusion ratio in the initial stage, the results were analyzed on the NEU-CLS dataset. Independent ablation validation was performed. As shown in Table 5, extreme single-view dependence ( Setting it to 1.0 or lower can make the model highly susceptible to low-level noise manifold interference or lead to self-confirmation bias in accepting incorrect labels, resulting in accuracy rates of only 81.67% and 87.78%, respectively. When... When the coefficients are between 0.3 and 0.7, the model achieves a balance between objective visual priors and subjective semantic predictions, reaching an accuracy of over 86.67% through efficient cross-correction. This indicates that the PGI module successfully established high-purity initial semantic anchors for the network within this coefficient range, effectively resisting noise erosion during the "cold start" phase, thus strongly supporting the subsequent DAS and PCMT modules to ultimately achieve an outstanding performance of 91.80%.

[0088] Table 5 Static weights of PGI components in the NEU-CLS dataset ablation experiment

[0089] In the prototype-contrast hybrid training phase, the global class prototype, acting as a "semantic anchor" on the feature hypersphere, directly determines the effectiveness of the contrastive loss constraint through its real-time updates and stability. Therefore, this invention provides a detailed ablation evaluation of the core hyperparameter—momentum coefficient m—in the exponential moving average (EMA) process. As shown in Table 6, on the CIFAR-10 dataset with 20% added symmetric noise, the magnitude of the momentum coefficient m has a highly sensitive modulating effect on the final performance of the model. When the momentum coefficient is set to... At the peak, the model achieved a test accuracy of 96.70%. As the value of m was gradually increased, the model's performance showed a significant decline. Specifically, when m increased to 0.95, 0.99, and the extreme value of 0.999, the model's accuracy decreased by 0.35%, 0.38%, and a significant 0.63% compared to the peak, respectively.

[0090] Table 6 shows the impact of class prototype update momentum coefficient m on accuracy on the CIFAR-10 dataset.

[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for industrial image defect recognition based on prototype comparison and dual-view screening, characterized in that, include: S1: Acquire industrial defect images; perform self-supervised contrastive learning on a convolutional neural network based on the industrial defect images to obtain a backbone network; extract features from the industrial defect images through the backbone network to obtain low-level visual features; freeze the parameters of the backbone network and train a classification layer to obtain a preheating model; add noise to the industrial defect images and input the noisy industrial defect images into the preheating model to obtain predicted sample features. S2: Obtain the semantic prediction center by calculating the mean of the predicted sample features, and obtain the visual cluster center by extracting the data distribution clusters of the underlying visual features through unsupervised clustering; obtain the initial class prototype by fusing the semantic prediction center and the visual cluster center through purity-guided dynamic prototype initialization. S3: Calculate the classification confidence view of industrial defect images through cross-entropy loss, extract high-dimensional backbone features of industrial defect images through convolutional neural networks, and calculate the similarity between high-dimensional backbone features and initial class prototypes through a contrastive loss function with temperature hyperparameter to obtain a semantic consistency view. S4: Construct a two-dimensional evaluation vector using a classification confidence view and a semantic consistency view. Adaptively filter the two-dimensional evaluation vector using the dual-view adaptive filtering to obtain the filtered vector. S5: Set an initial tolerance threshold, and dynamically adjust the initial tolerance threshold using an adaptive tolerance threshold strategy based on the global prediction noise rate to obtain a dynamic tolerance threshold; divide the industrial defect images into clean labeled datasets and unlabeled datasets according to the dynamic tolerance threshold and the filtering vector; S6: Based on the clean labeled dataset and the unlabeled dataset, an adaptive class prototype contrast loss, a local topological consistency loss, and a mean prior distribution penalty term are introduced to perform prototype contrast hybrid training on the preheating model to obtain a deep neural network classifier. Industrial defect images are then input into the deep neural network classifier for defect classification.

2. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 1, characterized in that, The initial class prototypes obtained by initializing the fusion semantic prediction center and visual clustering center using purity-guided dynamic prototypes include: S21: The Hungarian algorithm is used to perform optimal matching between semantic prediction centers and visual clustering centers to obtain the aligned cluster category mapping relationship; S22: Based on the aligned cluster category mapping relationship, calculate the average prediction confidence, intra-cluster sample size, and intra-cluster feature variance for each cluster, and calculate the comprehensive purity score of the cluster based on the average prediction confidence, intra-cluster sample size, and intra-cluster feature variance. S23: Calculate the adaptive fusion weight of the category based on the comprehensive purity score of the cluster and the aligned cluster category mapping relationship; S24: Based on the adaptive fusion weights of the categories, fuse the semantic prediction center and the visual clustering center to obtain the initial class prototype.

3. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 2, characterized in that, Step S21 includes: S211: Calculate the cosine distance between the semantic prediction center and the visual clustering center; S212: The cost matrix is ​​weighted by the confidence scores of the clusters, using the cosine distance as the cost matrix. S213: Solve for the optimal matching based on the weighted cost matrix, complete the alignment of the semantic prediction center and the visual clustering center, and obtain the aligned cluster category mapping relationship.

4. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 2, characterized in that, In step S22, the formula for calculating the overall purity score of the cluster is: in, For the first The overall purity score of each cluster, For the first The average prediction confidence of each cluster For normalization function, For the first Sample size within each cluster For the first The within-cluster characteristic variance of each cluster, To prevent extremely small smooth terms with a denominator of zero.

5. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 1, characterized in that, In step S4, constructing a two-dimensional evaluation vector using the classification confidence view and the semantic consistency view includes: Normalize the classification confidence view to obtain the normalized classification confidence vector; Normalize the semantically consistent view to obtain the normalized semantically consistent view vector; By concatenating the normalized classification confidence vector and the normalized semantic consistency view vector, a two-dimensional evaluation vector is obtained.

6. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 1, characterized in that, The dual-view adaptive filtering method uses expectation maximization to construct a binary Gaussian mixture model containing two Gaussian components, with the two Gaussian components corresponding to the clean cluster and the noisy cluster, respectively.

7. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 6, characterized in that, Calculate the L2 norm of the mean vectors of the two Gaussian components, and classify the component with the smaller norm as a clean cluster; The posterior probability of each sample belonging to a clean cluster is calculated according to Bayes' theorem, and the posterior probability is used as the sample weight.

8. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 1, characterized in that, The adaptive tolerance threshold strategy based on global prediction noise rate defines the tolerance threshold as a piecewise decay function with respect to the global prediction noise rate, wherein when the global prediction noise rate is higher than or equal to a first preset threshold, the tolerance threshold decays at a first rate. When the global prediction noise rate is lower than the first preset threshold and higher than the second preset threshold, the tolerance threshold decays at the second rate. When the global prediction noise rate is lower than or equal to the second preset threshold, the tolerance threshold decays at the third rate. The first rate is less than the second rate, and the second rate is less than the third rate.

9. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 1, characterized in that, The prototype contrastive hybrid training in step S6 includes: S61: The MixMatch strategy is used to perform linear interpolation between the clean labeled dataset and the unlabeled dataset to obtain the mixed labeled batch and the mixed unlabeled batch; S62: Calculate the basic supervised classification loss of the mixed labeled batches and the unsupervised consistency loss of the mixed unlabeled batches; S63: By forcing the high-dimensional backbone features of the sample to converge tightly to the class prototype to which the sample belongs on the hypersphere, while pushing away the distance between it and other class prototypes, we obtain an adaptive class prototype contrast loss. S64: Taking the weak enhancement output probability of the same image as the target and the strong enhancement output probability as the prediction, the local topological consistency loss is obtained by approximating the consistency of the weak enhancement output probability and the strong enhancement output probability in semantic assignment through KL divergence. S65: Obtain the mean prior distribution penalty term by calculating the KL divergence between the mean distribution and the uniform prior distribution of the predicted probabilities of all samples in the current batch. S66: Construct a joint loss using basic supervised classification loss, unsupervised consistency loss, adaptive prototype contrast loss, local topological consistency loss, and mean prior distribution penalty term.

10. The industrial image defect recognition method based on prototype comparison and dual-view screening according to claim 1, characterized in that, The initial class prototype is dynamically updated using a momentum queue and an exponential moving average.