Semi-supervised segmentation method and equipment for industrial quality inspection, and medium

By combining evidence theory and subspace prototype generation strategies with pixel-level contrastive learning, the problems of pseudo-label noise and class imbalance in semi-supervised semantic segmentation are solved, achieving high-precision and stable industrial quality inspection segmentation.

CN121170525APending Publication Date: 2025-12-19SHANGHAI JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511343796.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-19
Publication Date
2025-12-19

AI Technical Summary

Technical Problem

Existing semi-supervised semantic segmentation methods in industrial quality inspection suffer from problems such as pseudo-label noise and overconfidence, class imbalance, long-tail distribution, insufficient utilization of feature space structure, and insufficient uncertainty estimation, resulting in insufficient segmentation accuracy and stability.

Method used

We employ evidence theory to estimate pixel-level uncertainty, aggregate class prototypes through low-uncertainty pixels, and update subspace prototypes with momentum under high uncertainty to construct fine-grained subspace prototypes. We then combine pixel-level contrastive loss for training, introducing uncertainty constraints and contrastive learning.

Benefits of technology

It significantly improves the segmentation accuracy and stability of the model, solves the problems of pseudo-label noise and class imbalance, enhances the learning effect in scenarios with few labels, reduces memory overhead and improves segmentation performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121170525A_ABST
    Figure CN121170525A_ABST
Patent Text Reader

Abstract

The invention relates to a semi-supervised segmentation method and device for industrial quality inspection and a medium, the method comprises the following steps: obtaining a to-be-segmented industrial quality inspection image, carrying out preprocessing, inputting the to-be-segmented industrial quality inspection image into a trained semi-supervised segmentation model, and outputting a segmentation result, and the training step of the semi-supervised segmentation model comprises the following steps: obtaining an industrial quality inspection image set, carrying out preprocessing, and outputting a segmentation result; a trunk segmentation network is adopted for processing, a pixel-level feature map is generated, and pixel-by-pixel classification output is obtained through a classification head; the classified output is transformed, and the pixel features of the same kind are divided into a low-uncertainty set and a high-uncertainty set; performing aggregation by using the low-uncertainty set to obtain a category prototype of each category, initializing k subspace prototypes, and combining the high-uncertainty set to obtain final k subspace prototypes; and respectively constructing a positive sample pair and a negative sample pair, and constructing total loss to carry out model parameter optimization. Compared with the prior art, the method has the advantages of low memory overhead, easiness in integration and the like.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer vision, and in particular to a semi-supervised segmentation method for industrial quality inspection, a device and a medium. BACKGROUND

[0002] Semantic segmentation aims to assign a semantic class label to each pixel in the input image, and is an important problem in tasks such as defect detection, target positioning and surface flaw recognition in industrial quality inspection. With the development of deep learning, fully supervised methods have achieved excellent performance on large-scale labeled data, but in industrial production, the cost of pixel-level labeling is extremely high, and there are subjective differences in the labeling standards of different quality inspectors, resulting in the problem of labeling sample scarcity and working condition distribution changes in actual application. To alleviate this contradiction, semi-supervised semantic segmentation gradually becomes an important research direction and application trend in intelligent quality inspection systems by training a small amount of labeled samples and a large amount of unlabeled samples.

[0003] Existing semi-supervised frameworks are usually constructed based on the following ideas: one is the self-training / pseudo-label paradigm, that is, using the current model or the teacher-student structure to generate pseudo-labels on unlabeled data, and incorporating training to put small sample supervision signals; the second is consistency regularization, which constrains the predictions of the same unlabeled sample under different perspectives to be consistent through multiple data augmentation or perturbation; the third is integration and distillation, which obtains more stable teacher predictions by means of exponential moving average or multi-model voting. These methods have improved data utilization to some extent, but still have the following common bottlenecks:

[0004] 1. Pseudo-label noise and overconfidence: In the case of labeling scarcity or class long tail, the model is prone to systematic bias on unlabeled data, and the Softmax confidence often appears to be over-calibrated (high confidence corresponds to incorrect prediction). Noise pseudo-labels are recycled, which will lead to error accumulation and further slow down or destroy convergence.

[0005] 2. Class imbalance and long-tail distribution: The proportion of pixels of each class in real scenes is very different, and a small number of classes, small targets and boundary regions are more likely to be misclassified. The introduction of unlabeled samples will further amplify the class imbalance and difficult example scarcity problem, leading to a mismatch between training focus and downstream needs.

[0006] 3. Insufficient use of feature space structure: Semantic segmentation inherently has a large number of pixel-level contrast relationships, but relying only on cross-entropy or consistency terms cannot explicitly encode the geometric structure of "same class aggregation, different class separation", resulting in insufficient feature separability and generalizability.

[0007] To remedy the third point, contrastive learning is widely introduced as an auxiliary task to reshape the feature space by maximizing the similarity of same-class samples and minimizing the similarity of different-class samples. Although contrastive learning is effective, it still faces several key problems in the semi-supervised semantic segmentation scenario: memory / GPU overhead and stability trade-off: In order to obtain stable and wide-coverage positive and negative samples, many methods rely on memory banks or cross-batch queues. However, such structures bring significant storage and maintenance costs, and under the condition of data distribution drift or noisy pseudo-labels, the historical features in the memory bank lag and are noisy, which will solidify the bias into the contrastive objective. Local sampling leads to "local-global bias": In order to reduce resource consumption, some methods only sample prototypes and negative samples in a small batch or local window. Due to the limited coverage of samples and the immaturity of model prediction, the class center estimated locally often deviates from the true global distribution, causing the feature optimization to proceed in a suboptimal direction, resulting in unstable training, slow convergence or early stopping. The modeling of positive samples is too rough: most pixel-level contrastive methods construct a single prototype for each class, and unify the same-class pixels to this center. However, semantic classes are usually multimodal distributions: for example, the surface of a steel plate can be further divided into: normal area / scratch / crack / oxidation spot; PCB circuit board can be divided into: substrate / solder joint / circuit / short circuit defect; bottle and tank container can be divided into: bottle body / label / crack / stain; fabric material can be divided into: normal texture / broken yarn / stain / wrinkle and other fine-grained semantics and appearance differences. Single prototype will suppress intra-class diversity, causing over-shrinking, making it difficult for the model to balance detail and robustness. Unreasonable difficulty example selection and weight allocation: the benefits of contrastive learning depend largely on the quality of query samples and positive and negative samples. If the definition of difficult examples relies on unreliable confidence or a single threshold, it is easy to cause attention misplacement: a large amount of time is consumed on pseudo-difficult examples or extreme noise, which affects the overall training efficiency and stability.

[0008] On the other hand, uncertainty estimation provides a natural tool for measuring sample reliability and guiding training. Common uncertainty can be divided into accidental uncertainty (data noise) and cognitive uncertainty (model unknown). Existing estimation approaches include: probability-based modeling, Monte Carlo Dropout, deep ensemble, etc. Integrating uncertainty into semi-supervised tasks can be used to filter pseudo-labels, weight losses, or guide data selection. However, in pixel-level contrastive learning, the existing approach has two shortcomings: most methods only simply weight the uncertainty at the loss level, lack of systematic influence on the feature geometric structure and prototype generation process, and it is difficult to suppress the pollution of noisy features to the contrastive objective from the root. Common confidence measures are based on Softmax probability, and the calibration characteristics are weak, which can easily produce false high confidence at the class boundary and difficult examples, and cannot finely distinguish "learnable difficult examples" and "unlearnable noise". SUMMARY

[0009] The application aims to provide a semi-supervised segmentation method for industrial quality inspection, a device and a medium, which improves segmentation accuracy.

[0010] The application aims to provide a semi-supervised segmentation method for industrial quality inspection, a device and a medium, which improves segmentation accuracy.

[0011] A semi-supervised segmentation method for industrial quality inspection comprises the following steps:

[0012] An industrial quality inspection image to be segmented is acquired, preprocessed, and input into a pre-trained semi-supervised segmentation model for processing, and a final segmentation result is output, wherein the semi-supervised segmentation model comprises a backbone segmentation network, a classification head, and a feature extraction head, and the training steps of the semi-supervised segmentation model comprise:

[0013] An industrial quality inspection image set is acquired, preprocessed, processed by the backbone segmentation network, pixel-level feature maps are generated, and pixel-by-pixel classification outputs are obtained by using the classification head;

[0014] The classification outputs are transformed by using the feature extraction head, and the same-class pixels are further divided into a low-uncertainty set and a high-uncertainty set, wherein the same-class pixels are obtained from the pixel-level feature maps according to the categories;

[0015] The low-uncertainty set is used to aggregate to obtain a category prototype of each category, and k subspace prototypes are initialized, and the high-uncertainty set is combined to obtain the final k subspace prototypes;

[0016] Based on the final k subspace prototypes, positive sample pairs and negative sample pairs are constructed, pixel-level contrast loss is further constructed, and total loss is further constructed for model parameter optimization to obtain the trained semi-supervised segmentation model.

[0017] Further, the preprocessing operation comprises scale operation, random or center cropping, normalization, color disturbance, and random horizontal flipping of the industrial quality inspection image.

[0018] Further, the division steps of the low-uncertainty set and the high-uncertainty set comprise:

[0019] Based on the classification outputs, evidence learning is used to perform SoftPlus transformation to obtain the evidence quantity, confidence, and pixel uncertainty of each category, which are respectively represented as:

[0020]

[0021] In the formula, is the evidence quantity of the c-th category, i is the i-th pixel, is the output of the classification head, For Dirichlet parameters, SoftPlus is the SoftPlus operation. The confidence score for category c, where C is the number of categories. Pixel uncertainty when it is category c;

[0022] For each category c, an uncertainty threshold δ∈(0,1) is set;

[0023] Based on the aforementioned uncertainty threshold δ, pixels of the same type are divided to obtain a low-uncertainty set F. c,easy With the set of high uncertainty F c,hard , respectively represented as:

[0024]

[0025] In the formula, F c Let f be the set of pixel features for category c, and let f be the feature corresponding to the i-th pixel.

[0026] Furthermore, the expression for the category prototype of each category is:

[0027]

[0028] In the formula, pro c f is the class prototype of class c. i To query features, F c,easy For a set of low uncertainty, Pixel uncertainty when it is category c.

[0029] Furthermore, the step of obtaining the final k subspace prototypes includes:

[0030] Traverse the query features in the set of high uncertainty, and select the initialized subspace prototype that has the closest cosine distance to the query feature according to the nearest neighbor principle, wherein the initialized subspace prototype is represented as:

[0031]

[0032] In the formula, Here, k represents the initialized subspace prototype corresponding to category c, and k is the number of subspace prototypes. c This is the class prototype for class c;

[0033] The momentum of the selected initialized subspace prototypes is updated to obtain the final k subspace prototypes, wherein the expression for the momentum update is:

[0034]

[0035] In the formula, is the momentum updated subspace prototype, is the momentum coefficient, m = 1 / (i + s) is the step weight function, i is the i-th pixel, s is the hyper parameter, is the pixel uncertainty when c is the category, i is the query feature.

[0036] Further, the constructing step of the positive sample pair and the negative sample pair comprises:

[0037] Traversing the query feature in the high uncertainty set, taking the pixel of the currently traversed query feature as a query pixel;

[0038] Taking the query pixel and the final k subspace prototypes matched with the query pixel as a positive sample pair;

[0039] Taking the query pixel and the different category pixel feature as a negative sample pair.

[0040] Further, the pixel-level contrastive loss is a pixel-level contrastive loss based on cosine similarity and a calculation temperature τ, and the expression is:

[0041]

[0042] In the formula, L SuCo is the pixel-level contrastive loss, c is the category c, f i is the query feature in the high uncertainty set F c,hard , f + is the positive sample, f - is the negative sample, and τ is the temperature. - is the negative sample set.

[0043] Further, the expression of the total loss is:

[0044] L Total = L Sup / SemiSup + L SuCo + L KL

[0045] In the formula, L Total is the total loss, L Sup / SemiSup is the supervised / semi-supervised segmentation loss, L SuCo is the pixel-level contrastive loss, and L KL is an evidence learning regularization term to punish unseparable pixels.

[0046] The application also provides an electronic device, characterized by comprising: one or more processors; a memory; and one or more programs stored in the memory, the one or more programs comprising instructions for performing the semi-supervised segmentation method for industrial quality inspection as described above.

[0047] The application further provides a computer-readable storage medium comprising one or more programs for execution by one or more processors of an electronic device, the one or more programs comprising instructions for performing the semi-supervised segmentation method for industrial quality inspection as described above.

[0048] Compared with the prior art, the application has the following beneficial effects:

[0049] (1) The application estimates pixel-level uncertainty based on evidence theory to constrain the influence of unreliable pixels and stabilize contrast learning, and proposes a subspace prototype generation strategy to obtain multiple fine-grained subspace prototypes, thereby modeling intra-class fine-grained semantic differences, and calculating a pixel-level contrast loss through pixel-level contrast learning, which can significantly improve the segmentation accuracy of the model.

[0050] (2) The application uses uncertainty-aware subspace feature contrast learning framework, introduces uncertainty constraints in the whole process of pixel-level contrast learning "query sampling-prototype construction-prototype update-loss calculation", and through the two-stage strategy of "class prototype->subspace prototype", the strategy first aggregates a class prototype based on low-uncertainty pixels, and then obtains multiple fine-grained subspace prototypes through momentum update under the driving of high-uncertainty query pixels, thereby depicting intra-class fine-grained semantic differences, and realizing stable, efficient and easily integrated semi-supervised semantic segmentation training.

[0051] (3) The application uses uncertainty estimation to solve the problems of existing pseudo-label noise and overconfidence. And the application uses evidence learning and uncertainty to construct stable, low-noise and sufficient contrast targets without relying on large-scale memory banks, to alleviate the "local-global feature deviation" caused by local sampling, and to improve the learning stability and accuracy in the few-labeled scenario.

[0052] (4) The subspace prototype generation strategy of the application overcomes the over-shrinkage and detail loss caused by a single class prototype by explicitly modeling intra-class fine-grained multi-modal structure.

[0053] (5) The application uses a contrast learning strategy to solve the problems of existing class imbalance and long-tail segmentation and insufficient use of feature space structure. At the same time, the subspace contrast learning strategy can reliably identify and preferentially learn learnable difficult examples while suppressing the negative impact of unlearnable noise on training based on more calibrated indicators.

[0054] (6) Compared with the prior art, the application achieves excellent segmentation performance only with a small amount of labeled samples, has reliable sample selection, robust contrast targets, small memory overhead, can be cooperatively optimized with existing semi-supervised learning methods, and is easy to integrate. BRIEF DESCRIPTION OF DRAWINGS

[0055] Figure 1A flowchart of the method of the present application;

[0056] Figure 2 A clustering-diffusion diagram of the present application;

[0057] Figure 3 A segmentation result diagram of the present application;

[0058] Figure 4 A visualization contrast result diagram of the present application;

[0059] Figure 5 An uncertainty distribution diagram of the present application. DETAILED DESCRIPTION

[0060] The present application will be described in detail below with reference to the accompanying drawings and specific embodiments. The present embodiment is implemented on the basis of the technical solution of the present application, and gives a detailed implementation manner and specific operation process, but the protection scope of the present application is not limited to the following embodiments.

[0061] Embodiment 1

[0062] The present embodiment provides a semi-supervised segmentation method for industrial quality inspection, which uses an uncertainty perception subspace feature contrast learning framework, estimates pixel-level uncertainty based on evidence theory, and uses it to constrain the influence of unreliable pixels and stabilize contrast learning. And propose a subspace prototype generation strategy, first aggregate class prototypes based on low uncertainty pixels, and then get multiple fine-grained subspace prototypes through momentum update under the promotion of high uncertainty query pixels, so as to model the intra-class fine-grained semantic difference. Specifically, as shown in Figure 1 The method comprises the following steps:

[0063] S1, obtaining an industrial quality inspection image and performing preprocessing.

[0064] Data organization and division: This step first prepares the industrial quality inspection image dataset, uses a small number of labeled samples as the labeled training set, and uses a large number of unlabeled samples as the unlabeled training set; unify the image size and channel format, and complete the class index and label check.

[0065] Basic preprocessing: Perform enhancement operations such as scale, random or center cropping, normalization, color disturbance, and random horizontal flipping on the input image to improve the robustness of the model to scale, illumination, and deformation.

[0066] Batch construction: Each round of training forms a training batch by mixing sampling from labeled and unlabeled data; record the source type and enhancement parameters of each image to facilitate subsequent loss weighting or pseudo-label filtering.

[0067] S2, using a backbone segmentation network to generate a pixel-level feature map and a classification output.

[0068] The semi-supervised segmentation model in this embodiment performs segmentation, which includes a backbone segmentation network, a classification head, and a feature extraction head. The backbone segmentation network can be ResNet-50 / 101, the classification head f class : F→E, which outputs pixel-by-pixel prediction classes.

[0069] This step includes the following:

[0070] Feature extraction: input the image into the backbone segmentation network to obtain a pixel-level feature map corresponding to the spatial position of the image; the feature extraction head z: X→F, such as DeepLabv3+ or DeepLabv3.

[0071] If necessary, use multi-scale, dilated convolution, or feature pyramid to enhance the context.

[0072] Classification prediction: connect the classification head on the feature map to output pixel-by-pixel classification output; align the resolution to the original image scale through upsampling or decoder to obtain a prediction map with the same size as the input.

[0073] S3, use evidence learning to perform SoftPlus transformation on the classification output to obtain the evidence quantity, confidence, and pixel uncertainty of each class.

[0074] This step mainly performs evidence learning and uncertainty estimation, including the following steps:

[0075] SoftPlus transformation is performed on the logits of each pixel to obtain the evidence quantity, and the Dirichlet parameter is constructed:

[0076]

[0077] The pixel-level "confidence-uncertainty" is defined as:

[0078]

[0079] In the formula, is the evidence quantity of class c, i is the i-th pixel, is the output of the classification head, is the Dirichlet parameter, SoftPlus is the SoftPlus operation, is the confidence of class c, C is the number of classes, is the pixel uncertainty of class c.

[0080] During training, supervised / semi-supervised segmentation loss is used for labeled pixels, and KL regularization of evidence learning is introduced to punish unclassifiable pixels.

[0081] S4, divide the same class pixels into low uncertainty set F c,easy and high uncertainty set F c,hard .

[0082] This step is mainly based on uncertainty-aware query sampling, including the following steps:

[0083] For each class c, set an uncertainty threshold δ∈(0, 1), where δ can be fixed or adaptive using in-batch quantile;

[0084] Combined with the uncertainty threshold δ, the same class pixels are divided to obtain the low uncertainty set F c,easy and the high uncertainty set F c,hard , respectively, which are represented as:

[0085]

[0086] In the formula, F c is the pixel feature set of class c, and f is the feature corresponding to the i-th pixel point.

[0087] The training query samples are sampled from difficult random equilibrium (e.g., a total of 256 query pixels are sampled per batch).

[0088] S5, aggregate F c,easy to obtain the class prototype pro c of each class, and initialize the k subspace prototypes of the class.

[0089] This step is mainly to generate stable class prototypes through clustering, including the following steps:

[0090] As shown in Figure 2 , the class prototype of each class is aggregated using the low uncertainty set in this embodiment. Preferably, a weighted average of "low uncertainty large weight" is used:

[0091]

[0092] In the formula, pro c is the class prototype of class c, f is the feature corresponding to the i-th pixel point, F c,easy is the low uncertainty set, and is the pixel uncertainty when c is the class.

[0093] Then, the k subspace prototypes of the class are initialized using the class prototype:

[0094]

[0095] In the formula, is the initialized subspace prototype corresponding to class c, k is the number of subspace prototypes, and proc is the class prototype of the class c.

[0096] S6, traverse F c,hard , select the subspace prototype pro i closest to f i , and perform momentum update to form a fine-grained subspace prototype. c

[0097] This step is mainly through scattering, and the subspace is formed by high uncertainty query pixels, including the following steps:

[0098] As shown in Figure 2 , traverse the high uncertainty set F c,hard , select the subspace prototype closest to the cosine distance according to the nearest neighbor principle, and perform momentum update:

[0099]

[0100] wherein, is the subspace prototype after momentum update, α ∈ (0, 1] is the momentum coefficient (preferably α ∈ [0.01, 0.5]), mm = 1 / (i+σ) is the step weight function, i is the i-th pixel, σ is a hyperparameter, set to 256, is the pixel uncertainty when c is the class, f i is the query feature.

[0101] After scattering, k fine-grained subspace prototypes of each class c are obtained.

[0102] S7, the query pixel and its matching subspace prototype are taken as positive sample pairs, and the query pixel and the feature of the different class pixel are taken as negative sample pairs, and the pixel-level contrast loss with a temperature τ is calculated based on the cosine similarity.

[0103] This step is to perform pixel-level contrast learning:

[0104] The query pixel (referring to traversing each pixel, the pixel being processed is referred to as a query pixel) and its matching nearest subspace prototype form a positive sample pair; the negative sample is sampled from the “non-c” class pixel using a balanced sampling method (current batch sampling, avoiding additional memory library), and the temperature coefficient τ>0 (preferably τ=0.5). The pixel-level InfoNCE loss is:

[0105]

[0106] wherein, L SuCo is the pixel-level contrast loss, c is the class c, f i is the query feature in the high uncertainty set F c,hard , f + is the positive sample, and f​- is the negative sample, τ is the temperature, R - is the negative sample set.

[0107] S8, jointly minimizing the supervised / semi-supervised segmentation loss, the contrastive loss, and the KL term of evidence learning to train the network parameters.

[0108] The expression of the total loss is:

[0109] L Total = L Sup / SemiSup + L SuCo + L KL

[0110] In the formula, L Total is the total loss, L Sup / SemiSup is the supervised / semi-supervised segmentation loss, LSup / SemiSup can be cross-entropy or its variants, L SuCo is the pixel-level contrastive loss, L KL is the evidence learning regularization term to punish unclassifiable pixels. In semi-supervised learning, the pseudo label comes from the teacher-student or self-training framework.

[0111] The semi-supervised segmentation model is trained by the total loss described above, and a trained semi-supervised segmentation model is obtained.

[0112] Specifically, the model optimization process includes

[0113] Probability and segmentation result: the pixel-wise class score is mapped to a probability or calibrated confidence distribution; the final class of the pixel is selected according to the maximum probability, and a segmentation result map is obtained.

[0114] Uncertainty estimation: the pixel uncertainty is calculated according to the “confidence” of the output distribution, which can use evidence learning. The higher the uncertainty, the more unreliable the pixel prediction is.

[0115] Pseudo label and screening (for semi-supervised learning): set a confidence threshold or dynamic threshold strategy for unlabeled samples, and only keep high-confidence pixels as pseudo labels; low-confidence pixels are down-weighted or skipped to reduce the interference of noise on training.

[0116] Loss and optimization: calculate the supervised loss based on the labeled pixels, and calculate the semi-supervised loss based on the screened unlabeled pixels; at the same time, add a regularization term for calibration and to prevent overconfidence. Weighted sum of each loss, back propagation and parameter update.

[0117] For the trained semi-supervised segmentation model, the preprocessed industrial quality inspection image to be segmented can be input, and the final segmentation result is output after projection.

[0118] Figure 3The method of the embodiment is compared with the segmentation results of similar methods (supervised learning-based methods and ReCo methods) in a label-scarce scenario, and the method of the embodiment exhibits excellent performance. The arrows represent errors in the segmentation results.

[0119] Figure 4 The visualization comparison results are shown in the figure, where the first row shows the input image and its corresponding actual label. The embodiment compares the performance of ReCo and Unco on the prediction map, error map and confidence map (as shown in the second to fourth rows). It can be seen that due to the overconfidence problem caused by SoftMax, ReCo makes segmentation errors in areas with high prediction confidence (highlighted in the box).

[0120] Figure 5 The uncertainty (probability) distribution map is shown in the figure, which shows the distribution of the SoftMax-Based method (RcCo) and the method of the embodiment at different confidence levels (or probabilities). ReCo samples are concentrated at a high confidence level, but even in those cases, the error rate is still high. In contrast, the method of the embodiment has a higher degree of differentiation in the confidence level.

[0121] In addition, since semi-supervised learning involves labeled data and unlabeled data, the semi-supervised segmentation method of the embodiment can be applied to both labeled data and unlabeled data to achieve segmentation.

[0122] Embodiment 2

[0123] The embodiment provides an electronic device, comprising: one or more processors; a memory; and one or more programs stored in the memory, the one or more programs including instructions for performing the semi-supervised segmentation method for industrial quality inspection as described in embodiment 1.

[0124] The above functions, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or parts of the present application that essentially contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0125] Those skilled in the art will appreciate that embodiments of the present application can be readily used as software, hardware, or a combination of software and hardware. In a software embodiment, various software modules are stored in memory (such as RAM, ROM, etc.) and executed by one or more general-purpose or special-purpose processors. In a hardware embodiment, various functions are performed by various hardware components. In an embodiment that is a combination of software and hardware, various functions are performed by a combination of software and hardware.

[0126] The present application is described in reference to the flowchart illustrations and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processing system or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 means for performing the function of one or more of the flowchart illustrations and / or block diagrams blocks.

[0127] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the flowchart illustrations and / or block diagrams block or blocks. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 means for performing the function of one or more of the flowchart illustrations and / or block diagrams blocks.

[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flowchart illustrations and / or block diagrams block or blocks. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 means for performing the function of one or more of the flowchart illustrations and / or block diagrams blocks.

[0129] While preferred embodiments of the application have been described, modifications and variations can be apparent to those skilled in the art once aware of the general underlying concepts. Accordingly, the appended claims are intended to embrace all such modifications and variations as fall within the scope of the application.

[0130] It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application cover modifications and variations of this application provided they come within the scope of the appended claims and their equivalents.

Claims

1. A semi-supervised segmentation method for industrial quality inspection, characterized in that, The method comprises the following steps: An industrial quality inspection image to be segmented is acquired, preprocessed, and input into a pre-trained semi-supervised segmentation model for processing to output a final segmentation result, wherein the semi-supervised segmentation model comprises a backbone segmentation network, a classification head, and a feature extraction head, and the training steps of the semi-supervised segmentation model comprise: An industrial quality inspection image set is acquired, preprocessed, processed by the backbone segmentation network to generate a pixel-level feature map, and pixel-by-pixel classification output is obtained by using the classification head; The classification output is transformed by using the feature extraction head to extract pixel-by-pixel fine-grained features, and further divide the same type of pixels into a low-uncertainty set and a high-uncertainty set, wherein the same type of pixels is obtained from the pixel-level feature map according to the category; The low-uncertainty set is used to aggregate to obtain a category prototype of each category, and k subspace prototypes are initialized, and the high-uncertainty set is combined to obtain the final k subspace prototypes; Based on the final k subspace prototypes, positive sample pairs and negative sample pairs are constructed, a pixel-level contrast loss is further constructed, and a total loss is further constructed for model parameter optimization to obtain a trained semi-supervised segmentation model. 2.The semi-supervised segmentation method for industrial quality inspection according to claim 1, wherein, The preprocessing operation comprises performing scale, random or center cropping, normalization, color disturbance, and random horizontal flipping on the industrial quality inspection image. 3.The semi-supervised segmentation method for industrial quality inspection of claim 1, wherein, The division steps of the low-uncertainty set and the high-uncertainty set comprise: Based on the classification output, evidence learning is used to perform SoftPlus transformation to obtain the evidence quantity, confidence, and pixel uncertainty of each category, which are respectively represented as: wherein, is the evidence amount for class c, i is the i-th pixel, is the output of the classification head, is the Dirichlet parameter, SoftPlus is the SoftPlus operation, is the confidence for class c, C is the number of classes, is the pixel uncertainty for class c. For each category c, set an uncertainty threshold δ∈(0,1); In combination with the uncertainty threshold δ, the same kind of pixels are divided to obtain a low uncertainty set F c,easy and a high uncertainty set F c,hard , respectively In the formula, F c is a pixel feature set of category c, and f is a feature corresponding to the i-th pixel point. For the same type of pixels with labels, they can be directly induced into the low-uncertainty set.

4. The semi-supervised segmentation method for industrial quality inspection according to claim 1, wherein, The expression of the category prototype of each category is: In the formula, pro c is the class prototype of the class c, f is the feature corresponding to the i-th pixel point, F c,easy is the low uncertainty set, is the pixel uncertainty when c is the class.

5. The semi-supervised segmentation method for industrial quality inspection according to claim 1, wherein, The step of obtaining the final k subspace prototypes comprises: Iterate through the query features in the high-uncertainty set, and select the initialized subspace prototype with the closest cosine distance to the query feature according to the nearest neighbor principle, wherein the initialized subspace prototype is represented as: wherein is the initialized subspace prototype corresponding to class c, k is the number of subspace prototypes, pro c is the class prototype for class c. Perform momentum update on the selected initialized subspace prototype to obtain the final k subspace prototypes, wherein the expression of the momentum update is: wherein is the momentum updated subspace prototype, a is the momentum coefficient, m = 1 / (i + s) is the step weight function, i is the i-th pixel, s is the hyperparameter, is the pixel uncertainty for class c, f i is the query feature.

6. The semi-supervised segmentation method for industrial quality inspection according to claim 1, wherein, The construction steps of the positive sample pairs and the negative sample pairs comprise: Iterate through the query features in the high-uncertainty set, and set the pixels of the currently iterated query features as query pixels; Set the query pixels and their matching final k subspace prototypes as positive sample pairs; Set the query pixels and the features of different types of pixels as negative sample pairs.

7. The semi-supervised segmentation method for industrial quality inspection according to claim 1, wherein, The pixel-level contrast loss is a pixel-level contrast loss based on the calculation temperature τ of the cosine similarity, and the expression is: In the formula, L SuCo is a pixel-level contrast loss, c is a class, f i is a high-uncertainty set F c,hard query features in F + is a positive sample, f - is a negative sample, τ is a temperature, R - is a negative sample set.

8. The semi-supervised segmentation method for industrial quality inspection according to claim 1, wherein, The expression of the total loss is: L Total = L Sup / SemiSup + L SuCo + L KL where L Total is the total loss, L Sup / SemiSup is the supervised / semi-supervised segmentation loss, L SuCo is the pixel-level contrastive loss, L KL is the evidence learning regularizer to penalize unclassifiable pixels.

9. An electronic device, comprising: comprise: one or more processors; memory; and one or more programs stored in the memory, which comprise instructions for executing the semi-supervised segmentation method for industrial quality inspection as claimed in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, One or more programs for execution by one or more processors of an electronic device, the one or more programs including instructions for performing the semi-supervised segmentation method for industrial quality inspection of any of claims 1-8.