Anomaly identification method and device

CN122760595BActive Publication Date: 2026-10-27苏州深视信息科技有限公司 +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611219307.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-12
Publication Date
2026-10-27
Estimated Expiration
2046-08-12

AI Technical Summary

Technical Problem

[0003]然而,真实工业场景中,带标签的异常样本较为稀缺,现有技术中,通常只能在仅在正常样本的验证集上计算统计特征,进而设置全局分割阈值

Benefits of technology

[0023]本申请的有益效果是:本申请实施例的异常识别方法,通过采集待检测工件的图像,将所述图像输入预训练的主干网络,得到所述图像中的高置信异常区、高置信正常区和待复核模糊区;获取所述图像的不确定度以及结构复杂度,以及,所述异常识别的剩余可用耗时,以确定进入的识别模式,分配对应模式的迭代预算步数;若所述待复核模糊区不为空,在所述主干网络中临时挂载轻量级分类器,在所述迭代预算步数内,执行基于树结构的搜索以更新所述分类器;其中,所述更新包括:更新与所述高置信异常区和高置信正常区对应的伪监督样本集,利用更新后的伪监督样本集对所述分类器进行在线传播更新;利用更新后的分类器对所述待复核模糊区进行推理,输出所述工件的检测结果,所述检测结果包括良品或次品,若所述检测结果为次品,所述检测结果还包括表征所述工件中缺陷的位置和类型,不仅异常检测的准确率得以大幅提升,进一步提升产线质量控制的精准度,且能降低计算开销。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122760595B_ABST
    Figure CN122760595B_ABST
Patent Text Reader

Abstract

The application discloses an abnormality identification method and device. The abnormality identification method comprises the following steps: collecting an image of a workpiece to be detected, inputting the image into a backbone network to obtain a high-confidence abnormal area, a high-confidence normal area and a to-be-reviewed fuzzy area in the image; acquiring an uncertainty, a structural complexity and a residual available time for abnormality identification of the image to determine an entering identification mode and allocate an iteration budget step number corresponding to the mode; if the to-be-reviewed fuzzy area is not empty, temporarily mounting a lightweight classifier in the backbone network, performing tree structure-based search within the iteration budget step number to update the classifier; and performing reasoning on the to-be-reviewed fuzzy area by using the updated classifier and outputting a detection result of the workpiece, wherein the detection result comprises a good product or a defective product, and if the detection result is the defective product, the detection result further comprises a position and a type of a defect in the workpiece. Therefore, the accuracy of abnormality detection and the precision of production line quality control can be greatly improved, and the calculation cost can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of industrial anomaly detection technology, and in particular to an anomaly identification method and device. Background Technology

[0002] In the industrial production sector, anomaly detection has become a core technical means to ensure product quality.

[0003] However, in real-world industrial scenarios, labeled anomalous samples are scarce. Current technologies typically only calculate statistical features on a validation set of normal samples, and then set a global segmentation threshold. This static threshold strategy is prone to extremely high false negative or false negative rates when faced with minor deviations in new batches of products or changes in ambient lighting, failing to meet the stringent requirement of "zero false negatives" on production lines. Furthermore, existing anomaly detection models use the same forward inference computation for all images of the workpieces to be inspected, unable to allocate more computational power for in-depth confirmation of "ambiguous" samples near the decision boundary. In addition, the reasoning process of existing models is invisible; the Quality Management System (QMS) can only passively receive "pass / fail" results, unable to know the "degree of indecision" the model makes when arriving at that result. This makes it impossible to effectively identify and intercept "high-risk good products" on the verge of being missed.

[0004] Therefore, improving the accuracy of anomaly detection is a pressing technical problem that needs to be solved. Summary of the Invention

[0005] This application provides an anomaly identification method and device. The technical solution is as follows: On the one hand, an anomaly detection method is provided, applied to electronic devices, including: Step S1: Acquire an image of the workpiece to be inspected, input the image into the pre-trained backbone network, and obtain the high-confidence abnormal region, high-confidence normal region, and blurred region to be verified in the image; Step S2: Obtain the uncertainty and structural complexity of the image, as well as the remaining available time for anomaly recognition, in order to determine the entry recognition mode and allocate the iteration budget steps for the corresponding mode. Step S3: If the ambiguous region to be verified is not empty, a lightweight classifier is temporarily attached to the backbone network. Within the iteration budget steps, a tree-based search is performed to update the classifier. The update includes: updating the pseudo-supervised sample set corresponding to the high-confidence outlier region and the high-confidence normal region, and using the updated pseudo-supervised sample set to perform online propagation update of the classifier. Step S4: Use the updated classifier to perform reasoning on the fuzzy region to be verified and output the detection result of the workpiece. The detection result includes good product or defective product. If the detection result is defective product, the detection result also includes the location and type of defects in the workpiece.

[0006] In some embodiments, step S1 includes: The image is input into the backbone network to obtain an anomaly score heatmap and uncertainty map corresponding to the image; wherein, the anomaly score heatmap is used to characterize the continuous confidence that each spatial location in the image belongs to an anomaly, and the uncertainty map is used to characterize the stability of the judgment result; Based on the anomaly score heatmap and the uncertainty map, the high-confidence anomaly region, the high-confidence normal region, and the blurred region to be verified in the image are determined.

[0007] In some embodiments, determining the high-confidence outlier region, the high-confidence normal region, and the blurred region to be reviewed in the image based on the outlier score heatmap and the uncertainty map includes: If the anomaly score of the spatial location is greater than the first score threshold and the uncertainty is less than or equal to the preset uncertainty classification threshold, the spatial location is classified as the high confidence anomaly region. If the abnormal score of the spatial location is less than the second score threshold, and the uncertainty is less than or equal to the preset uncertainty classification threshold, the spatial location is classified as the high-confidence normal region. The remaining spatial locations are designated as the fuzzy regions to be reviewed; Wherein, the first score threshold is greater than the second score threshold.

[0008] In some embodiments, the identification mode includes: a normal mode, an extended TTT mode, and a basic TTT mode, wherein the iteration budget steps of the extended TTT mode are greater than the iteration budget steps of the basic TTT mode; Step S2 includes: If the overall uncertainty of the image is less than a first uncertainty threshold, and the structural complexity is less than a first complexity threshold, the recognition mode is determined to be the conventional mode. If the overall uncertainty of the image is greater than or equal to the second uncertainty threshold, or if the structural complexity is greater than or equal to the second complexity threshold, and the remaining available time is greater than or equal to the preset delay limit, then the recognition mode is determined to be the extended TTT mode. Otherwise, the recognition mode corresponding to the image is determined to be the basic TTT mode; Wherein, the first uncertainty threshold is less than the second uncertainty threshold; the first complexity threshold is less than the second complexity threshold.

[0009] In some embodiments, the formula for calculating the overall uncertainty is as follows: ; in, The image represents the overall uncertainty, H represents the height of the image, W represents the width of the image, p represents the index of the spatial position in the image, and U(p) represents the uncertainty value at spatial position p. The formula for calculating the complexity is as follows: ; in, This indicates the structural complexity of the image. This represents the first weighting coefficient. Indicates the number of abnormal connected regions. This represents the second weighting coefficient. Indicates the candidate boundary length. This represents the third weighting coefficient. This indicates the degree of local fluctuation in the abnormal heatmap.

[0010] In some embodiments, step S2 further includes: Obtain the video memory usage rate of the electronic device, the number of tasks currently queued, and the preset delay threshold of the production line corresponding to the workpiece; The iterative budget steps for the corresponding allocation pattern include: The number of iterative budget steps is calculated based on a budget function, which is: ; in, This indicates the current video memory usage rate of the electronic device. This indicates the number of tasks currently queued. This indicates the preset time delay threshold of the production line corresponding to the workpiece.

[0011] In some embodiments, the budget function is: ; in, This indicates the maximum number of steps to the preset budget. These are the weighting coefficients. This indicates the idle time of the production line corresponding to the workpiece.

[0012] In some embodiments, step S3 includes: Generate corresponding pseudo-supervised sample sets for the high-confidence anomaly region and the high-confidence normal region; Perform a visual tree search, where each tree node of the visual tree search corresponds to a classifier, and each path corresponds to an anomaly boundary scheme. For each tree expansion: A subset of features is obtained from the high-confidence outlier region and / or the high-confidence normal region, and the pseudo-supervised sample set is updated by combining the corresponding pseudo-labels. Update the pseudo-supervised sample set, and use the updated pseudo-supervised sample set to perform online propagation updates on the classifier; The updated classifier is used to calculate the current tree node's reward value; The selected tree nodes for the next round are guided by the revenue value, and the above process is repeated within the allocated iteration budget steps to output the optimal path.

[0013] In some embodiments, generating corresponding pseudo-supervised sample sets for the high-confidence outlier region and the high-confidence normal region includes: Based on the anomaly score heatmap, obtain the anomaly score and uncertainty value corresponding to the spatial location of the image; If the anomaly score is greater than or equal to the anomaly determination threshold, and the uncertainty value is less than or equal to the uncertainty filtering threshold, the feature corresponding to the spatial location is marked as a pseudo-anomaly sample and added to the pseudo-supervised sample set. If the abnormal score is less than or equal to the threshold under normal judgment, and the uncertainty value is less than or equal to the uncertainty filtering threshold, the feature corresponding to the spatial location is marked as a pseudo-normal sample and added to the pseudo-supervised sample set; Wherein, the upper threshold for abnormal judgment is greater than the lower threshold for normal judgment.

[0014] In some embodiments, the revenue value is calculated according to the following formula: Where Q represents the node's revenue. is the weighting coefficient, Sep represents the improvement value of the separability between abnormal and normal features, Cons represents the local consistency value of the fuzzy region to be reviewed, Ent represents the remaining uncertainty, and Cost represents the additional computing power overhead brought by the current tree node.

[0015] In some embodiments, the tree includes a Monte Carlo tree, and selecting the next tree node to obtain the optimal path includes: Calculate the boundary values ​​of at least two tree nodes to be selected, and select the tree node with the largest boundary value as the next round tree node.

[0016] In some embodiments, the formula for selecting the tree node with the largest boundary value as the next round tree node is: ; in, The selected tree node is represented by s, which represents the root node currently being searched in the visual tree. Q(s, a) represents the average reward of the tree node to be selected, c represents a constant, N(s) is the total number of times the root node has been explored, and N(s, a) represents the number of times it has been explored.

[0017] In some embodiments, step S4 includes: The parameters of the classifier are optimized using a loss function; the loss function is: , in, Represents the loss function. Indicates the weighting coefficient. This indicates the loss of supervision due to false labels. Indicates consistency loss. Indicates boundary smoothing loss. This is the interval loss; If the preset stopping condition is met, the optimization stops, and the updated classifier is obtained.

[0018] In some embodiments, the method further includes: Step S5: Record the dynamic process information of steps S1 to S4; generate a risk index corresponding to the image based on the dynamic process information; if the risk index is higher than a preset risk threshold and the detection result of the workpiece is good, the output detection result includes a high-risk mark corresponding to the good product; trigger subsequent quality processing operations based on the high-risk mark.

[0019] On the other hand, an electronic device is provided, comprising: The acquisition module is used to acquire images of the workpiece to be inspected, input the images into a pre-trained backbone network, and obtain high-confidence abnormal regions, high-confidence normal regions, and blurred regions to be verified in the images. The acquisition module is used to acquire the uncertainty and structural complexity of the image, as well as the remaining available time for anomaly recognition, in order to determine the entry recognition mode and allocate the iteration budget steps for the corresponding mode. An update module is used to temporarily attach a lightweight classifier to the backbone network if the ambiguous region to be verified is not empty, and to perform a tree-based search to update the classifier within the iteration budget steps; wherein, the update includes: updating the pseudo-supervised sample set corresponding to the high-confidence outlier region and the high-confidence normal region, and using the updated pseudo-supervised sample set to perform online propagation update of the classifier; The detection module is used to perform reasoning on the fuzzy region to be verified using the updated classifier and output the detection result of the workpiece. The detection result includes good product or defective product. If the detection result is defective product, the detection result also includes the location and type of defects in the workpiece.

[0020] On the other hand, an electronic device is provided, the device including a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to implement the above-described anomaly detection method.

[0021] On the other hand, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, the at least one computer program being loaded and executed by a processor to implement the above-described anomaly detection method.

[0022] On the other hand, a computer program product is provided, including a computer program that is loaded and executed by a processor to implement the above-described anomaly detection method.

[0023] The beneficial effects of this application are as follows: The anomaly recognition method of this application acquires an image of the workpiece to be detected, inputs the image into a pre-trained backbone network, and obtains high-confidence anomaly regions, high-confidence normal regions, and ambiguous regions to be verified in the image; it obtains the uncertainty and structural complexity of the image, as well as the remaining available time for anomaly recognition, to determine the recognition mode to be entered and allocate the iteration budget steps for the corresponding mode; if the ambiguous region to be verified is not empty, a lightweight classifier is temporarily attached to the backbone network, and within the iteration budget steps, a tree-based search is performed to improve the accuracy of the results. The new classifier includes the following update: updating the pseudo-supervised sample set corresponding to the high-confidence anomaly region and the high-confidence normal region; using the updated pseudo-supervised sample set to perform online propagation updates on the classifier; using the updated classifier to infer the fuzzy region to be verified, and outputting the detection result of the workpiece. The detection result includes good or defective products. If the detection result is defective, the detection result also includes the location and type of defects in the workpiece. This not only significantly improves the accuracy of anomaly detection and further enhances the precision of production line quality control, but also reduces computational overhead.

[0024] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 This is a schematic diagram illustrating an implementation environment according to an exemplary embodiment.

[0027] Figure 2 This is a flowchart illustrating an anomaly identification method according to an exemplary embodiment.

[0028] Figure 3 This is an exemplary embodiment illustrating an image of the workpiece to be inspected.

[0029] Figure 4 This is an exemplary embodiment illustrating an anomaly score heatmap.

[0030] Figure 5 This is an uncertainty diagram illustrated in an exemplary embodiment.

[0031] Figure 6 This is a schematic diagram illustrating the region division result of an exemplary embodiment.

[0032] Figure 7 This is a schematic diagram illustrating the uncertainty distribution of an exemplary embodiment.

[0033] Figure 8 This is a schematic diagram illustrating structural complexity analysis in an exemplary embodiment.

[0034] Figure 9 This is a schematic diagram illustrating the pattern determination result of an exemplary embodiment.

[0035] Figure 10 This is an exemplary embodiment illustrating an image of the workpiece to be inspected.

[0036] Figure 11 This is an exemplary embodiment illustrating an anomaly score heatmap.

[0037] Figure 12 This is an uncertainty diagram illustrated in an exemplary embodiment.

[0038] Figure 13 This is a schematic diagram illustrating the region division result of an exemplary embodiment.

[0039] Figure 14 This is a schematic diagram illustrating the uncertainty distribution of an exemplary embodiment.

[0040] Figure 15This is a schematic diagram illustrating structural complexity analysis in an exemplary embodiment.

[0041] Figure 16 This is a schematic diagram illustrating the pattern determination result of an exemplary embodiment.

[0042] Figure 17 This is an exemplary embodiment illustrating an image of the workpiece to be inspected.

[0043] Figure 18 This is an exemplary embodiment illustrating an anomaly score heatmap.

[0044] Figure 19 This is an uncertainty diagram illustrated in an exemplary embodiment.

[0045] Figure 20 This is a schematic diagram illustrating the region division result of an exemplary embodiment.

[0046] Figure 21 This is a schematic diagram illustrating the region division and defect location of an exemplary embodiment.

[0047] Figure 22 This is a schematic diagram illustrating the detection results of an exemplary embodiment.

[0048] Figure 23 This is a schematic diagram illustrating the region division and defect location of an exemplary embodiment.

[0049] Figure 24 This is a schematic diagram illustrating the detection results of an exemplary embodiment.

[0050] Figure 25 This is a schematic diagram illustrating the region division and defect location of an exemplary embodiment.

[0051] Figure 26 This is a schematic diagram illustrating the detection results of an exemplary embodiment.

[0052] Figure 27 This is a flowchart illustrating an anomaly identification method according to an exemplary embodiment.

[0053] Figure 28 This is a block diagram illustrating an electronic device according to an exemplary embodiment.

[0054] Figure 29 This is a schematic diagram of the structure of a terminal according to an exemplary embodiment.

[0055] Figure 30 This is a schematic diagram of the structure of a server according to an exemplary embodiment. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the described embodiments of this application are within the scope of protection of this application.

[0057] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0058] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the sound signals involved in this disclosure were all obtained with full authorization.

[0059] The anomaly identification method provided in this application can be executed by an electronic device, which can be at least one of a terminal and a server. The following is a schematic diagram illustrating the implementation environment of the anomaly identification method provided in this application. See also... Figure 1 , Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application. The implementation environment includes: terminal 101 and server 102.

[0060] In some embodiments, terminal 101 may run a client application containing the target application, which provides anomaly detection functionality. This application does not limit the implementation form of the target application; for example, it may be an application that requires downloading and installation, a mini-program that does not require installation, a web application, etc.

[0061] In some embodiments, terminal 101 can acquire an image of the workpiece to be inspected, and server 102 is used to provide background services for the target application. After acquiring the image of the workpiece to be inspected, terminal 101 transmits the image to server 102. Server 102 performs anomaly identification based on the image, obtains the detection result of the workpiece, and sends the detection result to terminal 101 for output.

[0062] In other embodiments, the terminal 101 itself can also acquire an image of the workpiece to be inspected, perform anomaly recognition on the image, and output the recognition result.

[0063] Terminal 101 can be a computer device such as an acoustic sensor with signal processing and output display functions, a mobile phone, a tablet computer, a multimedia playback device, a PC (Personal Computer), a wearable device, a VR (Virtual Reality) device, an AR (Augmented Reality) device, or a MR (Mixed Reality) device. Server 102 can be a standalone physical server, a server cluster consisting of multiple physical servers, or a distributed file system. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 102 and terminal 101 are directly or indirectly connected via wired or wireless communication.

[0064] Figure 2 This is a flowchart illustrating an anomaly detection method according to an exemplary embodiment. The method is performed by an electronic device. See also... Figure 2 The method includes the following steps.

[0065] Step S1: Acquire an image of the workpiece to be inspected, input the image into the pre-trained backbone network, and obtain the high-confidence abnormal region, high-confidence normal region, and blurred region to be verified in the image; Specifically, the images captured by the industrial camera, such as Figure 3 As shown, Figure 3 An exemplary embodiment illustrates an image of a workpiece to be detected, which is input into a pre-trained backbone network. This backbone network can be a vision-based self-supervised pre-trained encoder, an anomaly detection network, or a general segmentation backbone network.

[0066] In this embodiment of the invention, the high-confidence abnormal region, the high-confidence normal region, and / or the blurred region to be verified in the obtained image can be an empty set.

[0067] Step S2: Obtain the uncertainty and structural complexity of the image, as well as the remaining available time for anomaly recognition, in order to determine the entry recognition mode and allocate the iteration budget steps for the corresponding mode. The identification modes include: regular mode, extended TTT mode and basic TTT mode, wherein the iteration budget steps of the extended TTT mode are greater than the iteration budget steps of the basic TTT mode.

[0068] Step S3: If the ambiguous region to be verified is not empty, a lightweight classifier is temporarily attached to the backbone network. Within the iteration budget steps, a tree-based search is performed to update the classifier. The update includes: updating the pseudo-supervised sample set corresponding to the high-confidence outlier region and the high-confidence normal region, and using the updated pseudo-supervised sample set to perform online propagation update of the classifier. By attaching a lightweight classifier with a very small number of parameters downstream of the backbone network, the computational overhead of the forward and backward propagation of the classifier is negligible compared to that of the backbone network, which can significantly reduce the engineering deployment threshold of the training method during testing.

[0069] Step S4: Use the updated classifier to perform reasoning on the fuzzy region to be verified and output the detection result of the workpiece. The detection result includes good product or defective product. If the detection result is defective product, the detection result also includes the location and type of defects in the workpiece.

[0070] By reasoning about the ambiguous regions to be reviewed, the accuracy of anomaly identification can be further improved, and the precision of segmentation results can be further enhanced.

[0071] In this embodiment of the invention, the backbone network can be a visual feature extraction network DINOv2 based on self-supervised learning, with a model specification of DINOv2 ViT-S / 14, and its encoder architecture can be a VisionTransformer.

[0072] Specifically, the backbone network includes the following structural parameters: Encoder type: Vision Transformer (ViT) architecture; Patch Size: The input image can be divided into small image patches of 14×14 pixels, which are used as the basic processing unit of the transformer. Transformer Layers: 12 layers, each containing a multi-head self-attention mechanism and a feedforward neural network; Hidden Dimension: 384 dimensions, meaning that the feature vector output after each image patch is encoded by the transformer has a dimension of 384. Network parameter count: approximately 21 × 10 6 (21M) learnable parameters.

[0073] The backbone network employs a self-supervised learning strategy during the training phase, enabling it to complete pre-training on large-scale unlabeled image datasets without relying on a large number of manually labeled defective samples, thus achieving high efficiency in extracting visual features.

[0074] Specifically, the backbone network is pre-trained on massive unlabeled image datasets (such as the LVD-142M dataset) using an unsupervised / self-supervised learning (SSL) strategy, without relying on manually labeled defect labels.

[0075] The pre-training process employs a multi-task self-supervised learning objective function for joint optimization, which includes at least one of the following loss terms: (a) Image-level self-distillation loss (DINO Loss) A teacher-student network architecture is adopted to perform self-cross-entropy distillation on different augmented views (including global views and / or local cropped views) of the same input image; and learn a high-dimensional feature representation with global semantic invariance.

[0076] (ii) Masked Image Modeling Loss (iBOT) It can randomly cover up image patches corresponding to a preset proportion of spatial locations, forcing the student network to predict the token features of the covered image patches based on context information, thus enabling the network to have extremely strong local patch-level fine-grained representation capabilities.

[0077] (iii) KoLeo regularization term KoLeo regularization is introduced to constrain the uniformity of feature distribution in the feature space, preventing the output features of different samples from collapsing in the feature space, thereby maintaining the diversity of expression in the feature space.

[0078] Therefore, the LVD-142M large-scale unlabeled image dataset is used, and the training is performed based on the above loss function to obtain a trained backbone network, which serves as the pre-trained backbone network.

[0079] In some preferred embodiments, step S1 includes: The image is input into the backbone network to obtain an anomaly score heatmap and uncertainty map corresponding to the image; wherein, the anomaly score heatmap is used to characterize the continuous confidence that each spatial location in the image belongs to an anomaly, and the uncertainty map is used to characterize the stability of the judgment result; Based on the anomaly score heatmap and the uncertainty map, the high-confidence anomaly region, the high-confidence normal region, and the blurred region to be verified in the image are determined.

[0080] Specifically, the image is input into the backbone network, which outputs the following information through forward computation: 1. Multi-scale feature representation F={F1,F2,…,F…} l}; 2. Heatmap of outlier scores S∈R H×W ; 3. Uncertainty diagram U∈R H×W ; 4. Intermediate attention response map or semantic similarity map (Information 4 is an optional output).

[0081] The anomaly score heatmap S is used to characterize the continuous confidence that each spatial location in the image belongs to an anomaly. This spatial location can be the location of a pixel or the location of an image patch.

[0082] The uncertainty diagram is used to characterize the stability of the judgment result and can be calculated according to the formula for predictive distribution entropy: , Where p represents the index of the spatial location in the image, This represents the value of the uncertainty at spatial location p. Let p represent the probability that a given spatial location belongs to the c-th semantic hypothesis, where C represents the total number of semantic hypothesis types.

[0083] Specifically, the backbone network generates the probability distribution corresponding to the uncertainty map in the following manner.

[0084] After the input image is encoded by the backbone network (such as DINOv2), the local (patch-level) image patch feature tensor corresponding to each spatial location p is F(p)∈R. D , where D is the feature dimension.

[0085] A lightweight projection head, such as a lightweight patch classification / prototype head, is connected to the end of the backbone network. The projection head is used to map the feature vectors of each spatial location to probability distributions on C preset semantic hypothetical categories. The C preset semantic categories include normal background categories and one or more abnormal state categories (e.g., scratch defects, and / or stain pseudo-defects, etc.).

[0086] The lightweight projection head can be any of the following structures: 1×1 convolution class header; The Prototype Layer is used to calculate the cosine similarity between the feature vector and C preset learnable prototype vectors.

[0087] For any feature vector at spatial location p, after normalization using the Softmax function, we obtain the probability distribution vectors of that location belonging to each preset semantic category: Where W is the weight matrix, W c W is the weight vector corresponding to the c-th semantic category. k It is the weight vector corresponding to the k-th semantic category.

[0088] This yields the probability distribution vector of the position belonging to each preset semantic category: P=[P1(p),P2(p),……,P C (p)].

[0089] The uncertainty map U is calculated based on the probability distribution vector and is used to characterize the degree of uncertainty in the prediction of the backbone network at each spatial location.

[0090] Then, based on the probability distribution vector, the anomaly score heatmap S(p) and the uncertainty map U(p) are calculated.

[0091] (a) Heatmap of Abnormal Scores For any spatial location p, the predicted probabilities of it belonging to all anomalous state categories are summed to obtain the anomalous score for location p: The range of S(p) is [0,1], and the closer the value is to 1, the higher the confidence that the position belongs to the anomaly category.

[0092] The anomaly scores S(p) for all spatial locations across the entire map are arranged according to spatial coordinates to form the anomaly score heatmap S. For example, regarding... Figure 3The image of the workpiece to be inspected is shown. An anomaly score heatmap is calculated using the formula described above. Figure 4 As shown, Figure 4 This is an exemplary embodiment illustrating an anomaly score heatmap.

[0093] (ii) Uncertainty diagram For any spatial location p, the uncertainty of the prediction result at that location p is calculated using the aforementioned formula for calculating the prediction distribution entropy, based on its probability distribution vector. .

[0094] When the probability distribution vector is concentrated in a certain category, that is, when the backbone network determines with high confidence that the position belongs to a specific semantic category (e.g. It is 0.99. If the value is 0.01, then the predicted distribution entropy value U(p)≈0, indicating that the model's determination of the location has extremely high certainty.

[0095] When the probability distribution vector tends to be uniformly distributed among the categories (for example, the probabilities of each abnormal category and the normal category are close to 1 / C), specifically, when the backbone network cannot clearly distinguish whether a pixel location p, which is located in an area of ​​reflection, water stains, or dust interference, is normal or abnormal, such as... It is 0.5. If the value is 0.5, then U(p)≈1, indicating that the model cannot make a clear determination about the current position, that is, the position is in a state of high uncertainty.

[0096] Arrange the predicted distribution entropy U(p) of all spatial locations in the entire image according to spatial coordinates to obtain the uncertainty map of the same size as the image. For example, regarding... Figure 3 The image of the workpiece to be inspected is shown, and the uncertainty diagram is calculated as follows: Figure 5 As shown, Figure 5 This is an uncertainty diagram illustrated in an exemplary embodiment.

[0097] The predicted distribution entropy is used to measure the degree of disorder of the distribution corresponding to the probability. The larger the value of the predicted distribution entropy, the higher the uncertainty. After normalization, the value range is [0, 1].

[0098] The high-confidence outlier region, the high-confidence normal region, and the blurred region to be verified in the image can be determined based on the anomaly score heatmap and the uncertainty map. High confidence anomaly region This indicates a region with high abnormal scores and low uncertainty. This region is highly consistent with the normal background, and the model's judgment accuracy is extremely high. High confidence normal zone This indicates an area with an abnormally low score and low uncertainty. This area has obvious structural damage or severe contrast difference problems, which are indisputable fatal flaws. Ambiguous area to be reviewed This indicates regions with abnormal scores in the middle or with high uncertainty. These regions are located near the model decision boundary and typically contain pseudo-defects (such as water stains, oxidation, normal texture tolerances, etc.) and very weak true defects (such as very minor scratches, etc.).

[0099] Specifically, determining the high-confidence outlier region, the high-confidence normal region, and the blurred region to be reviewed in the image based on the outlier score heatmap and the uncertainty map includes: If the anomaly score of the spatial location is greater than the first score threshold and the uncertainty is less than or equal to the preset uncertainty classification threshold, the spatial location is classified as the high confidence anomaly region. If the abnormal score of the spatial location is less than the second score threshold, and the uncertainty is less than or equal to the preset uncertainty classification threshold, the spatial location is classified as the high-confidence normal region. The remaining spatial locations are designated as the fuzzy regions to be reviewed; Wherein, the first score threshold is greater than the second score threshold.

[0100] For example, if the first scoring threshold is set to 0.7, and the spatial location p has an abnormal score... If the uncertainty is less than or equal to a preset uncertainty threshold, then the spatial location p is classified into the high-confidence outlier region. .

[0101] The second scoring threshold is set to 0.2. If the score of spatial location p is abnormal... If the uncertainty is less than or equal to a preset uncertainty threshold, then the spatial location p is classified into the high-confidence normal region. .

[0102] The remaining spatial location p is divided into the fuzzy region to be verified. For example: the abnormal score of spatial location p Alternatively, if the uncertainty is greater than the preset uncertainty threshold, then the spatial location p is classified into the fuzzy region to be reviewed. .

[0103] For example, targeting Figure 3 The image of the workpiece to be inspected is shown, and the following calculations are performed. Figure 4 The abnormal score heatmap shown and Figure 5 The uncertainty map shown identifies the high-confidence outlier region, the high-confidence normal region, and the blurred region to be verified in the image, as follows: Figure 6 As shown, Figure 6This is a schematic diagram illustrating the region division result of an exemplary embodiment.

[0104] In some preferred embodiments, step S2 includes: If the overall uncertainty of the image is less than a first uncertainty threshold, and the structural complexity is less than a first complexity threshold, the recognition mode is determined to be the conventional mode. If the overall uncertainty of the image is greater than or equal to the second uncertainty threshold, or if the structural complexity is greater than or equal to the second complexity threshold, and the remaining available time is greater than or equal to the preset delay limit, then the recognition mode is determined to be the extended TTT mode. Otherwise, the recognition mode corresponding to the image is determined to be the basic TTT mode; Wherein, the first uncertainty threshold is less than the second uncertainty threshold; the first complexity threshold is less than the second complexity threshold.

[0105] Specifically, a computing power routing module can be configured to determine the incoming identification mode and then allocate the corresponding iteration budget steps. The following metrics can be obtained and input into the computing power routing module: 1. The overall uncertainty of the image ; 2. The structural complexity of the image ; 3. Current video memory usage of electronic devices ; 4. Number of tasks currently queued. ; 5. The preset time delay threshold for the production line corresponding to the workpiece. ; 6. The remaining available time-consuming space of the production line corresponding to the workpiece. ; 7. Historical average processing latency and current temperature and power consumption status of electronic devices (Indicator 7 is an optional input).

[0106] The formula for calculating the overall uncertainty is as follows: ; in, The image represents the overall uncertainty, H represents the height of the image, W represents the width of the image, p represents the position index of a local region in the image, and U(p) represents the uncertainty value at spatial position p.

[0107] U(p) is calculated using the aforementioned formula for predictive distribution entropy. By calculating the mean of the uncertainties at all locations in the entire image, the macroscopic fluctuation or generalization stability of the overall judgment result of the entire image can be characterized.

[0108] The formula for calculating the complexity is as follows: ; in, This indicates the structural complexity of the image. This represents the first weighting coefficient. Indicates the number of abnormal connected regions. This represents the second weighting coefficient. Indicates the candidate boundary length. This represents the third weighting coefficient. This indicates the degree of local fluctuation in the abnormal heatmap.

[0109] Specifically, the structural complexity index can be used to describe whether abnormal regions in the image are fragmented and whether their boundaries are complex.

[0110] To balance the impact of different dimensional indicators on structural complexity The contribution, the weighting coefficient , , Normalization or scale matching is required.

[0111] In this embodiment of the application, the specific value range and setting basis of each weight coefficient are as follows: First weighting coefficient (Weight of connected component quantity): The preferred value range is [0.1, 0.4], for example... The possible value is 0.2. The basis for this setting includes: This indicates the number of abnormal connected regions, reflecting the degree of fragmentation in these regions. In printed circuit board or precision wafer inspection scenarios, high-frequency pseudo-defects (such as minute dust interference) can cause a surge in the number of connected regions; therefore, setting an appropriate value is recommended. It can keenly capture these fragmented features and guide them into the corresponding recognition mode (such as TTT mode) for fine filtering.

[0112] Second weighting coefficient (Candidate boundary length weight): The preferred value range is [0.01, 0.1], for example... The possible value is 0.05. The setting criteria include: boundary length L edgeThe absolute value of is usually much larger than the number of connected components (larger units). To prevent long boundary defects (such as long scratches) from excessively dominating the complexity index and causing misjudgment of computing power requirements, a weighting coefficient is used. It should be set to a smaller value to achieve the effect of smoothing and boundary line constraint.

[0113] Third weighting coefficient (Weight of local volatility in the heatmap of outlier scores): The preferred value range is [0.4, 0.8], for example... The possible value is 0.6. The rationale for setting this parameter includes: Variance Var(S) reflects the degree of drastic spatial variation in outlier scores and is a core criterion for distinguishing between "real continuous defects" and "random noise background." Therefore, it can be set as the dominant weight (with the highest proportion), i.e., the weight coefficient. The value can be set to a larger value, thereby significantly increasing the structural complexity of the image when the energy fluctuations within the abnormal score heatmap are extremely drastic and the probability of false defects is high. This allows the system to be guided into the appropriate recognition mode (such as a higher-level extended TTT mode).

[0114] Preferably, before actual engineering deployment, the above weighting coefficients are... , , It can be obtained by performing a grid search or Bayesian optimization on a pre-collected validation set (containing samples of known types of true defects and common false defects). The objective function of optimization can be: the optimal coefficient values ​​that maximize the overall throughput of the system while satisfying a production line miss rate of ≤0.01%.

[0115] Based on the overall uncertainty of the image Structural complexity and the remaining available time-consuming space of the production line corresponding to the workpiece. Determining the recognition pattern includes: 1) If the overall uncertainty of the image The structural complexity is less than the first uncertainty threshold τ1, and the structural complexity is less than the first uncertainty threshold τ1. Less than the first complexity threshold τ c1 If the surface of the workpiece is found to be free of abnormal confusion and has a smooth texture, no further verification is required. The identification mode is determined to be the normal mode, and the normal release operation is performed directly.

[0116] Wherein, τ1 is a preset first uncertainty threshold (the value can be in the range of 0.10-0.30, for example, preferably 0.20), τ c1The first complexity threshold is preset (the value can be between 0.05 and 0.25, and is preferably 0.15).

[0117] 2) If the above-mentioned standard release conditions are not met, the Test-Time Training (TTT) review process will be triggered, and the following mode determination will be performed further: 2a) If difficulty condition A is met simultaneously: the overall uncertainty of the image Greater than or equal to the second uncertainty threshold τ2, or, the structural complexity Greater than or equal to the second complexity threshold τ c2 Furthermore, it satisfies computing time condition B: the remaining available time T. remain Greater than or equal to the preset delay limit T limit If so, the identification mode is determined to be the extended TTT mode.

[0118] Wherein, τ2 is a preset second uncertainty threshold, preferably 0.60; τ c2 The second complexity threshold is a preset value, preferably 0.65. limit It can be 30ms.

[0119] In the extended TTT mode, the maximum iteration budget steps B max It can be directly assigned the preset budget limit B. cap (e.g., 60 steps).

[0120] 2b) If the triggering conditions for the extended TTT mode described above are not met, including: difficulty condition A is not met (i.e., the difficulty is in the medium range, i.e., the overall uncertainty of the image is...). If the image is greater than or equal to the first uncertainty threshold τ1 and less than the second uncertainty threshold τ2, or if the image meets the difficulty condition A but not the computing power time condition B, then the recognition mode corresponding to the image is determined to be the basic TTT mode.

[0121] In the basic TTT mode, the maximum iteration budget steps B max It can be set to a smaller preset number of steps (e.g., 20 steps).

[0122] In other words, when When the uncertainty is below a preset first uncertainty threshold and the structural complexity is below a first complexity threshold, the identification mode is determined to be the normal mode, and the abnormal score heatmap is directly output with thresholding; when If the uncertainty is higher than or equal to the second uncertainty threshold, or the structural complexity is greater than or equal to the second complexity threshold (i.e., a complex boundary exists), the identification mode is determined to be the extended TTT mode (i.e., triggering the slow-thinking review process). In other cases, the identification mode is determined to be the basic TTT mode.

[0123] In some embodiments, the number of iterative budget steps for the corresponding pattern is calculated based on a budget function, wherein the budget function is: ; in, This indicates the current video memory usage rate of the electronic device. This indicates the number of tasks currently queued. This indicates the preset time delay threshold of the production line corresponding to the workpiece.

[0124] Optionally, the budget function is: ; in, This indicates the maximum number of steps to the preset budget. These are the weighting coefficients. This indicates the idle time of the production line corresponding to the workpiece.

[0125] First weighting coefficient k1 (image uncertainty control factor): The value range can be [10, 50], for example, a value of 30. Basis for setting: [0,1] If the image has high uncertainty due to factors such as reflection and foreign object interference, more TTT iteration steps need to be allocated to calibrate the decision boundary. Therefore, k1 can be set to dominate.

[0126] The second weighting coefficient k2 (structural complexity control factor): Its value range can be [5, 20], for example, a value of 10. Basis for setting: C s It represents the structural complexity of the image, reflecting the degree of fragmentation of the defects. The more complex the shape of the blurred region, the deeper the visual tree needs to be expanded, thus requiring a positive increase in the budget steps.

[0127] The third weighting coefficient k3 (time window redundancy factor): Its value range can be [2, 10], for example, a value of 5. Basis for setting: T idle Calculate T as the duration of the available idle computing window for the current device. idle / T limit This value reflects the ratio of the current production line idle time to the single-piece take-off time (red line). When the production line speed slows down and the idle time is long, this value increases, allowing the model to "think" a few more steps; conversely, it compresses the number of steps.

[0128] The fourth weighting coefficient k4 (queue penalty factor): Its value can range from [1, 5], for example, a value of 2. Basis for setting: Q len This represents the current length of the queue to be inspected. When the queue accumulates, the budgeted number of steps for the current sample needs to be reduced using k4 to prevent physical blockages on the production line.

[0129] Budget cap B capThe value range can be [50, 200] steps. For example, it can be set to 60 steps to cap the maximum computing power consumption and prevent the occurrence of infinite loops.

[0130] In summary, the computing power routing module can output the following set of discrete or continuous control quantities based on the input variables mentioned above: 1. Whether to enter normal mode (i.e., whether to skip the review and output directly); 2. Should we enter the basic TTT mode? 3. Whether to include extended TTT mode; 4. Iteration budget steps for the corresponding pattern ; 5. Maximum allowable time T for a single sample budget .

[0131] For example, please see Figures 3-9 , Figure 7 This is a schematic diagram illustrating the uncertainty distribution of an exemplary embodiment. Figure 8 This is a schematic diagram illustrating structural complexity analysis in an exemplary embodiment. Figure 9 This is a schematic diagram illustrating the mode determination result of an exemplary embodiment. (For...) Figure 3 The overall uncertainty of the image of the workpiece to be inspected is calculated. The structural complexity is 0.0066. The value is 0.1844. The preset first uncertainty threshold τ1 is 0.20, and the preset second uncertainty threshold τ2 is 0.60; the preset first complexity threshold τ c1 The value is 0.15, which is the preset second complexity threshold τ. c2 The value is set to 0.65. The identification pattern is determined to be the basic TTT pattern. The calculated iteration budget steps for this basic TTT pattern are 15 steps.

[0132] In another example, see Figures 10-16 , Figure 10 This is an exemplary embodiment illustrating an image of the workpiece to be inspected. Figure 11 This is an exemplary embodiment illustrating an anomaly score heatmap. Figure 12 This is an uncertainty graph illustrated in an exemplary embodiment. Figure 13 This is a schematic diagram illustrating the region division result of an exemplary embodiment. Figure 14 This is a schematic diagram illustrating the uncertainty distribution of an exemplary embodiment. Figure 15 This is a schematic diagram illustrating structural complexity analysis in an exemplary embodiment. Figure 16 This is a schematic diagram illustrating the mode determination result of an exemplary embodiment. (For...) Figure 10 The image of the workpiece to be inspected is shown, and the following calculations are performed. Figure 11The abnormal score heatmap shown and Figure 12 The uncertainty map shown identifies the high-confidence outlier region, the high-confidence normal region, and the blurred region to be verified in the image, as follows: Figure 13 As shown. The overall uncertainty of the image is calculated. The structural complexity is 0.0195. The value is 0.0775. The preset first uncertainty threshold τ1 is 0.20, and the preset second uncertainty threshold τ2 is 0.60; the preset first complexity threshold τ c1 The value is 0.15, which is the preset second complexity threshold τ. c2 The value is 0.65. The recognition mode is determined to be the normal mode; therefore, passage is allowed directly without iterative calculation.

[0133] In yet another example, see Figures 17-20 , Figure 17 This is an exemplary embodiment illustrating an image of the workpiece to be inspected. Figure 18 This is an exemplary embodiment illustrating an anomaly score heatmap. Figure 19 This is an uncertainty graph illustrated in an exemplary embodiment. Figure 20 This is a schematic diagram illustrating the region division result of an exemplary embodiment. (For...) Figure 17 The image of the workpiece to be inspected is shown, and the following calculations are performed. Figure 18 The abnormal score heatmap shown and Figure 19 The uncertainty map shown identifies the high-confidence outlier region, the high-confidence normal region, and the blurred region to be verified in the image, as follows: Figure 20 As shown. The overall uncertainty and structural complexity of the image are calculated. Using the same threshold comparison method as in the previous example, the recognition mode corresponding to the image can be determined to be the extended TTT mode. The budget function can be used to calculate the iterative budget steps corresponding to this extended TTT mode as 121 steps.

[0134] In some embodiments, step S3 includes: Generate corresponding pseudo-supervised sample sets for the high-confidence anomaly region and the high-confidence normal region; Perform a visual tree search, where each tree node of the visual tree search corresponds to a classifier, and each path corresponds to an anomaly boundary scheme. For each tree expansion: A subset of features is obtained from the high-confidence outlier region and / or the high-confidence normal region, and the pseudo-supervised sample set is updated by combining the corresponding pseudo-labels. Update the pseudo-supervised sample set, and use the updated pseudo-supervised sample set to perform online propagation updates on the classifier; The updated classifier is used to calculate the current tree node's reward value; The selected tree nodes for the next round are guided by the revenue value, and the above process is repeated within the allocated iteration budget steps to output the optimal path.

[0135] In other words, for images where the blurred area to be reviewed is not empty (i.e., samples that need to be reviewed), there is no need to retrain the backbone network. Instead, a classifier can be temporarily attached after the backbone network outputs features. This classifier can distinguish between "abnormal features" and "normal features" (i.e., which are real defects and which are normal features, not defects) in the current sample feature space.

[0136] The classifier can be a lightweight binary classifier, and can be any of the following classifiers: 1. Single-layer linear classification head; 2. Two-layer perceptron; 3. Depth-separable convolutional head; 4. Prototype similarity classifier; 5. Lightweight masking header.

[0137] By temporarily building and optimizing a lightweight classifier only downstream of the backbone network, the number of parameters is much smaller than that of the backbone network, resulting in lower computational overhead and adaptability to the real-time deployment requirements of edge computing devices.

[0138] Preferably, generating corresponding pseudo-supervised sample sets for the high-confidence outlier region and the high-confidence normal region includes: Based on the anomaly score heatmap, obtain the anomaly score and uncertainty value corresponding to the spatial location of the image; If the anomaly score is greater than or equal to the anomaly determination threshold, and the uncertainty value is less than or equal to the uncertainty filtering threshold, the feature corresponding to the spatial location is marked as a pseudo-anomaly sample and added to the pseudo-supervised sample set. If the abnormal score is less than or equal to the threshold under normal judgment, and the uncertainty value is less than or equal to the uncertainty filtering threshold, the feature corresponding to the spatial location is marked as a pseudo-normal sample and added to the pseudo-supervised sample set; Wherein, the upper threshold for abnormal judgment is greater than the lower threshold for normal judgment.

[0139] Specifically, in order to provide the classifier with a self-supervised learning signal, a pseudo-supervised sample set is constructed using the heatmap of the abnormal scores of the current sample itself.

[0140] If the abnormal score And uncertainty value If so, the feature at that location is marked as a pseudo-anomaly sample; If the abnormal score And uncertainty value If so, the feature at that location is marked as a pseudo-normal sample; The remaining regions (i.e., regions where abnormal scores fall within the middle range) may not directly participate in supervised learning, or may participate in consistency learning as soft-labeled regions.

[0141] To provide a high-purity self-supervised learning signal for the lightweight binary classifier that is dynamically optimized during testing, a dual-index collaborative filtering is performed using the continuous anomaly score heatmap S(p)∈[0,1] of the pre-output and the uncertainty U(p)∈[0,1]. The threshold... ,τ n ,τ u The specific value range, typical values, and setting basis are as follows: The upper threshold τ for anomaly detection a The value range can be [0.70, 0.90], for example, a value of 0.80. Basis for setting this threshold: This threshold is used to filter high-confidence defects as positive samples. In industrial visual inspection, because the "zero missed detection" red line must be adhered to, τ a It should not be set too low (e.g., below 0.6), otherwise background noise or normal tolerances (e.g., water stains, slight reflections) will be incorrectly fed to the classifier as defect samples, causing the classifier's decision boundary to tilt towards false alarms.

[0142] Normal threshold τ n The value range can be [0.10, 0.30], for example, a value of 0.15. Basis for setting this threshold: This threshold is used to filter absolutely pure background / normal regions as negative samples. Lowering it to around 0.15 ensures that the negative samples participating in the TTT simulation are free from any minor defects that could cross the boundary, thus guaranteeing the stability of the classification head baseline.

[0143] Uncertainty filtering threshold τ u The value range can be [0.15, 0.40], for example, it can be 0.25. Rationale: This is the core control line to prevent "gradient collapse" or "label noise contamination" during self-supervised training. Even if the outlier score S(p) of a pixel is high (e.g., 0.85), if the uncertainty U(p) calculated from the model's predicted distribution entropy is greater than τ... u (For example, 0.35) indicates that the model's judgment on this region is wavering (e.g., due to blurred edges caused by lighting). In this case, this location will be rejected as a pseudo-label output. Only low-entropy regions that satisfy U(p) ≤ 0.25 are accepted as conclusive evidence samples.

[0144] During actual production line initialization, the system employs an adaptive quantile strategy to dynamically lock these three thresholds: 100 standard normal workpieces are collected, and the cumulative probability distribution of their overall uncertainty is statistically analyzed; the 90th quantile is then taken as τ. u The initial baseline ensures that 90% of the normal areas can smoothly provide negative monitoring signals; when the production line switches product batches or the surface material reflectivity fluctuates globally, the system uses a lightweight gateway to determine the anomaly threshold τ. a Compared with the threshold τ under normal judgment n The numerical interval shift is performed, and the shift magnitude is positively correlated with the overall macroscopic uncertainty statistic of the graph. That is, when the global uncertainty increases, the overall shift is τ towards the direction of lower confidence. a With τ n The numerical boundaries are determined to adapt to the global statistical distribution drift of the current batch, thereby ensuring the robustness of the self-supervised signal in dynamic environments.

[0145] To further enhance the local separability of the current sample, a visual tree search mechanism is introduced into the latent space. Specifically, the root node is the feature representation of the current sample, and each tree node represents a set of feature reweighting strategies, candidate region selection strategies, or local boundary hypotheses. During the tree expansion, each path corresponds to a potential abnormal boundary evolution scheme.

[0146] For each tree expansion, perform the following operations: 1. Select a set of candidate regions or feature perturbation actions based on the current node status; 2. Update the pseudo-supervised sample set using features from high-scoring and low-scoring regions; 3. Perform one or more forward and backward updates on the lightweight classifier; 4. Calculate the current node's reward based on the updated classifier output; 5. Decide whether to continue expanding the path based on the benefits.

[0147] Let the feature tensor output after the input image is forward computed by the backbone network be... Where H and W are the height and width of the feature map, respectively, and C is the number of feature channels; the feature tensor F is input into the lightweight binary classifier, which maps the feature tensor to the current optimization parameter θ and outputs the corresponding prediction result. The mapping relationship is expressed as follows: ,in, Let θ represent the propagation function of the lightweight binary classifier, and let θ be the set of learnable parameters that the classifier dynamically iteratively optimizes during testing. The parameters θ have a preset initial value at the initial moment and are updated based on the pseudo-label supervision signal during the training process in subsequent tests.

[0148] In some embodiments, the revenue value is calculated according to the following formula: , Where Q represents the node's revenue. is the weighting coefficient, Sep represents the improvement value of the separability between abnormal and normal features, Cons represents the local consistency value of the fuzzy region to be reviewed, Ent represents the remaining uncertainty, and Cost represents the additional computing power overhead brought by the current tree node.

[0149] Specifically, the formula for calculating the separability enhancement value (Sep) between abnormal and normal features is: Sep = ||m ano -m norm ||2, where m ano and m norm These are the mean feature vectors of the pseudo-outlier and pseudo-normal regions, respectively, output by the classifier at the current node. The data comes from the feature tensor after forward propagation at the current node. The corresponding weight coefficient μ1 can take values ​​in the range [0.3, 0.6], for example, 0.4. This setting is based on ensuring that the optimization proceeds towards the core objective of "maximizing inter-class distance".

[0150] The local prediction consistency value Cons is calculated using the formula: Cons = 1 - Var(P) local ), where Var(P local The denoted represents the spatial variance of the predicted probability within the neighborhood of the fuzzy region to be reviewed. The data originates from the predicted probability map of the ROI region for the current node. The corresponding weight coefficient μ2: its value range can be [0.1, 0.3], for example, it can be 0.2. The setting is based on constraining the smoothness of the local decision surface to prevent noise from causing local prediction fragmentation.

[0151] The residual uncertainty value Ent is calculated using the following formula: , where r p This represents the predicted probability of the pixel in the blurred region to be reviewed at the current node. The corresponding weight coefficient μ3 can range from [0.2, 0.4], for example, it can be 0.3. The basis for this setting is to force the visual tree to reduce decision ambiguity by penalizing high-entropy nodes.

[0152] Additional computing power overhead (Cost): The calculation formula is: Cost = t node / T limit , where t node This represents the computation time consumed for the current path. The data comes from the system's high-precision timer during workpiece inference. The corresponding weight coefficient μ4 can range from [0.1, 0.25], for example, it can be 0.1. This value is set as a soft constraint damping to prevent production line blockage caused by infinite depth search.

[0153] Optionally, if the mode determined in step S2 is the extended TTT mode, the computing power cost penalty weight μ4 can be reduced (for example, it can be set to 0.05), with boundary segmentation accuracy as the first priority; if the determined mode is the basic TTT mode, the computing power cost penalty weight μ4 can be increased (for example, it can be set to 0.60), with latency control as the first priority.

[0154] Preferably, the tree includes a Monte Carlo tree, and selecting the next tree node to obtain the optimal path includes: Calculate the boundary values ​​of at least two tree nodes to be selected, and select the tree node with the largest boundary value as the next round tree node.

[0155] The formula for selecting the tree node with the largest boundary value as the next round tree node is as follows: ; in, The selected tree node is represented by s, which represents the root node currently being searched in the visual tree. Q(s, a) represents the average reward of the tree node to be selected, c represents a constant, N(s) is the total number of times the root node has been explored, and N(s, a) represents the number of times it has been explored.

[0156] In other words, the tree strategy can employ Monte Carlo Tree Search (MCTS), and its selection phase can utilize the upper confidence bound strategy: The goal is to find a balance between "utilizing high-win-rate nodes" and "exploring low-access-count nodes" to efficiently explore and decide on the optimal feature processing strategy within a limited computational budget, thereby guiding a lightweight classifier to find the clearest anomaly boundaries.

[0157] Specifically, let the feature tensor output after the input image is forward computed by the backbone network be... Where H and W are the height and width of the feature map, respectively, and C is the number of feature channels; the uncertainty map is... During the visual tree search process, the k-th tree node S k The state is uniquely represented by a triple: S k =(w k M k B k ),in, w k ∈R C , is the feature reweighting vector, representing the attention weight of the current node to each feature channel, and satisfies w k ∈[0,1] C ; , which is the Candidate Region Mask, representing the spatial sampling mask of the high-uncertainty focus verification region locked by the current node; B k =(θ k , τ k ) represents the local boundary hypothesis parameters, where θ k τ represents the learnable weight parameters of the lightweight classifier. k ∈[0,1] represents the confidence threshold for anomaly detection and uncertainty trimming.

[0158] The Feature Reweighting Strategy is as follows: Action a feat ∈A feat Defined as a continuous incremental adjustment or discrete mask for the channel weight vector w.

[0159] The continuous adjustment form is as follows: in, The weight increment vector can be sampled from a Gaussian distribution. Or it may originate from the gradient direction. .

[0160] After applying this action, the weighted feature tensor is expressed as: Where F(i,j,c) represents the specific value of the feature tensor output by the backbone network at spatial position (i,j) and the c-th channel.

[0161] The candidate region selection strategy is as follows: action Defined as a spatial mask generation operator based on the uncertainty map U. Candidate region mask M. k (i,j) is truncated using a quantile threshold combined with a morphological expansion operator: in τ is an indicator function. quantile (k) represents the threshold value of the top k% high uncertainty quantiles dynamically selected in the k-th step, K r Let r be the structuring element kernel with radius r, and ⊕ denotes the dilation operation (used to absorb edge blurring bands). The Local Boundary Hypothesis Strategy is specifically as follows: action This indicates the classification threshold τ. k Fine-tuning, or updating the training gradients when performing a single-step test on the lightweight classifier: Where η is the learning rate; These are the currently learnable parameters of the lightweight classifier at the k-th iteration. The current learnable parameters of the lightweight classifier at the (k+1)th iteration; For gradient operators; Train the loss function for testing; This indicates element-wise multiplication; This is the confidence threshold for anomaly detection at the k-th iteration. This is the confidence threshold for anomaly detection at the (k+1)th iteration. This is the threshold adjustment amount.

[0162] In tree search scenarios (such as Monte Carlo tree search), when at parent node S k =(w k M k B k Perform compound actions at ) At that time, child node S k+1 The state transition function can be: in, Update the step size coefficient for the weights; Here, `Normalize()` is the state transition function; `Normalize()` is the normalization function. For indicator functions; For morphological dilation operations; The core is a structuring element with radius r; θ k+1 For the updated lightweight classifier parameters; θ k These are the classifier parameters for the current node; For unsupervised / self-supervised loss functions; a bound The adjustment amount for the boundary assumption action.

[0163] Therefore, the parent node inputs actions. Then, the updated weights will be... The feature tensor is acted upon to update the weighted features, recalculating the local classification probability of the region. With the updated uncertainty plot Then, new candidate masks are generated based on the new uncertainty map. This allows for the complete generation of child nodes. The state.

[0164] To ensure the complete operation of the four phases of MCTS—Selection, Expansion, Simulation / Rollout, and Backpropagation—an MCTS reward / valuation function can be defined. Specifically, the node's value evaluation function R(S) can be used. k The reward is defined as a combined expression of uncertainty decay and decision payoff. in, This represents the average uncertainty within the candidate region; The average uncertainty of the initial candidate region; The area of ​​the candidate region is used to penalize computational overhead; Margin(p k ) represents the classification confidence margin of the lightweight classifier on the candidate region; λ and β are preset balance weight coefficients.

[0165] The objective of the visual tree search is to find a set of strategy combinations (a1, a2, ..., a...). k ), such that within the smallest possible computational region M k Within this area, the average uncertainty is minimized while classification confidence is improved.

[0166] Combining the aforementioned upper confidence bound (UCB) selection formula: Based on the above state definition, action space, state transition function, and reward evaluation function, the visual tree search algorithm can be implemented using a deep learning framework.

[0167] In one alternative embodiment, a specific example of Monte Carlo tree search is as follows: The selection phase of the Monte Carlo tree search is performed as follows: Suppose the current visual tree search is located at the starting root node s, and the cumulative number of visits to this root node N(s) has been recorded as 10. There are currently two candidate boundary evolution actions (i.e., two child nodes) to be evaluated: The first action a1 corresponds to applying a slight feature smoothing operation to the edge region of the water stain. This action has been explored N(s, a1) = 9 times, and its historical average return is Q(s, a1) = 0.85. The second action a2 corresponds to performing a masking removal operation on the high-frequency noise region. This action has been explored N(s, a2) = 1 times, and its historical average return is Q(s, a2) = 0.60.

[0168] The exploration constant c is set to 0.5 (the value of this constant can be in the range of [0.2, 0.8], and the specific value is adaptively adjusted according to the aggressiveness of the unexplored boundary schemes on the production line). The system calculates the UCB value of each candidate action according to the upper confidence boundary strategy: , , Comparing the above calculation results, we can see that Therefore, the system selects action a2 as the next round of expansion path at the current node.

[0169] Although the historical average reward of the first action a1 (0.85) is higher than that of the second action a2 (0.60), the exploration reward of action a2 (1.07) is significantly lower than that of action a1 because action a2 has been explored far fewer times. This gives action a higher potential discovery value. Through this mechanism, the system can achieve an adaptive balance between "utilizing existing high-yield paths" and "exploring insufficiently tried paths," effectively avoiding the pseudo-defect handling strategy that prematurely converges to a local optimum. This allows the system to discover true, subtle defects masked by noise with the highest probability within a limited iteration budget.

[0170] In other words, the output of the backbone network synchronously outputs anomaly score heatmap and uncertainty map, and performs region division and computing power allocation based on the two in synergy.

[0171] For low-entropy regions in the uncertainty map whose values ​​are lower than or equal to the preset uncertainty threshold, they are determined to be high-confidence regions. In these regions, the original prediction results of the backbone network have high reliability. No additional computing power is required, and the abnormal score heatmap can be directly binarized and thresholded to output the judgment result.

[0172] For high-entropy regions in the uncertainty map whose values ​​are higher than the preset uncertainty threshold, they are identified as fuzzy regions to be verified. The original prediction of the backbone network is near the decision boundary and its reliability is insufficient. For this region, a lightweight binary classifier is temporarily attached downstream of the backbone network, and a visual tree search mechanism (MCTS) based on Monte Carlo tree search and a test-time training strategy (TTT) are introduced to dynamically optimize the parameters of the lightweight classifier within a preset limited iteration budget, thereby achieving dynamic purification of the decision boundary in milliseconds.

[0173] That is, the backbone network DINOv2 provides high-quality low-level features and obtains anomaly scores and uncertainty estimates; a lightweight binary classifier is temporarily attached downstream of the backbone network, and the initial prediction of the backbone network is adaptively corrected through iterative optimization during testing; the backbone network and the lightweight binary classifier constitute a cascaded adaptive processing architecture that does not require retraining of the backbone.

[0174] In some preferred embodiments, step S4 includes: The parameters of the classifier are optimized using a loss function; the loss function is: , in, Represents the loss function. Indicates the weighting coefficient. This indicates the loss of supervision due to false labels. Indicates consistency loss. Indicates boundary smoothing loss. This is the interval loss; If the preset stopping condition is met, the optimization stops, and the updated classifier is obtained.

[0175] Specifically, the iteration budget steps B allocated by the computing power routing module max Within this process, the learnable parameters θ of the lightweight binary classifier are iteratively optimized using the test-time loss function to ensure that it fits a stable anomaly detection boundary in the current sample feature space. The test-time loss function is composed of a weighted combination of the following multiple sub-loss functions: , in, This indicates the loss of supervision due to false labels. Indicates consistency loss. Indicates boundary smoothing loss. This is the interval loss; These are the weighting coefficients corresponding to each sub-loss.

[0176] To guide the lightweight binary classifier in forming a robust decision boundary during rapid iteration with single samples, the value ranges and setting criteria for each balancing weight coefficient are as follows: Pseudo-label loss weights The value range can be [0.4, 0.7], for example, it can be 0.5. The cross-entropy loss is based on high-confidence outlier and high-confidence normal regions. As the basic framework of self-supervised learning, its weights dominate the total loss to ensure that the classifier prioritizes anchoring the most basic normal and outlier baseline features.

[0177] Consistency constraint weight The value range can be [0.1, 0.3], for example, it can be 0.2. It is used to constrain the prediction consistency of ambiguous regions under different feature perturbations or different tree branches, so as to smooth the decision manifold boundary and prevent the classifier from overfitting to noise under a single path.

[0178] Boundary smoothing term weights The value range can be [0.05, 0.2], for example, it can be 0.1. Total Variation loss can be used to penalize drastic spatial jumps in the segmentation mask, reduce mask fragmentation, and utilize the physical connectivity of real defects to effectively filter out false alarms of isolated pixels caused by camera shot noise.

[0179] Interval loss weight The value range can be [0.1, 0.3], for example, it can be 0.2. A contrast loss with marginal distance is used to forcibly widen the decision boundary between the normal tolerance area and the real defect area in the feature space (i.e., increase the decision boundary between abnormal features and normal features). The marginal distance can be set to no less than 0.3 to suppress edge false alarms caused by fuzzy decision-making.

[0180] Preferably, the pseudo-label supervision loss can be calculated using the following formula: The consistency loss can be calculated using the following formula: in, , These represent the outputs of the classifier under different feature perturbation conditions or different tree search branches.

[0181] During the iterative optimization process, the system monitors the following stopping conditions in real time. Training is terminated when any one of these conditions is met: 1. Loss decreases below a threshold: When the difference in total loss between two adjacent iterations is less than a threshold, i.e. The optimization has been determined to have entered a flat region, and further iterations offer very little marginal benefit for boundary refinement; therefore, the process can be terminated to conserve computing power. The range of values ​​can be For example, it can take the value of .

[0182] 2. Continuous multi-step prediction results change below a threshold: When the mean square error of the prediction probability of pixels in the blurred area to be verified is below a threshold for K consecutive steps (K can be 3-5), the change is below a certain threshold. At that point, the decision-making boundaries are considered fixed, and early exit is possible. Among these, The range of values ​​can be .

[0183] 3. Reaching the budget step limit: When the cumulative number of iterations reaches the B limit issued by the computing power routing module. max At this point, the iteration is forcibly terminated. B max The value range of can be [50, 100] steps, which serves as a hard upper limit truncation for algorithm iteration, thereby ensuring that even when encountering extremely complex extreme samples, the calculation will never fall into an infinite loop.

[0184] 4. Reaching the budgeted time limit: When the cumulative optimization time reaches T... budget When T is reached, the iteration is forcibly terminated. budget The value range can be [10ms, 50ms], and it satisfies T budget ≤T limit T backbone T limit Set a single-piece delay limit for the production line, T backbone This refers to the time taken for a single forward inference pass of the backbone network. Once the system's internal timer detects that the cumulative time taken for the current sample has triggered this threshold, the optimizer must be forcibly interrupted regardless of whether the current loss has converged, and the result must be directly output with the temporary parameters of the current step. This condition serves as the ultimate guarantee for the hard real-time requirements of the production line, ensuring that physical blockage does not occur under any circumstances.

[0185] When any of the above stopping conditions are met, the training during testing ends. Inference is then performed on the feature tensor output by the backbone network using the currently updated classifier, and a binary anomaly segmentation mask M corresponding to the input image is output. bin .

[0186] Optionally, in outputting the binary anomaly segmentation mask M binAfterwards, morphological constraints, boundary corrections, and / or small region filtering can be performed to post-process the results.

[0187] In one optional example, a test piece (a circuit board with reflective ink stains on its surface) is determined to trigger the extended TTT mode in step S2, and the maximum budget steps B are allocated. max =60 steps, maximum time T budget =30ms, set the convergence threshold .

[0188] Step 1 Iteration: The lightweight binary classifier performs forward computation based on the high-confidence pseudo-label map generated in step S3, with an initial total loss. The gradient is backpropagated and then used to update the classifier parameters θ.

[0189] Iterations from step 2 to step 25: Driven by the self-supervised signal, the classifier gradually adapts to the contrast difference between the ink area and the background area of ​​the current board, and the pseudo-label supervised loss... Rapid decline; simultaneously, during interval loss Under the strong stretching, the prediction probabilities of pixels originally in the fuzzy region of the decision boundary rapidly polarize. By the 25th iteration, the total loss has been reduced to The total time taken was approximately 12ms.

[0190] Iteration step 26: Forward calculation to obtain the total loss .

[0191] Convergence determination and early exit: The system calculates the change in loss between adjacent steps in real time. because If stopping condition 1 is met, the system immediately terminates the iteration. At this point, the actual number of iterations N=26, which is far from the budget limit of 60 steps, and the actual time taken is about 12.5ms, which meets the time delay constraint.

[0192] The system uses the currently optimized parameters Perform final forward inference on the feature tensor F and output a binary anomaly segmentation mask M. bin Subsequently, the system performs a morphological opening operation with a kernel size of 3×3 on the mask to filter out isolated noise areas smaller than 5 pixels (such as false alarms caused by tiny dust particles), and finally outputs a post-processed defect location mask. After the judgment signal is output, the system immediately releases the temporary video memory resources occupied by the current sample and restores the initial standby state.

[0193] For example, targeting Figure 3 The image of the workpiece to be inspected is shown, and the output inspection results are as shown in Figure 21-. Figure 22 As shown, Figure 21 This is a schematic diagram illustrating region division and defect location in an exemplary embodiment. Figure 22 This is a schematic diagram illustrating the detection results of an exemplary embodiment. Figure 21 The location and type of the defect are output in the middle. Figure 22 The system outputs the test results for "defective products".

[0194] In another example, targeting Figure 10 The image of the workpiece to be inspected is shown, and the output inspection results are as shown in Figure 23-. Figure 24 As shown, Figure 23 This is a schematic diagram illustrating region division and defect location in an exemplary embodiment. Figure 24 This is a schematic diagram illustrating the detection results of an exemplary embodiment. Figure 23 The location and type of the defect are output in the middle. Figure 24 The system outputs the test results for "defective products".

[0195] In some embodiments, the method further includes: Step S5: Record the dynamic process information of steps S1 to S4; generate a risk index corresponding to the image based on the dynamic process information; if the risk index is higher than a preset risk threshold and the detection result of the workpiece is good, the output detection result includes a high-risk mark corresponding to the good product; trigger subsequent quality processing operations based on the high-risk mark.

[0196] In one example, for Figure 17 The image of the workpiece to be inspected is shown, and the output inspection results are as shown in Figure 25-. Figure 26 As shown, Figure 25 This is a schematic diagram illustrating region division and defect location in an exemplary embodiment. Figure 26 This is a schematic diagram illustrating the detection results of an exemplary embodiment. Figure 26 The test results show that the product is "good". Figure 25 The location of the high-risk marker (i.e., the defect in the output of the good product image) in the output.

[0197] Specifically, this application not only outputs the final binary anomaly segmentation mask, but also records dynamic process information generated during training and testing. This dynamic process information may include dynamic computing power trajectory information. The dynamic computing power trajectory information includes at least one of the following: The budget steps B allocated by the computing power routing module max ; The actual number of iterations N performed during training during testing; Average time per single iteration; The rate of decrease of the loss function, ΔL; The total number of nodes expanded during the visual tree search process; The depth of the optimal path during the search process; Uncertainty residuals after optimization termination.

[0198] Based on the dynamic computing power trajectory information mentioned above, the system generates a risk index R for the current sample. The formula for calculating the risk index is as follows: Where α and β are preset adjustable weighting coefficients. ΔL represents the intensity of the current sample's budget consumption, and ΔL represents the model's convergence rate during finite training.

[0199] Specifically, the budget consumption intensity weight α can take values ​​in the range of [0.5, 1.5], for example, it can take a value of 1.0.

[0200] This is used to quantify the decision difficulty or "indecisiveness" of the model when processing this sample. When the model has exhausted all budgeted steps (i.e., N=B)... max At this time This indicates that the sample features have strong ambiguity or boundary complexity, and have a high risk of false alarms. Therefore, α is used as the basic amplification factor.

[0201] The convergence rate penalty weight β can take values ​​in the range [0.1, 0.4], for example, 0.2. When the loss function decreases rapidly, it indicates that the classifier converges easily on the current samples, and the decision boundary is clear and stable. It can be used as a positive deduction item, effectively reducing the final risk index.

[0202] High-risk good product trigger threshold τ R (i.e., the preset risk threshold): The value range can be [0.60, 0.85], for example, it can be 0.75. This threshold is determined by inversely deducing the balance point between the historical over-detection rate (FDR) and under-detection rate (FNR) of the production line. If the risk index R>0.75, even if the static judgment result given by the classifier is "Good (Pass)," its reasoning process is extremely difficult, belonging to a typical "borderline Good product." Judging it as a high-risk Good product can effectively intercept those fatal hidden dangers on the verge of being under-detected.

[0203] Wherein, ΔL (i.e., the rate of loss decrease) can be calculated using the following formula: Where L0 is the initial loss value at the start of training (step 0), L N The loss value after N iterations. This is a preset constant.

[0204] The risk index R is used to characterize the degree to which the current sample is judged as normal but the model processing cost is significantly high. If the final detection result of the current sample is good (i.e., no defects detected), and the risk index satisfies: R > τ R If the system determines the sample to be a high-risk good product, it will send a high-risk good product marker signal to the production line quality management system and / or manufacturing execution system. The high-risk good product marker triggers at least one of the following subsequent actions: Increase manual re-inspection; Automatically transfers to the repeat imaging station for secondary imaging detection; Recorded as batch risk samples and included in batch quality statistics; Trigger a device parameter check command; Update the status information on the workstation alarm panel.

[0205] Therefore, it can not only output static results of "defect / normal", but also further transform the convergence difficulty of the model in inference into quality risk indicators that the production system can understand.

[0206] Through the above mechanism, this invention quantifies the convergence difficulty and computing power consumption trajectory in the model inference process into a quality risk indicator that is understandable and executable in the production system, thereby expanding the algorithm output from static judgment results to dynamic process risks.

[0207] In an optional example, suppose that on a precision integrated circuit substrate production line, step S2 is the iteration budget step B allocated to the current sample. max =80 steps, set weighting coefficients α=1.0, β=0.2, and the threshold τ for system linkage control. R =0.75.

[0208] Trajectory data acquisition: When this sample entered the test phase, after training, the presence of minor ink stains on its surface caused by manual operation led to significant parameter fluctuations in the lightweight classifier during iterative optimization. Ultimately, the model terminated after N=76 iterations, triggering the stopping condition. The initial loss L0=0.90, and the total loss at termination LN=0.14.

[0209] Dynamic calculation of risk index: First, calculate the rate of loss decline: The trajectory parameters are then substituted into the risk index calculation formula: Decision-making and execution logic: After final reasoning in step S4, the features within the fuzzy area to be reviewed are classified as normal background patterns by the classifier, and the static judgment result output by the algorithm is "good". However, after comparing the risk index, the system found that: R=0.948>τ R(0.75), based on this, the system determines that although the sample passes the static judgment level, its inference convergence process is extremely difficult, classifying it as a high-risk borderline good product. The detection host then skips the regular release channel and sends a high-risk marking command to the production line quality management system and manufacturing execution system via industrial Ethernet (MQTT or TCP protocol), automatically triggering the following linked closed-loop actions: Workstation diversion: After receiving the signal from the quality management system, the production line programmable logic controller controls the downstream pneumatic valve to automatically import the current carrier board into the physical re-inspection station, where it is manually checked by a high-powered microscope to eliminate the risk of minor peeling defects being misjudged as water stains and dirt, resulting in missed release.

[0210] Equipment Early Warning: When the manufacturing execution system detects that the risk index R of 5 consecutive boards is greater than 0.80, it automatically triggers an alarm for abnormal parameter checks of the upstream cleaning equipment, prompting process engineers to check whether there is partial blockage in the nozzles of the upstream cleaning machine or whether the power consumption of the drying fan is abnormal. This provides early warning of upstream process deterioration trends before static missed detections occur, thus achieving closed-loop quality management.

[0211] By quantifying trajectory information such as budget consumption intensity and loss convergence speed during training and testing into a risk index, the "decision difficulty" of model inference is transformed into a quality risk signal that the production system can understand. The risk index is then integrated with the quality management system and manufacturing execution system. When a product is statically judged as good but the risk index exceeds a threshold, physical closed-loop actions such as manual re-inspection, equipment parameter checking, and batch quality tracking are automatically triggered, achieving production line-level quality closed-loop management from algorithmic perception to physical execution.

[0212] An anomaly identification method according to an embodiment of this application has the following complete execution steps: Figure 27 As shown, it will not be elaborated upon here.

[0213] The anomaly recognition method of this application embodiment acquires an image of the workpiece to be detected, inputs the image into a pre-trained backbone network, and obtains high-confidence anomaly regions, high-confidence normal regions, and ambiguous regions to be verified in the image; it acquires the uncertainty and structural complexity of the image, as well as the remaining available time for anomaly recognition, to determine the recognition mode to be entered and allocates the iteration budget steps for the corresponding mode; if the ambiguous region to be verified is not empty, a lightweight classifier is temporarily attached to the backbone network, and within the iteration budget steps, a tree-based search is performed to update the classification. The update includes: updating the pseudo-supervised sample set corresponding to the high-confidence anomaly region and the high-confidence normal region; using the updated pseudo-supervised sample set to perform online propagation update of the classifier; using the updated classifier to infer the fuzzy region to be verified, and outputting the detection result of the workpiece. The detection result includes good or defective products. If the detection result is defective, the detection result also includes the location and type of defects in the workpiece. This not only significantly improves the accuracy of anomaly detection and further enhances the precision of production line quality control, but also reduces computational overhead.

[0214] See Figure 28 , Figure 28 This is a block diagram illustrating an electronic device 400 according to an exemplary embodiment, the electronic device 400 comprising: The acquisition module 401 is used to acquire images of the workpiece to be inspected, input the images into a pre-trained backbone network, and obtain high-confidence abnormal regions, high-confidence normal regions, and blurred regions to be verified in the images. The acquisition module 402 is used to acquire the uncertainty and structural complexity of the image, as well as the remaining available time for anomaly recognition, in order to determine the entry recognition mode and allocate the iteration budget steps for the corresponding mode. The update module 403 is used to temporarily attach a lightweight classifier to the backbone network if the ambiguous region to be verified is not empty, and to perform a tree-based search to update the classifier within the iteration budget steps; wherein, the update includes: updating the pseudo-supervised sample set corresponding to the high-confidence outlier region and the high-confidence normal region, and using the updated pseudo-supervised sample set to perform online propagation update of the classifier; The detection module 404 is used to perform reasoning on the fuzzy region to be verified using the updated classifier and output the detection result of the workpiece. The detection result includes good product or defective product. If the detection result is defective product, the detection result also includes the location and type of defects in the workpiece.

[0215] The electronic device of this application acquires an image of a workpiece to be inspected, inputs the image into a pre-trained backbone network, and obtains high-confidence anomaly regions, high-confidence normal regions, and fuzzy regions to be verified in the image. It acquires the uncertainty and structural complexity of the image, as well as the remaining available time for anomaly identification, to determine the entry identification mode and allocate an iteration budget step for the corresponding mode. If the fuzzy region to be verified is not empty, a lightweight classifier is temporarily mounted in the backbone network, and within the iteration budget step, a tree-based search is performed to update the classifier. The update includes: updating the pseudo-supervised sample set corresponding to the high-confidence anomaly region and the high-confidence normal region; using the updated pseudo-supervised sample set to perform online propagation updates on the classifier; using the updated classifier to infer the fuzzy region to be verified, and outputting the detection result of the workpiece. The detection result includes good or defective products. If the detection result is defective, the detection result also includes the location and type of defects in the workpiece. This not only significantly improves the accuracy of anomaly detection and further enhances the precision of production line quality control, but also reduces computational overhead.

[0216] Preferably, the acquisition module 401 is used to input the image into the backbone network and obtain an anomaly score heatmap and uncertainty map corresponding to the image; wherein, the anomaly score heatmap is used to characterize the continuous confidence that each spatial location in the image belongs to an anomaly, and the uncertainty map is used to characterize the stability of the judgment result; Based on the anomaly score heatmap and the uncertainty map, the high-confidence anomaly region, the high-confidence normal region, and the blurred region to be verified in the image are determined.

[0217] Preferably, the acquisition module 401 is used to classify the spatial location as the high-confidence anomaly region if the anomaly score of the spatial location is greater than a first score threshold and the uncertainty is less than or equal to a preset uncertainty classification threshold; and to classify the spatial location as the high-confidence anomaly region if the anomaly score of the spatial location is less than a second score threshold and the uncertainty is less than or equal to the preset uncertainty classification threshold; the remaining spatial locations are classified as the fuzzy region to be reviewed; wherein the first score threshold is greater than the second score threshold.

[0218] Preferably, the identification mode includes: a regular mode, an extended TTT mode, and a basic TTT mode, wherein the iteration budget steps of the extended TTT mode are greater than the iteration budget steps of the basic TTT mode.

[0219] The acquisition module 402 is configured to determine the recognition mode as the conventional mode if the overall uncertainty of the image is less than a first uncertainty threshold and the structural complexity is less than a first complexity threshold; if the overall uncertainty of the image is greater than or equal to a second uncertainty threshold, or the structural complexity is greater than or equal to a second complexity threshold and the remaining available time is greater than or equal to a preset delay upper limit, determine the recognition mode as the extended TTT mode; otherwise, determine the recognition mode corresponding to the image as the basic TTT mode. Wherein, the first uncertainty threshold is less than the second uncertainty threshold; the first complexity threshold is less than the second complexity threshold.

[0220] Preferably, the formula for calculating the overall uncertainty is as follows: ; in, The image represents the overall uncertainty, H represents the height of the image, W represents the width of the image, p represents the index of the spatial position in the image, and U(p) represents the uncertainty value at spatial position p. The formula for calculating the complexity is as follows: ; in, This indicates the structural complexity of the image. This represents the first weighting coefficient. Indicates the number of abnormal connected regions. This represents the second weighting coefficient. Indicates the candidate boundary length. This represents the third weighting coefficient. This indicates the degree of local fluctuation in the abnormal heatmap.

[0221] Preferably, the acquisition module 402 is further configured to acquire the video memory occupancy rate of the electronic device, the number of tasks queued in the current queue, and the preset delay threshold of the production line corresponding to the workpiece; and calculate the number of iterative budget steps according to the budget function, wherein the budget function is: ; in, This indicates the current video memory usage rate of the electronic device. This indicates the number of tasks currently queued. This indicates the preset time delay threshold of the production line corresponding to the workpiece.

[0222] Preferably, the budget function is: ; in, This indicates the maximum number of steps to the preset budget. These are the weighting coefficients. This indicates the idle time of the production line corresponding to the workpiece.

[0223] Preferably, the update module 403 is used to generate corresponding pseudo-supervised sample sets for the high-confidence anomaly region and the high-confidence normal region; perform visual tree search, where each tree node of the visual tree search corresponds to a classifier, and each path corresponds to an anomaly boundary scheme; for each tree expansion: obtain a feature subset from the high-confidence anomaly region and / or the high-confidence normal region, and update the pseudo-supervised sample set by combining it with its corresponding pseudo-label; update the pseudo-supervised sample set, and use the updated pseudo-supervised sample set to perform online propagation updates on the classifier; calculate the reward value of the current tree node using the updated classifier; guide the selection of the next round of tree nodes based on the reward value, and repeat the above process within the allocated iteration budget steps to output the optimal path.

[0224] Preferably, the update module 403 is used to obtain the anomaly score and uncertainty value corresponding to the spatial location of the image based on the anomaly score heatmap; if the anomaly score is greater than or equal to the upper threshold for anomaly determination, and the uncertainty value is less than or equal to the uncertainty filtering threshold, the feature corresponding to the spatial location is marked as a pseudo-anomaly sample and added to the pseudo-supervised sample set; if the anomaly score is less than or equal to the lower threshold for normal determination, and the uncertainty value is less than or equal to the uncertainty filtering threshold, the feature corresponding to the spatial location is marked as a pseudo-normal sample and added to the pseudo-supervised sample set. Wherein, the upper threshold for abnormal judgment is greater than the lower threshold for normal judgment.

[0225] Preferably, the revenue value is calculated according to the following formula: , Where Q represents the node's revenue. is the weighting coefficient, Sep represents the improvement value of the separability between abnormal and normal features, Cons represents the local consistency value of the fuzzy region to be reviewed, Ent represents the remaining uncertainty, and Cost represents the additional computing power overhead brought by the current tree node.

[0226] Preferably, the tree includes a Monte Carlo tree, and selecting the next tree node to obtain the optimal path includes: Calculate the boundary values ​​of at least two tree nodes to be selected, and select the tree node with the largest boundary value as the next round tree node.

[0227] Preferably, the formula for selecting the tree node with the largest boundary value as the next round tree node is: ; in, The selected tree node is represented by s, which represents the root node currently being searched in the visual tree. Q(s, a) represents the average reward of the tree node to be selected, c represents a constant, N(s) is the total number of times the root node has been explored, and N(s, a) represents the number of times it has been explored.

[0228] Preferably, the detection module 404 is used to optimize the parameters of the classifier using a loss function; the loss function is: , in, Represents the loss function. Indicates the weighting coefficient. This indicates the loss of supervision due to false labels. Indicates consistency loss. Indicates boundary smoothing loss. This is the interval loss; If the preset stopping condition is met, the optimization stops, and the updated classifier is obtained.

[0229] Preferably, the electronic device 400 further includes: A marking module is used to record dynamic process information; generate a risk index corresponding to the image based on the dynamic process information; if the risk index is higher than a preset risk threshold and the inspection result of the workpiece is good, the output inspection result includes a high-risk mark corresponding to the good product; and trigger subsequent quality processing operations based on the high-risk mark.

[0230] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0231] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0232] In some embodiments, the electronic device is provided as a terminal. Figure 29A schematic diagram of a terminal 1000 provided in an exemplary embodiment of this disclosure is shown. The terminal 1000 may be a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. The terminal 1000 may also be referred to as a user device, portable terminal, laptop terminal, desktop terminal, or other names.

[0233] Typically, terminal 1000 includes a processor 1001 and a memory 1002.

[0234] Processor 1001 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1001 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1001 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1001 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1001 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0235] The memory 1002 may include one or more computer-readable storage media, which may be non-transitory. The memory 1002 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1002 are used to store at least one program code, which is executed by the processor 1001 to implement the anomaly identification method provided in the method embodiments of this disclosure.

[0236] In some embodiments, the terminal 1000 may also optionally include a peripheral device interface 1003 and at least one peripheral device. The processor 1001, memory 1002, and peripheral device interface 1003 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1003 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 1004, a display screen 1005, a camera assembly 1006, an audio circuit 1007, and a power supply 1008.

[0237] Peripheral device interface 1003 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1001 and memory 1002. In some embodiments, processor 1001, memory 1002 and peripheral device interface 1003 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1001, memory 1002 and peripheral device interface 1003 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0238] The radio frequency (RF) circuit 1004 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1004 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1004 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 1004 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 1004 can communicate with other terminals via at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1004 may also include circuitry related to NFC (Near Field Communication), which is not limited in this disclosure.

[0239] Display screen 1005 is used to display a UI (user interface). The UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1005 is a touch display screen, it also has the ability to collect touch signals on or above the surface of display screen 1005. These touch signals can be input as control signals to processor 1001 for processing. In this case, display screen 1005 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 1005, which serves as the front panel of terminal 1000; in other embodiments, there may be at least two display screens, respectively disposed on different surfaces of terminal 1000 or in a folded design; in still other embodiments, display screen 1005 may be a flexible display screen, disposed on a curved surface or folded surface of terminal 1000. Furthermore, display screen 1005 may also be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. The display screen 1005 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0240] The camera assembly 1006 is used to acquire images or videos. Optionally, the camera assembly 1006 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, and VR (Virtual Reality) shooting functions or their fusion shooting functions. In some embodiments, the camera assembly 1006 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.

[0241] The audio circuit 1007 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 1001 for processing, or input to the radio frequency circuit 1004 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 1000. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 1001 or the radio frequency circuit 1004 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 1007 may also include a headphone jack.

[0242] The power supply 1008 is used to power the various components in the terminal 1000. The power supply 1008 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When the power supply 1008 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0243] Those skilled in the art will understand that Figure 29 The structure shown does not constitute a limitation on terminal 1000 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0244] In some embodiments, the electronic device is provided as a server. Figure 30 This is a schematic diagram of a server structure according to an embodiment of this application. The server 1100 can vary considerably due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1101 and one or more memories 1102. The memories 1102 are used to store executable program code, and the processors 1101 are configured to execute the executable program code to implement the anomaly identification methods provided in the above-described method embodiments. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated here.

[0245] In some embodiments, the electronic device is provided as an edge computing device, capable of performing the anomaly identification methods provided in the above-described method embodiments.

[0246] In an exemplary embodiment, a computer-readable storage medium is also provided, which, when executed by a processor of a computer device, enables the computer device to perform the aforementioned device discharge detection method. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.

[0247] In an exemplary embodiment, a computer program product is also provided, the computer program product including a computer program that, when executed by a processor, implements the above-described method for anomaly identification of the device.

[0248] In some embodiments, the computer program product involved in this disclosure may be deployed and executed on a computer device, or on multiple computer devices located in one location, or on multiple computer devices distributed in multiple locations and interconnected through a communication network. Multiple computer devices distributed in multiple locations and interconnected through a communication network may constitute a blockchain system.

[0249] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims. All the above-described optional technical solutions can be combined in any way to form optional embodiments of this application, and will not be elaborated upon here.

[0250] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. An anomaly detection method, applied to electronic devices, characterized in that, include: Step S1: Acquire an image of the workpiece to be inspected, input the image into the pre-trained backbone network, and obtain the high-confidence abnormal region, high-confidence normal region, and blurred region to be verified in the image; Step S2: Obtain the uncertainty and structural complexity of the image, as well as the remaining available time for anomaly recognition, in order to determine the entry recognition mode and allocate the iteration budget steps for the corresponding mode. Step S3: If the ambiguous region to be verified is not empty, a lightweight classifier is temporarily attached to the backbone network. Within the iteration budget steps, a tree-based search is performed to update the classifier. The update includes: updating the pseudo-supervised sample set corresponding to the high-confidence outlier region and the high-confidence normal region, and using the updated pseudo-supervised sample set to perform online propagation update of the classifier. Step S4: Use the updated classifier to reason about the fuzzy area to be verified and output the detection result of the workpiece. The detection result includes good product or defective product. If the detection result is defective product, the detection result also includes the location and type of defects in the workpiece. The identification modes include: regular mode, extended TTT mode and basic TTT mode, wherein the iteration budget steps of the extended TTT mode are greater than the iteration budget steps of the basic TTT mode. Step S2 includes: If the overall uncertainty of the image is less than a first uncertainty threshold, and the structural complexity is less than a first complexity threshold, the recognition mode is determined to be the conventional mode. If the overall uncertainty of the image is greater than or equal to the second uncertainty threshold, or if the structural complexity is greater than or equal to the second complexity threshold, and the remaining available time is greater than or equal to the preset delay limit, then the recognition mode is determined to be the extended TTT mode. Otherwise, the recognition mode corresponding to the image is determined to be the basic TTT mode; Wherein, the first uncertainty threshold is less than the second uncertainty threshold; the first complexity threshold is less than the second complexity threshold; The formula for calculating the overall uncertainty is as follows: ; in, The image represents the overall uncertainty, H represents the height of the image, W represents the width of the image, p represents the index of the spatial position in the image, and U(p) represents the uncertainty value at spatial position p. The formula for calculating the complexity is as follows: ; in, This indicates the structural complexity of the image. This represents the first weighting coefficient. Indicates the number of abnormal connected regions. This represents the second weighting coefficient. Indicates the candidate boundary length. This represents the third weighting coefficient. Indicates the degree of local fluctuation in the abnormal heatmap; Step S2 further includes: Obtain the video memory usage rate of the electronic device, the number of tasks currently queued, and the preset delay threshold of the production line corresponding to the workpiece; The iterative budget steps for the corresponding allocation pattern include: The number of iterative budget steps is calculated based on a budget function, which is: ; in, This indicates the current video memory usage rate of the electronic device. This indicates the number of tasks currently queued. This indicates the preset time delay threshold of the production line corresponding to the workpiece.

2. The method according to claim 1, characterized in that, Step S1 includes: The image is input into the backbone network to obtain an anomaly score heatmap and uncertainty map corresponding to the image; wherein, the anomaly score heatmap is used to characterize the continuous confidence that each spatial location in the image belongs to an anomaly, and the uncertainty map is used to characterize the stability of the judgment result; Based on the anomaly score heatmap and the uncertainty map, the high-confidence anomaly region, the high-confidence normal region, and the blurred region to be verified in the image are determined.

3. The method according to claim 2, characterized in that, The step of determining the high-confidence outlier region, the high-confidence normal region, and the blurred region to be reviewed in the image based on the outlier score heatmap and the uncertainty map includes: If the anomaly score of the spatial location is greater than the first score threshold and the uncertainty is less than or equal to the preset uncertainty classification threshold, the spatial location is classified as the high confidence anomaly region. If the abnormal score of the spatial location is less than the second score threshold, and the uncertainty is less than or equal to the preset uncertainty classification threshold, the spatial location is classified as the high-confidence normal region. The remaining spatial locations are designated as the fuzzy regions to be reviewed; Wherein, the first score threshold is greater than the second score threshold.

4. The method according to claim 1, characterized in that, The budget function is: ; in, This indicates the maximum number of steps to the preset budget. These are the weighting coefficients. This indicates the idle time of the production line corresponding to the workpiece.

5. The method according to claim 2, characterized in that, Step S3 includes: Generate corresponding pseudo-supervised sample sets for the high-confidence anomaly region and the high-confidence normal region; Perform a visual tree search, where each tree node of the visual tree search corresponds to a classifier, and each path corresponds to an anomaly boundary scheme. For each tree expansion: A subset of features is obtained from the high-confidence outlier region and / or the high-confidence normal region, and the pseudo-supervised sample set is updated by combining the corresponding pseudo-labels. Update the pseudo-supervised sample set, and use the updated pseudo-supervised sample set to perform online propagation updates on the classifier; The updated classifier is used to calculate the current tree node's reward value; The selected tree nodes for the next round are guided by the revenue value, and the above process is repeated within the allocated iteration budget steps to output the optimal path.

6. The method according to claim 5, characterized in that, The generation of corresponding pseudo-supervised sample sets for the high-confidence outlier region and the high-confidence normal region includes: Based on the anomaly score heatmap, obtain the anomaly score and uncertainty value corresponding to the spatial location of the image; If the anomaly score is greater than or equal to the anomaly determination threshold, and the uncertainty value is less than or equal to the uncertainty filtering threshold, the feature corresponding to the spatial location is marked as a pseudo-anomaly sample and added to the pseudo-supervised sample set. If the abnormal score is less than or equal to the threshold under normal judgment, and the uncertainty value is less than or equal to the uncertainty filtering threshold, the feature corresponding to the spatial location is marked as a pseudo-normal sample and added to the pseudo-supervised sample set; Wherein, the upper threshold for abnormal judgment is greater than the lower threshold for normal judgment.

7. The method according to claim 5, characterized in that, The revenue value is calculated according to the following formula: Where Q represents the node's revenue. is the weighting coefficient, Sep represents the improvement value of the separability between abnormal and normal features, Cons represents the local consistency value of the fuzzy region to be reviewed, Ent represents the remaining uncertainty, and Cost represents the additional computing power overhead brought by the current tree node.

8. The method according to claim 6, characterized in that, The tree includes a Monte Carlo tree. Selecting the next tree node and obtaining the optimal path includes: Calculate the boundary values ​​of at least two tree nodes to be selected, and select the tree node with the largest boundary value as the next round tree node.

9. The method according to claim 8, characterized in that, The formula for selecting the tree node with the largest boundary value as the next round tree node is as follows: ; in, The selected tree node is represented by s, which represents the root node currently being searched in the visual tree. Q(s, a) represents the average reward of the tree node to be selected, c represents a constant, N(s) is the total number of times the root node has been explored, and N(s, a) represents the number of times it has been explored.

10. The method according to claim 1, characterized in that, Step S4 includes: The parameters of the classifier are optimized using a loss function; the loss function is: , in, Represents the loss function. Indicates the weighting coefficient. This indicates the loss of supervision due to false labels. Indicates consistency loss. Indicates boundary smoothing loss. This is the interval loss; If the preset stopping condition is met, the optimization stops, and the updated classifier is obtained.

11. The method according to claim 1, characterized in that, Also includes: Step S5: Record the dynamic process information of steps S1 to S4; Based on the dynamic process information, a risk index corresponding to the image is generated; If the risk index is higher than the preset risk threshold and the inspection result of the workpiece is good, the output inspection result includes a high-risk mark corresponding to the good product; Based on the high-risk marker, subsequent quality processing operations are triggered.

12. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing at least one computer program, which is loaded and executed by the processor to implement the anomaly identification method as described in any one of claims 1 to 11.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the anomaly identification method as described in any one of claims 1 to 11.

14. A computer program product, comprising a computer program, characterized in that, The computer program is loaded and executed by a processor to implement the anomaly identification method as described in any one of claims 1 to 11.

Citation Information

Patent Citations

  • Trusted surface defect detection method and equipment based on Bayesian condition diffusion model

    CN119399210A

  • Industrial defect high-precision detection method and system based on improved YOLOv11 model

    CN122134610A