Semi-supervised segmentation method and system for small sample industrial defects and storage medium

By constructing first and second segmentation models and utilizing cognitive uncertainty information for cross-stage collaborative regulation, the problems of model overconfidence and noise pseudo-labels under small sample conditions are solved, improving the accuracy and stability of industrial defect segmentation and meeting the real-time requirements of industrial production lines.

CN122391639APending Publication Date: 2026-07-14HEFEI UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HEFEI UNIV OF TECH
Filing Date
2026-04-14
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Under small sample conditions, existing semi-supervised segmentation methods suffer from overconfidence in model predictions, reinforcement of noise pseudo-labels, high inference overhead of large-scale pre-trained models, difficulty in direct deployment in industrial production line environments, and lack of a unified control signal for explicitly modeling model prediction uncertainty.

Method used

A first segmentation model and a pre-trained second segmentation model are constructed. Cross-stage collaborative regulation is carried out through cognitive uncertainty information. Uncertainty information is used for feature fusion, feature representation space constraints and knowledge interaction to generate reliable pseudo-labels and calculate joint loss function for model update.

Benefits of technology

It improves the reliability of the model's own predictions, enhances the segmentation accuracy and stability of small defects and complex boundary regions, and achieves a balance between segmentation accuracy and inference efficiency, making it suitable for industrial applications with high real-time requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391639A_ABST
    Figure CN122391639A_ABST
Patent Text Reader

Abstract

The application discloses a semi-supervised segmentation method and system for small sample industrial defects and a storage medium, and relates to the technical field of machine vision and intelligent detection. The method comprises the following steps: constructing a first segmentation model, a second segmentation model and a training data set; inputting an image into the first segmentation model and generating cognitive uncertainty information; introducing the information into the first segmentation model, and performing cross-stage collaborative regulation and constraint on feature fusion, feature representation space and the knowledge interaction process with the second segmentation model; screening pseudo labels based on the regulated result and the uncertainty information to participate in training, and updating model parameters through a joint loss function; and finally outputting segmentation and uncertainty evaluation results by using the trained first segmentation model. The application significantly improves the segmentation accuracy and reliability perception of micro defects and complex boundary regions, and only the first segmentation model is required in the reasoning stage, so that the advantages of fast reasoning speed and easy industrial deployment are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine vision and intelligent inspection technology, and in particular to a semi-supervised segmentation method, system and storage medium for small sample industrial defects. Background Technology

[0002] In the fields of intelligent manufacturing and industrial automation, surface defect detection based on machine vision is an important technical means to ensure product quality and production safety. Among them, pixel-level defect segmentation can provide precise morphological and spatial location information of defects, which is of great significance for quality assessment, process optimization, and defect tracing.

[0003] However, defect segmentation technology still faces many challenges in real-world industrial scenarios. First, pixel-level annotation of industrial defects relies heavily on human experience, and the annotation process is complex and costly, resulting in a limited number of high-quality labeled samples available for training. Models often can only be trained with a very small number of samples. Second, industrial imaging environments are complex and variable, with factors such as background texture interference, uneven illumination, noise, and occlusion. Defect targets are usually small in size and have blurred boundaries, further increasing the difficulty of segmentation.

[0004] To alleviate the problem of insufficient labeled samples, semi-supervised learning methods have been widely studied. These methods improve model performance by introducing a large amount of unlabeled data into the training process. Existing semi-supervised segmentation methods often rely on the confidence level of model predictions to generate pseudo-labels, assuming that high-confidence predictions have high reliability. However, in small-sample industrial scenarios, models often become overconfident in incorrect predictions and cannot distinguish between "data noise" and "cognitive deficiencies." This leads to the continuous reinforcement of noisy pseudo-labels during training, resulting in performance degradation or even training failure.

[0005] On the other hand, general segmentation models based on large-scale data pre-training, which have emerged in recent years, have shown strong cross-scenario generalization capabilities. However, their large model size and high inference overhead make them difficult to deploy directly in industrial production line environments with high requirements for real-time performance and resource constraints. In addition, these models usually rely on external prompts to achieve good segmentation results, and automatically generating reliable prompts under unlabeled or weakly labeled conditions remains challenging.

[0006] Therefore, in the existing technology, there is still no perfect solution for how to explicitly model the uncertainty of model prediction under small sample conditions and use this uncertainty as a unified control signal to guide the semi-supervised segmentation model to train multiple key stages of collaborative optimization for industrial defect segmentation. Summary of the Invention

[0007] Based on the technical problems existing in the background technology, this invention proposes a semi-supervised segmentation method, system and storage medium for small sample industrial defects, which improves the model's ability to perceive its own prediction reliability and the segmentation accuracy and stability in small defects and complex boundary regions.

[0008] This invention proposes a semi-supervised segmentation method for small-sample industrial defects, the steps of which are as follows:

[0009] Construct a first segmentation model to be trained and a pre-trained second segmentation model;

[0010] Construct a training dataset containing both labeled and unlabeled images;

[0011] Images from the training dataset are input into the first segmentation model to obtain pixel-level category evidence values, and the first segmentation model generates cognitive uncertainty information to characterize the current level of cognitive prediction.

[0012] Cognitive uncertainty information is introduced as a unified control signal into the first segmentation model to perform cross-stage collaborative adaptive joint control;

[0013] Pixel-level segmentation prediction results are generated based on the state of the first segmentation model after adjustment. Combined with cognitive uncertainty information, the reliability of the segmentation prediction results on the unlabeled image is screened, and the prediction results that meet the screening conditions are used as pseudo-labels to participate in the subsequent model training.

[0014] The joint loss function is calculated based on the segmentation prediction results and pseudo-labels. The joint loss function is then used to backpropagate and update the first segmentation model, so that the cognitive uncertainty information generated in the next iteration can dynamically evolve as the model's capabilities improve, thus completing the model training.

[0015] The industrial image to be segmented is input into the first segmentation model that has been trained, and the model outputs the defect segmentation result and the corresponding uncertainty assessment result.

[0016] The second segmentation model participates in the knowledge interaction process only during the model training phase and does not participate in inference calculations during the image segmentation phase.

[0017] Preferably, the final classification layer of the first segmentation model is an evidence reasoning layer, which is used to output non-negative evidence values ​​of the image corresponding to each defect category, and obtain cognitive uncertainty information based on the non-negative evidence values.

[0018] Preferably, the stage of introducing cognitive uncertainty information as a unified control signal into the first segmentation model is at least one of the following: the feature fusion process within the first segmentation model, the feature representation space constraint process within the first segmentation model, and the knowledge interaction process between the first segmentation model and the second segmentation model.

[0019] Preferably, when cognitive uncertainty information is introduced into the feature fusion process within the first segmentation model as a control signal, the uncertainty information is mapped to control weights in the spatial or channel dimensions; the weights are used to adaptively weighted fuse feature maps from different levels or different resolutions.

[0020] Preferably, when cognitive uncertainty information is introduced as a control signal into the feature representation space constraint process within the first segmentation model, the cognitive uncertainty information is used to weight the pixel-level feature vectors to calculate the global feature prototypes for each defect category; based on the global feature prototypes, a prototype contrast loss is constructed to constrain the clustering relationship of features of the same category in the feature space.

[0021] Preferably, when cognitive uncertainty information is introduced as a control signal into the knowledge interaction process between the first segmentation model and the second segmentation model, gating weights are constructed based on cognitive uncertainty information during the knowledge distillation process between the first segmentation model and the second segmentation model; and the loss function of knowledge distillation is weighted using the gating weights.

[0022] Preferably, the reliability screening method is as follows: cognitive uncertainty information and prediction confidence information are used as joint criteria; prediction results that simultaneously satisfy the condition that prediction confidence is higher than a first threshold and cognitive uncertainty is lower than a second threshold are used as pseudo-labels.

[0023] Preferably, the joint loss function includes supervised loss for labeled images, semi-supervised consistency loss for filtering regions in unlabeled images, knowledge distillation loss weighted by cognitive uncertainty information, feature space prototype contrast loss, and regularization loss.

[0024] This invention proposes a semi-supervised segmentation system for small-sample industrial defects, comprising:

[0025] The model building unit is used to build the first segmentation model to be trained and the pre-trained second segmentation model, and to build a training dataset containing labeled and unlabeled images;

[0026] The evidence modeling unit is used to input images from the training dataset into the first segmentation model to obtain pixel-level category evidence values, and the first segmentation model generates cognitive uncertainty information to characterize the current level of cognitive prediction.

[0027] The collaborative regulation unit is used to introduce cognitive uncertainty information as a unified regulation signal into the first segmentation model to perform cross-stage collaborative adaptive joint regulation;

[0028] The training iteration unit is used to generate pixel-level segmentation prediction results based on the state of the first segmentation model after adjustment, and to combine cognitive uncertainty information to screen the reliability of the segmentation prediction results on unlabeled images. The prediction results that meet the screening conditions are used as pseudo-labels to participate in subsequent model training. It is also used to calculate the joint loss function based on the segmentation prediction results and pseudo-labels, and to use the joint loss function to backpropagate and update the first segmentation model, so that the cognitive uncertainty information generated in the next iteration can dynamically evolve as the model's capabilities improve to complete the model training.

[0029] The image segmentation unit is used to input the industrial image to be segmented into the first segmentation model that has been trained, and output the defect segmentation result and the corresponding uncertainty evaluation result.

[0030] The present invention proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the semi-supervised segmentation method for small-sample industrial defects as described above.

[0031] Beneficial technical effects of the present invention:

[0032] (1) This invention explicitly models the uncertainty of the model prediction and uses it as a unified control signal to guide the collaborative optimization of multiple key stages of semi-supervised segmentation model training, thereby improving the model's ability to perceive its own prediction reliability.

[0033] (2) This invention significantly improves the segmentation accuracy and stability of the model in areas with small defects and complex boundary regions by unifying the control of feature fusion, feature representation space and knowledge interaction process between models;

[0034] (3) By introducing a second segmentation model during the training phase and deploying only a lightweight first segmentation model during the inference phase, this invention achieves a good balance between segmentation accuracy and inference efficiency, making it suitable for industrial application scenarios with high real-time requirements. Attached Figure Description

[0035] Figure 1 This is a flowchart of the semi-supervised segmentation method for small-sample industrial defects proposed in this invention;

[0036] Figure 2 This is a schematic diagram illustrating the principle of adaptive weighted control of the feature fusion process based on uncertainty information proposed in this invention.

[0037] Figure 3 This is a schematic diagram illustrating the principle of the prototype distribution of feature space based on uncertainty information constraints proposed in this invention.

[0038] Figure 4This is a schematic diagram showing the defect segmentation results of the semi-supervised segmentation method for small-sample industrial defects proposed in this invention on industrial defect images, and the corresponding cognitive uncertainty heatmap visualization effect. Detailed Implementation

[0039] The present invention will be further explained below with reference to specific embodiments.

[0040] Example 1

[0041] Reference Figure 1 This invention proposes a semi-supervised segmentation method for small-sample industrial defects, the steps of which are as follows:

[0042] Step 1: In this embodiment, a semi-supervised segmentation model system is constructed, including a first segmentation model and a second segmentation model.

[0043] The first segmentation model is a trainable semantic segmentation network, preferably employing a lightweight network structure to meet the real-time requirements of industrial production lines. In this embodiment, the first segmentation model adopts the U-Net architecture, with ResNet-18 as the backbone network. The key improvement lies in replacing the Softmax classification layer at its end with an evidence reasoning layer (EvidenceHead), with K output channels (where K is the total number of defect categories) and Softplus activation function to ensure non-negative evidence values ​​are output.

[0044] The second segmentation model is a pre-trained general segmentation model or a base model, such as the SAM segmentation model pre-trained on a large-scale dataset, or other segmentation networks with strong semantic modeling capabilities (such as DeepLabv3+). Its parameters remain frozen throughout the training process. In this system, the core role of the second segmentation model is to provide "global semantic guidance" and "soft label reference": because the first segmentation model (the student) is trained with very few samples, it is prone to overfitting to the training set or misjudging unknown backgrounds. The second segmentation model, however, possesses strong cross-scene generalization capabilities. We input the same image into the second segmentation model and use its output feature distribution or probability distribution as a "reference answer." Through knowledge distillation, the first segmentation model is forced to learn the details of defects while maintaining a correct understanding of the overall semantic structure of the image, preventing the model from "going astray" during small-sample training.

[0045] This embodiment uses the DAGM 2007 Industrial Defect Dataset as the data source for experimental verification. This dataset contains images of industrial surfaces with complex textures and backgrounds across multiple categories. To simulate small-sample industrial application scenarios, no more than 10 images are randomly selected from each defect category as the annotation dataset D. l The remaining images are used as the unlabeled dataset D.u .

[0046] Step 2: To enable the first segmentation model to describe the model's cognitive state for different categories at this pixel location, this embodiment generates cognitive uncertainty based on Evidence Deep Learning (EDL) theory. The specific steps are as follows:

[0047] For any pixel i in the input image X, the evidence reasoning layer of the first segmentation model outputs a non-negative evidence vector e corresponding to K categories. i =[e i1 ,e i2 ,...,e iK ], where e ik ≥0. The evidence value is correlated with the parameter α of the Dirichlet Distribution. ik The calculation formula is:

[0048]

[0049] Calculate the total evidence S for this pixel. i :

[0050]

[0051] Based on the total amount of evidence, calculate the epistemic uncertainty information for this pixel. i :

[0052]

[0053] In the formula, ∈(0,1). When the model lacks feature evidence for this region, S i Smaller, resulting in u i Approaching 1 (high uncertainty); conversely, u i Approaching 0 (high certainty). This u i This reflects the reliability of the model's perception at the corresponding pixel location, serving as a "unified control signal" for all subsequent steps.

[0054] Step 3: In this embodiment, the cognitive uncertainty information generated above is used as a unified control signal to achieve collaborative optimization of the model training process. The specific implementation includes the following three sub-steps:

[0055] (1) Adaptive regulation of feature fusion process within the first segmentation model

[0056] In the first segmentation model (U-Net architecture), an uncertainty-based attention module is introduced at the skip connection between the encoder and decoder to address the semantic gap caused by traditional direct concatenation. For example... Figure 2 As shown, the specific steps are as follows:

[0057] Size alignment and weight generation: Due to the uncertainty of the size (H×W) of the graph U and the size (H) of the feature map of the lth layer. l ×W l The approach may differ; firstly, interpolation is used to adjust U to the same spatial resolution as the current layer's feature map. Then, a 1×1 convolutional layer maps the uncertainty into a spatial attention weight matrix W. att The calculation formula is as follows:

[0058]

[0059] In the formula, the Sigmoid function is the activation function, ensuring that the weight values ​​are between (0,1); Resize represents the bilinear interpolation operation, used to match the feature map size.

[0060] Adaptive feature weighting and fusion: The generated weight matrix is ​​used to weight and enhance the encoder features, which are then concatenated with the decoder features. The fusion formula is as follows:

[0061]

[0062] In the formula, F l enc This represents a shallow feature map of the encoder's l-th layer (containing rich edge and texture details); F l dec ⊙ represents the deep upsampled feature map of the corresponding layer of the decoder (containing rich semantic information); ⊙ represents element-wise multiplication; Concat represents the concatenation operation along the channel dimension.

[0063] The principle is: (1+W) is used in the formula. att The residual design structure is used. When the uncertainty u at a pixel position is high (usually corresponding to minor defects or blurred boundaries), the generated weight W... att Increase, thereby amplifying the shallow features F in this region. l enc The response value forces the model to reuse more high-frequency detail information from the encoder in areas that are difficult to judge, thereby refining the segmentation boundaries.

[0064] (2) Prototype constraints of the feature representation space within the first segmentation model

[0065] To construct a compact and discriminative feature space, this step utilizes uncertainty information to filter reliable pixels, calculates global feature prototypes for each defect category, and constrains feature distribution. For example... Figure 3 As shown, the specific steps are as follows:

[0066] First, weighted class prototype calculation is performed: Unlike traditional global average pooling, this embodiment uses "uncertainty-weighted averaging" to calculate the global feature prototype vector p of the k-th class. k The calculation formula is:

[0067]

[0068] In the formula: f i Let be the feature vector of the i-th pixel in the feature space; I(‧) is the indicator function, when label y i The value is 1 when it equals category k, and 0 otherwise; (1-u) i ) indicates the cognitive reliability of that pixel; y i is the category label for the i-th pixel (for unlabeled images, a filtered pseudo-label is used); N is the total number of pixels in the current batch.

[0069] Then, the prototype contrast loss is calculated: based on the calculated prototype, the prototype contrast loss L is constructed. proto This causes feature vectors to cluster towards similar prototypes and move away from dissimilar prototypes.

[0070]

[0071] In the formula: sim(‧) represents the cosine similarity function; τ is the temperature coefficient (Temperature Parameter), used to adjust the smoothness of the distribution; K is the total number of categories.

[0072] This embodiment introduces (1-u) i In the term ), the weights of noisy pixels with high uncertainty (such as blurred boundaries or erroneous pseudo-labels) are significantly reduced when calculating the class prototype. This ensures that the generated feature prototype p k It is purer and more accurate, thus more effectively guiding the modeling of the feature space and avoiding noise interference.

[0073] (3) Inhibition and regulation of knowledge interaction process between the first segmentation model and the second segmentation model

[0074] When using a pre-trained second segmentation model (teacher) to guide a first segmentation model (student), this invention constructs an uncertainty-based gating inhibition mechanism to calculate a weighted knowledge distillation loss, thereby suppressing the transmission of erroneous knowledge. Specifically, when the second segmentation model provides a reference mask (pseudo-label) for distillation of unlabeled images, the first segmentation model simultaneously generates corresponding cognitive uncertainty information u. i .like Figure 1 As shown, this cognitive uncertainty information is used as a suppression weight to modulate the pixel-level knowledge distillation loss, thereby suppressing the propagation of erroneous knowledge. The suppression weight is (1-u i ) γ Its regulation principle is as follows:

[0075] The first segmentation model recognizes the uncertainty information u i Lower weight areas (typically easily identifiable backgrounds or clear defects) have a weight of (1-u). i ) γ The larger the value, the more encouraged the first segmentation model is to fully incorporate the reference knowledge provided by the second segmentation model; in the face of cognitive uncertainty information u i Extremely high regions (typically fuzzy boundaries or out-of-domain regions where the teacher model might err), weights (1-u) i ) γ The value approaches 0. At this point, the distillation loss in this region is significantly suppressed, thereby blocking the propagation of potential erroneous knowledge from the teacher model to the student model and avoiding blind imitation and error accumulation on difficult samples.

[0076] The specific steps are as follows:

[0077] Uncertainty-gated distillation: Calculating pixel-level knowledge distillation loss L KD And use uncertainty to weight it:

[0078]

[0079] In the formula: P (i) student P represents the probability distribution of the first segmentation model (student) for the i-th pixel; (i) teacher represents the predicted probability distribution of the second segmentation model (teacher) for the i-th pixel; KL(‧) represents the relative entropy (Kullback-Leibler Divergence), used to measure the difference between the two probability distributions; γ is the focusing factor, used to adjust the intensity of suppression, and can be a positive number between 1 and 3.

[0080] Its interaction principle and function are as follows: The second segmentation model (teacher), relying on its pre-trained knowledge, can provide a relatively robust prediction distribution. The first segmentation model (student) inherits general visual features from the teacher model by minimizing the difference between the two prediction distributions (KL divergence). However, the key innovation lies in the fact that we do not blindly trust the teacher model (because a general model may not be as accurate as a specialized model for specific minor industrial defects). Therefore, we utilize the uncertainty u i As a "gating switch": when the uncertainty of the first segmentation model is low (highly confident), it mainly relies on its own learning; when the uncertainty is high, it refers to the knowledge of the second segmentation model. The suppression weights in this step (1-u) i ) γ This "selective knowledge absorption" not only utilizes the generalization ability of the second segmentation model but also avoids being misled by the incorrect predictions of the second segmentation model.

[0081] Step 4: Based on the adjusted state of the first segmentation model, generate pixel-level segmentation prediction results. Incorporating cognitive uncertainty information, screen the reliability of segmentation prediction results on unlabeled images. Prediction results that meet the screening criteria are used as pseudo-labels for subsequent model training. The specific steps are as follows:

[0082] First, after completing the cross-stage modulation in step 3, the feature flow within the first segmentation model has incorporated adaptively enhanced detail information and is constrained by the feature space. This modulated feature is then input to the evidence inference layer at the end of the model, outputting evidence values ​​for each category, thereby generating the final pixel-level segmentation prediction result.

[0083] Then, based on the cognitive uncertainty information, the reliability of the segmentation prediction results on the unlabeled images is screened. This applies to the unlabeled dataset D. u This embodiment uses dual criteria to screen for reliable pseudo-labels:

[0084] Criterion 1: The maximum value of the predicted category belief is higher than the confidence threshold T. c ;

[0085] Criterion 2: Cognitive uncertainty index is below threshold T u .

[0086] The confidence threshold T c With uncertainty threshold T u It is not a fixed value, but can be dynamically determined based on the statistical characteristics of the predicted distribution of labeled samples in the early stage of training (such as the mean plus or minus one standard deviation); the corresponding pixel participates in the semi-supervised consistency constraint only when the above conditions are met simultaneously.

[0087] Step 5: Calculate the joint loss function based on the segmentation prediction results and pseudo-labels. Use the joint loss function to backpropagate and update the first segmentation model, so that the cognitive uncertainty information generated in the next iteration dynamically evolves as the model's capabilities improve, thus completing the model training. The specific steps are as follows:

[0088] In this embodiment, firstly, a parameter update process incorporating a closed-loop feedback mechanism is constructed. Specifically, based on the segmentation prediction results output after unified adjustment in step 3 and the pseudo-labels obtained in step 4, a joint loss function is constructed for model training. The overall optimization objective function of the model is expressed as:

[0089]

[0090] In the formula, L sup This represents the supervised loss for labeled images. The standard cross-entropy loss function or Dice loss function is used to calculate the difference between the model's predictions and the human-generated ground truth labels.

[0091] L consist This represents the semi-supervised consistency loss for unlabeled images. Specifically, this loss is calculated only for pixel regions that meet the reliability screening criteria described in step 4. For the unlabeled image x... u Assuming that the reliable pseudo-labels after screening are The model's current prediction result is p u Then L consist Defined as the cross-entropy loss within a reliable pixel region:

[0092]

[0093] In the formula, M is the set of pixel masks that satisfy the filtering conditions, and N... reliable The total number of reliable pixels; the role of this loss term is to use pseudo-labels with high confidence and low uncertainty to guide the model in mining feature distribution information in unlabeled data.

[0094] L reg The regularization loss (KL divergence loss) in evidence-based deep learning is used to constrain the Dirichlet distribution, prevent the model from generating infinitely large evidence values, and ensure the effectiveness of uncertainty assessment.

[0095] L proto This is the feature space prototype contrast loss in step 3.

[0096] L KD This refers to the knowledge distillation loss based on uncertainty suppression in step 3.

[0097] λ1, λ2, λ3 and λ4 are hyperparameters that balance the weights of each loss term.

[0098] Then, the joint loss function is used to backpropagate and update the first segmentation model, allowing the model parameters to be continuously optimized during training iterations. As the model's capabilities improve, the cognitive uncertainty information generated by the first segmentation model in the next iteration dynamically evolves and further participates in the regulation process of subsequent training stages, thus forming an adaptive training closed-loop mechanism guided by cognitive uncertainty until the model converges.

[0099] Finally, the industrial image to be segmented is input into the trained first segmentation model, which outputs the defect segmentation result and the corresponding uncertainty assessment result.

[0100] This enables the cognitive uncertainty information to form a self-feedback closed-loop mechanism of "generation-regulation-update-regeneration" during the training iteration process.

[0101] To verify the practical application effect of the proposed uncertainty-guided semi-supervised industrial defect segmentation method in small sample, complex texture background and real-time industrial scenarios, the representative DAGM 2007 industrial defect dataset was selected for experimental verification and beneficial effect analysis.

[0102] The DAGM 2007 dataset contains high-resolution grayscale industrial images with complex periodic texture backgrounds. The defect targets are usually small in size, have low contrast, and are visually similar to the background. It is a typical benchmark dataset for verifying the robustness of industrial defect segmentation algorithms in complex backgrounds.

[0103] To simulate the real-world application environment of scarce labeled samples in industrial settings, a semi-supervised learning protocol was adopted, dividing the training data into labeled and unlabeled samples. The experiment focused on evaluating the model performance under a 10% labeled sample ratio and further verified the stability and generalization ability of the proposed method under extreme labeled scarcity conditions (1% labeled sample ratio).

[0104] During the inference phase, only the first segmentation model (student model) is retained, and inference tests are performed on an NVIDIA GeForce RTX 3060 Laptop GPU (6GB VRAM) to simulate an edge industrial deployment environment.

[0105] Table 1 shows the performance comparison between the method of this invention and mainstream semi-supervised segmentation methods (including Mean Teacher, CPS, UCC, etc.) at a 10% annotation ratio.

[0106] Table 1 Performance comparison on the DAGM 2007 dataset (10% of the data is labeled)

[0107]

[0108] As shown in Table 1, using only 10% of the labeled samples, the average intersection-union ratio (IUU) of the method in this invention reaches 81.92%, which is more than 8.81% higher than existing superior methods. This result demonstrates that by explicitly modeling and utilizing the model's cognitive uncertainty during training, and by uniformly controlling the processes of pseudo-labels, feature fusion, and knowledge interaction, noise interference in complex texture backgrounds can be effectively suppressed, significantly improving the segmentation accuracy of defect regions. The specific segmentation results are as follows: Figure 4 As shown.

[0109] Even under the extreme condition of further reducing the annotation ratio to 1% (less than 10 annotated samples per class), the method of this invention still maintains 73.8% mIoU and 82.7% Dice coefficient, demonstrating excellent cold-start capability and stability. This result indicates that the method of this invention does not rely on a large amount of manual annotation, but rather achieves effective learning of defect structural information through an uncertainty-guided cross-stage collaborative mechanism.

[0110] In an edge GPU environment, the inference speed of the method of this invention reaches 65.4 FPS, far exceeding the 30 FPS real-time detection requirement commonly found in industrial production lines. This advantage stems from the design concept of "introducing a complex control mechanism during the training phase and retaining only a lightweight first segmentation model during the inference phase," which ensures segmentation accuracy while avoiding additional computational burden during the inference phase.

[0111] To verify the technical effectiveness of each sub-step in the cross-stage collaborative control mechanism based on uncertainty information described in step S3 of the claim, an ablation experiment was conducted under the condition of a 10% annotation ratio on the DAGM 2007 dataset, and the results are shown in Table 2.

[0112] The specific experimental setup is as follows:

[0113] Variant A: Remove the feature fusion control mechanism based on uncertainty information in step S3;

[0114] Variant B: Removes the knowledge interaction control mechanism between the first segmentation model and the second segmentation model in step S3;

[0115] Variant C: Retains the overall structure, but eliminates the dynamic weighting of uncertainty information on each control process, and only uses a fixed weighting method.

[0116] Table 2 Ablation experiment results of cross-stage synergistic regulation mechanism (Dice coefficient)

[0117]

[0118] As can be seen from the experimental results in Table 2, the segmentation performance decreased significantly after removing the feature fusion modulation based on uncertainty information. This indicates that in the case of blurred industrial defect boundaries and low contrast, dynamically adjusting multi-level feature fusion through uncertainty information helps to enhance fine-grained spatial information and plays a key role in the accurate localization of defect boundaries.

[0119] Furthermore, removing the knowledge interaction mechanism between the first and second segmentation models resulted in a more significant decrease in model performance, indicating that utilizing the structural prior information provided by the pre-trained model can significantly improve training stability and reduce the propagation of false labels under small sample conditions.

[0120] The performance degradation was greatest when the uniform weighting effect of uncertainty information on each control process was removed, which fully demonstrates that using model cognitive uncertainty as a unified control signal is the key technical means for achieving high-precision, small-sample industrial defect segmentation in this invention.

[0121] Based on the above experimental results, it can be concluded that the method of the present invention achieves the following beneficial effects on the DAGM 2007 industrial defect dataset:

[0122] (1) Significantly improves the segmentation accuracy of complex textured industrial defects under small or even extremely small sample conditions;

[0123] (2) Through the cross-stage collaborative regulation mechanism guided by uncertainty, the propagation of noise pseudo-labels is effectively suppressed, and the stability of model training is improved;

[0124] (3) Maintain a lightweight structure during the inference stage to meet the real-time requirements of industrial online detection.

[0125] The above experimental results fully demonstrate the practical value and technological advancement of this invention in small-sample industrial defect segmentation scenarios.

[0126] Example 2

[0127] This invention proposes a semi-supervised segmentation system for small-sample industrial defects, comprising:

[0128] The model building unit is used to build the first segmentation model to be trained and the pre-trained second segmentation model, and to build a training dataset containing labeled and unlabeled images;

[0129] The evidence modeling unit is used to input images from the training dataset into the first segmentation model to obtain pixel-level category evidence values, and the first segmentation model generates cognitive uncertainty information to characterize the current level of cognitive prediction.

[0130] The collaborative regulation unit is used to introduce cognitive uncertainty information as a unified regulation signal into the first segmentation model to perform cross-stage collaborative adaptive joint regulation;

[0131] The training iteration unit is used to generate pixel-level segmentation prediction results based on the state of the first segmentation model after adjustment, and to combine cognitive uncertainty information to screen the reliability of the segmentation prediction results on unlabeled images. The prediction results that meet the screening conditions are used as pseudo-labels to participate in subsequent model training. It is also used to calculate the joint loss function based on the segmentation prediction results and pseudo-labels, and to use the joint loss function to backpropagate and update the first segmentation model, so that the cognitive uncertainty information generated in the next iteration can dynamically evolve as the model's capabilities improve to complete the model training.

[0132] The image segmentation unit is used to input the industrial image to be segmented into the first segmentation model that has been trained, and output the defect segmentation result and the corresponding uncertainty evaluation result.

[0133] Example 3

[0134] The present invention proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the semi-supervised segmentation method for small-sample industrial defects described in Example 1.

[0135] Although embodiments of this application have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of this application. The scope of this application is defined by the appended claims and their equivalents, all of which should be included within the protection scope of this application.

Claims

1. A semi-supervised segmentation method for small-sample industrial defects, characterized in that, The steps are as follows: Construct a first segmentation model to be trained and a pre-trained second segmentation model; Construct a training dataset containing both labeled and unlabeled images; Images from the training dataset are input into the first segmentation model to obtain pixel-level category evidence values, and the first segmentation model generates cognitive uncertainty information to characterize the current level of cognitive prediction. Cognitive uncertainty information is introduced as a unified control signal into the first segmentation model to perform cross-stage collaborative adaptive joint control; Pixel-level segmentation prediction results are generated based on the state of the first segmentation model after adjustment. Combined with cognitive uncertainty information, the reliability of the segmentation prediction results on the unlabeled image is screened, and the prediction results that meet the screening conditions are used as pseudo-labels to participate in the subsequent model training. The joint loss function is calculated based on the segmentation prediction results and pseudo-labels. The joint loss function is then used to backpropagate and update the first segmentation model, so that the cognitive uncertainty information generated in the next iteration can dynamically evolve as the model's capabilities improve, thus completing the model training. The industrial image to be segmented is input into the first segmentation model that has been trained, and the model outputs the defect segmentation result and the corresponding uncertainty assessment result.

2. The semi-supervised segmentation method for small-sample industrial defects according to claim 1, characterized in that, The final classification layer of the first segmentation model is the evidence reasoning layer, which outputs non-negative evidence values ​​for each defect category and obtains cognitive uncertainty information based on the non-negative evidence values.

3. The semi-supervised segmentation method for small-sample industrial defects according to claim 1, characterized in that, The stage of introducing cognitive uncertainty information as a unified control signal into the first segmentation model is at least one of the following: the feature fusion process within the first segmentation model, the feature representation space constraint process within the first segmentation model, and the knowledge interaction process between the first segmentation model and the second segmentation model.

4. The semi-supervised segmentation method for small-sample industrial defects according to claim 3, characterized in that, When cognitive uncertainty information is introduced as a control signal into the feature fusion process within the first segmentation model, the uncertainty information is mapped to control weights in the spatial or channel dimensions; the weights are then used to adaptively weight and fuse feature maps from different levels or resolutions.

5. The semi-supervised segmentation method for small-sample industrial defects according to claim 3, characterized in that, When cognitive uncertainty information is introduced as a control signal into the feature representation space constraint process inside the first segmentation model, the pixel-level feature vectors are weighted using cognitive uncertainty information to calculate the global feature prototype of each defect category. A prototype contrastive loss is constructed based on global feature prototypes to constrain the clustering relationship of features of the same category in the feature space.

6. The semi-supervised segmentation method for small-sample industrial defects according to claim 3, characterized in that, When cognitive uncertainty information is introduced as a regulatory signal into the knowledge interaction process between the first segmentation model and the second segmentation model, gating weights are constructed based on cognitive uncertainty information during the knowledge distillation process between the first segmentation model and the second segmentation model. We use gating weights to perform weighted calculations on the loss function of knowledge distillation.

7. The semi-supervised segmentation method for small-sample industrial defects according to claim 1, characterized in that, The reliability screening method is as follows: cognitive uncertainty information and prediction confidence information are used as joint criteria; prediction results that simultaneously meet the conditions of prediction confidence higher than the first threshold and cognitive uncertainty lower than the second threshold are used as pseudo-labels.

8. The semi-supervised segmentation method for small-sample industrial defects according to claim 1, characterized in that, The joint loss function includes supervised loss for labeled images, semi-supervised consistency loss for filtering regions in unlabeled images, knowledge distillation loss weighted by cognitive uncertainty information, feature space prototype contrast loss, and regularization loss.

9. A semi-supervised segmentation system for small-sample industrial defects, characterized in that, include: The model building unit is used to build the first segmentation model to be trained and the pre-trained second segmentation model, and to build a training dataset containing labeled and unlabeled images; The evidence modeling unit is used to input images from the training dataset into the first segmentation model to obtain pixel-level category evidence values, and the first segmentation model generates cognitive uncertainty information to characterize the current level of cognitive prediction. The collaborative regulation unit is used to introduce cognitive uncertainty information as a unified regulation signal into the first segmentation model to perform cross-stage collaborative adaptive joint regulation; The training iteration unit is used to generate pixel-level segmentation prediction results based on the state of the first segmentation model after adjustment, and to combine cognitive uncertainty information to screen the reliability of the segmentation prediction results on unlabeled images. The prediction results that meet the screening conditions are used as pseudo-labels to participate in subsequent model training. It is also used to calculate the joint loss function based on the segmentation prediction results and pseudo-labels, and to use the joint loss function to backpropagate and update the first segmentation model, so that the cognitive uncertainty information generated in the next iteration can dynamically evolve as the model's capabilities improve to complete the model training. The image segmentation unit is used to input the industrial image to be segmented into the first segmentation model that has been trained, and output the defect segmentation result and the corresponding uncertainty evaluation result.

10. A computer-readable storage medium, characterized in that, A computer program is stored on a computer-readable storage medium, which, when executed by a processor, implements the semi-supervised segmentation method for small-sample industrial defects as described in any one of claims 1-8.