A method for selecting visual evidence based on category normalization residuals for diagnosing appearance defects in surface-mount electronic components.

By constructing a category normality center and performing residual processing, the problem of the influence of normal encapsulation appearance in AOI inspection was solved, achieving more accurate defect diagnosis and reliable semantic diagnosis results.

CN123118463APending Publication Date: 2026-11-17BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611151701.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing AOI detection methods for diagnosing appearance defects in mounted electronic components are easily dominated by common components in the normal package appearance of the same component category. This makes it difficult to reliably recall reference evidence that matches the defect type, leading to semantic diagnostic results deviating from the true defect deviation signal and increasing the risk of label misrepresentation and over-inference.

Method used

By constructing category normal centers for the same component category, residual processing is performed on the AOI images to be diagnosed and candidate cases. Reference evidence with high residual similarity is selected, and the diagnostic confidence is constrained in the semantic diagnostic model to ensure the traceability and accuracy of the reference evidence.

Benefits of technology

It improves the accuracy of defect diagnosis, reduces the risk of over-determination of semantic diagnostic models under weak evidence conditions, and ensures the reliability and traceability of diagnostic results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118463A_ABST
    Figure CN123118463A_ABST
Patent Text Reader

Abstract

This invention discloses a method for selecting visual evidence based on category-normal residuals for diagnosing appearance defects in mounted electronic components. A historical quality case library of automated optical inspection (AIO) of electronic components is established, and category normality centers are constructed from normal component image cases according to component category. After acquiring the AIO image to be diagnosed, residual features are generated between it and candidate cases of the same category, and reference evidence cases are selected based on residual similarity. The AIO image to be diagnosed, the reference evidence cases, and quality metadata are input into a semantic diagnostic model, which outputs a structured AIO defect diagnosis result with an evidence traceability field. This method reduces the interference of normal package appearance on retrieval ranking and improves the consistency between reference evidence and defect deviation signals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of Automatic Optical Inspection (AOI), electronic component appearance defect diagnosis, visual case retrieval, and retrieval-enhanced semantic diagnosis, and particularly to a method for selecting category-normal residual visual evidence for diagnosing appearance defects in mounted electronic components. The method is used in scenarios where historical quality cases of electronic component AOI are continuously accumulated, to select reference evidence cases that better characterize defect deviation signals for the AOI image to be diagnosed, and to generate traceable, structured AOI defect diagnosis results based on the reference evidence cases. Background Technology

[0002] In the surface mount technology (SMT) manufacturing process, automated optical inspection equipment is commonly used to capture images of the surface mount electronic components and inspect their appearance, including component position, solder joint condition, component orientation, and any localized damage. Surface mount electronic components such as resistors, capacitors, inductors, and diodes typically have relatively stable package outlines, terminal structures, pad areas, silkscreen backgrounds, and shooting orientations.

[0003] In AOI (Automated Optical Inspection) visual defect diagnosis, the on-site system not only needs to determine whether the AOI image to be diagnosed is abnormal, but also needs to provide the defect category, severity, handling suggestions, and reference evidence that can be reviewed by quality inspectors. This reference evidence typically comes from a historical quality case database of electronic component AOI, where image cases can be collected by the AOI equipment, and their component category and defect type can be determined based on AOI inspection results, quality inspection records, or manual review results.

[0004] Existing AOI (Automated Optical Inspection) methods typically output defect bounding boxes, defect scores, rule-based judgment results, or binary classification results. While these results help locate suspected abnormal areas, they are difficult to directly indicate which historical AOI cases the current defect is similar to, and they also struggle to explain the source of evidence for fine-grained defect judgments such as insufficient solder, open circuits, excessive solder, solder spikes, tombstoning, misalignment, and breakage.

[0005] With the development of visual language models and retrieval-enhanced generation technologies, similar cases can be retrieved from a historical quality case database of electronic component AOI (Automated Optical Inspection). Then, the AOI image to be diagnosed, reference evidence cases, and quality metadata are input into a semantic diagnostic model, which generates structured AOI defect diagnostic results. This approach incorporates historical quality inspection experience into the semantic diagnostic process, providing case-based evidence for defect descriptions and remedial recommendations.

[0006] However, conventional visual similarity retrieval directly compares the global visual features of AOI images, making it susceptible to being dominated by common components of normal package appearance within the same component category. For components such as resistors, capacitors, inductors, and diodes, normal package outlines, pad backgrounds, silkscreen areas, and shooting posture may constitute the main part of the visual features, while the weaker deviation signals such as solder joint edges, solder shape, component center offset, terminal connection status, and local damage are often used to distinguish defects.

[0007] Therefore, conventional visual retrieval may recall cases with similar overall package appearance but mismatched defect types, or prioritize recalling normal component images. It cannot reliably support fine-grained AOI defect diagnosis such as insufficient solder, open solder joints, excessive solder, solder spikes, tombstoning, misalignment, and breakage. This issue causes the reference evidence obtained by the semantic diagnostic model to deviate from the actual defect deviation signal, thereby increasing the risk of misleading labels, over-inference, and unreliable handling recommendations.

[0008] Even if the candidate case set is limited by component category before retrieval, if the retrieval ranking still mainly relies on the original image features, then normal appearance within the same category may still dominate the similarity results. For AOI images of mounted electronic components, simple category filtering cannot sufficiently reduce the influence of normal package appearance, pad background, and shooting posture on retrieval ranking.

[0009] Therefore, a visual evidence selection method is needed for AOI appearance defect diagnosis of surface mount electronic components. This method should establish a normal appearance benchmark within the same component category and simultaneously perform residual processing on the AOI image to be diagnosed and candidate cases of the same category, so that the selection of reference evidence shifts from overall package appearance similarity to similarity of defect deviation signals such as solder joints, orientation, misalignment, and breakage. At the same time, this method should also pass the selected reference evidence cases and quality metadata to the semantic diagnostic model and constrain the diagnostic confidence when the evidence support is insufficient. Summary of the Invention

[0010] The purpose of this invention is to provide a category-normal residual visual evidence selection method for diagnosing appearance defects in mounted electronic components, in order to solve the problems that ordinary visual retrieval is dominated by common components of normal package appearance, defect deviation signals are difficult to stably enter the reference evidence set, semantic diagnosis results lack traceable evidence, and diagnostic confidence is easily over-determined when evidence is insufficient.

[0011] To achieve the above objectives, this invention establishes a historical quality case library for electronic components using AOI (Automated Optical Inspection). This library stores normal component image cases and defective image cases confirmed through AOI inspection, quality control records, or manual review. Each case is associated with at least the component category identifier, AOI image data, defect status identifier, and quality metadata.

[0012] For each component category, this invention constructs a category normal center based on the visual features of normal component image cases within that category, and uses this category normal center as a vector reference for the normal package appearance of components of the same type. Upon receiving the AOI image to be diagnosed, the system extracts the query image features, reads the corresponding category normal center based on the component category identifier, and generates query residual features.

[0013] In the reference evidence selection stage, this invention determines a set of candidate cases within the same component category, and performs residual processing on the visual features of each candidate case and the normal center of the category to obtain candidate residual features. Then, the residual similarity between the query residual features and the candidate residual features is calculated, and reference evidence cases are selected based on the residual similarity.

[0014] In the semantic diagnosis stage, this invention inputs the AOI image to be diagnosed, reference evidence cases, and quality metadata such as component categories, defect types, residual similarities, text descriptions, and evidence source identifiers of the reference evidence cases into the semantic diagnosis model. This allows the semantic diagnosis model to output structured AOI defect diagnosis results under the constraints of the reference evidence. The structured AOI defect diagnosis results may include defect category, severity, visual observation, cause explanation, remedial recommendations, confidence level, and evidence citation.

[0015] In a preferred embodiment, the present invention defines a category normal center cache update rule. The category normal center is cached on a per-component-category basis and is updated only when a new normal component image case is added, a normal component image case is deleted, the normal status review conclusion changes, or the component category configuration changes. If a new defective image case is added but the set of normal component image cases remains unchanged, category normal center reconstruction is not triggered.

[0016] In a preferred embodiment, when selecting reference evidence cases, the present invention prioritizes sorting among confirmed defect candidate cases. When the number of confirmed defect candidate cases is insufficient, normal component image candidate cases are added. This rule allows the semantic diagnostic model to prioritize obtaining historical evidence with defect labels and verification basis, while still retaining normal cases as a control.

[0017] In a preferred embodiment, when the norm of the queried residual feature or candidate residual feature is lower than a stability threshold, the present invention reverts to the original image feature retrieval and records the residual reversion identifier in the retrieval metadata. This rule is used to avoid abnormal sorting or retrieval interruption caused by unstable residual direction when the AOI image to be diagnosed is close to the normal center of the category.

[0018] In a preferred embodiment, the present invention further constrains the output confidence level of the semantic diagnostic model based on the retrieval support quality of the reference evidence cases. The retrieval support quality reflects the strength of support provided by the reference evidence cases for the structured AOI defect diagnosis results. When the retrieval support quality is low, the system limits the upper limit of the confidence level of the diagnostic results and can generate a review prompt.

[0019] Compared with existing technologies, the present invention has at least the following beneficial effects: First, by constructing a category normal center through normal component image cases of the same component category, it is possible to characterize common components such as normal package outline, pad background, and shooting posture; Second, by simultaneously residualizing the AOI image to be diagnosed and candidate cases of the same category, the retrieval ranking pays more attention to defect deviation signals such as solder joints, posture, misalignment, and breakage; Third, by selecting semantic diagnostic reference evidence through residual similarity, the consistency between reference evidence and defect deviation signals is improved; Fourth, by writing reference evidence case identifiers, residual similarity, and evidence source identifiers, the diagnostic results can be traced by quality inspectors; Fifth, by retrieving support quality constraint confidence, the risk of the semantic diagnostic model outputting overly certain conclusions under weak evidence conditions is reduced. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the overall process of steps S1 to S6 of the method for selecting evidence of defects in mounted electronic components according to the present invention.

[0021] Figure 2 This is a flowchart of step S2 (construction of normal centers) and step S3 (querying residual features) of the present invention.

[0022] Figure 3 This is a schematic diagram of the process of residualization of candidate cases of the same category in step S4 and residual similarity evidence selection and recording in step S5 of the present invention.

[0023] Figure 4 This is a flowchart of step S6 of the present invention, which describes the structured defect diagnosis, diagnosis tracing, and confidence constraint. Detailed Implementation

[0024] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0025] This invention can be deployed in an electronic component AOI quality inspection system. The electronic component AOI quality inspection system includes at least an AOI device, an electronic component AOI historical quality case library, a visual feature extraction model, a vector retrieval engine, a semantic diagnostic model, and a diagnostic result management module. The AOI device is used to acquire AOI images to be diagnosed; the electronic component AOI historical quality case library is used to store normal component image cases and confirmed defect image cases; the visual feature extraction model is used to convert AOI component images into visual feature vectors; the vector retrieval engine is used to perform residual similarity ranking; the semantic diagnostic model is used to generate structured AOI defect diagnostic results; and the diagnostic result management module is used to write evidence traceability fields.

[0026] In one embodiment, the cases in the electronic component AOI historical quality case library include at least a case identifier, AOI image index, component category, defect type, anomaly marker, text description, and evidence source identifier. The component category may include at least one of resistors, capacitors, inductors, and diodes. The defect type may include at least one of normal, insufficient solder, open solder joint, excessive solder, solder spike, tombstoning, misalignment, and breakage.

[0027] like Figure 1 As shown, the method includes steps S1 to S6. Step S1 is used to establish a historical quality case library for electronic component AOI; step S2 is used to construct a category normal center based on normal component image cases of the same component category; step S3 is used to obtain the AOI image to be diagnosed and its component category identifier, and generate query residual features; step S4 is used to determine a candidate case set within the same component category, and generate candidate residual features; step S5 is used to select reference evidence cases based on the residual similarity between the query residual features and the candidate residual features; step S6 is used to input the reference evidence cases and their quality metadata into the semantic diagnostic model, output structured AOI defect diagnosis results, and write them into the evidence traceability field. Thus, the method forms a complete processing chain from historical case library entry, normal benchmark construction, two-sided residual retrieval to semantic diagnostic output.

[0028] Step S1 includes: acquiring historical quality cases of electronic components; grouping the historical quality cases according to component category; writing normal component image cases and confirmed defect image cases into the case set under the corresponding component category; and writing a case identifier, AOI image index, component category, defect type, anomaly mark, text description, and evidence source identifier for each historical quality case. The normal component image cases may come from image cases with normal AOI inspection results, image cases confirmed as normal by quality inspection records, or image cases confirmed as normal by manual review.

[0029] Step S2 includes: reading normal component image cases of the same component category from the electronic component AOI historical quality case library; calling a visual feature extraction model to convert each normal component image case into visual features; averaging and normalizing the visual features; and obtaining the category normal center corresponding to the component category. The visual feature extraction model can be a visual encoder, an industrial image representation model, or other models capable of outputting image vectors.

[0030] The category of normal centers can be calculated using the following formula:

[0031] in, Indicates the component category, Indicate component category The corresponding set of normal component image examples, This indicates the number of cases in the set. This represents an AOI component image in a normal component image example. Represents AOI component image Visual features obtained through the visual feature extraction model This indicates the normal center of component category c. This indicates normalization processing. The category normal center is used to characterize the common visual components of the same element category under normal conditions.

[0032] Furthermore, step S2 also includes category normal center cache update processing. The category normal center is cached using the component category as the key. The corresponding category normal center is recalculated only when a new normal component image case is added to the component category, a normal component image case is deleted, the normal status review conclusion changes, or the component category configuration changes. For cases where a confirmed defect image case is added but the set of normal component image cases remains unchanged, category normal center reconstruction is not triggered. This avoids repeatedly rebuilding the normal appearance benchmark when defect cases continue to accumulate, while ensuring that the normal appearance state used for residual processing is consistent with the current component category configuration.

[0033] Step S3 includes: receiving an AOI image to be diagnosed; obtaining the component category identifier corresponding to the AOI image to be diagnosed; reading the category normal center matching the component category identifier; extracting query image features of the AOI image to be diagnosed; and generating query residual features based on the query image features and the category normal center. In one embodiment, the component category identifier may be provided by workstation configuration, material code, AOI inspection task, upstream classification module, or manual selection result.

[0034] The query residual features can be generated according to the following formula:

[0035] in, This represents the AOI image to be diagnosed. Indicates querying image features, The category center indicates the element category to which the AOI image to be diagnosed belongs. This indicates a query for residual features. These residual features characterize the deviation information of the AOI image to be diagnosed relative to a normal package appearance benchmark of the same category.

[0036] Step S4 includes: defining a set of candidate cases of the same category based on the component category identifier; reading the visual features of each candidate case in the candidate case set; and generating candidate residual features based on the visual features and the corresponding category normal center. For each candidate case in the candidate case set, the candidate residual features can be generated according to the following formula:

[0037] in, This represents candidate cases within the same category of candidate case set. Indicate the visual features of candidate cases. This represents the candidate residual features. Since both the AOI image to be diagnosed and the candidate cases have their normal centers of the same category subtracted, the similarity comparison between the two occurs more in the defect deviation space than in the normal package appearance space.

[0038] Step S5 includes: calculating the class-normal residual similarity between the query residual feature and the candidate residual feature; sorting the candidate cases from high to low according to the class-normal residual similarity; and selecting the top-ranked candidate cases as reference evidence cases. The class-normal residual similarity can be calculated according to the following formula:

[0039] in, Indicates the category normal residual similarity. , This indicates the inner product operation. and When all values ​​have been normalized, the inner product operation can represent cosine similarity. The system can then proceed according to... Choose from high to low One candidate case was used as a reference evidence case.

[0040] Furthermore, step S5 also includes a fusion process of original visual ranking and residual ranking. The original visual ranking is obtained based on the original image features and is used to maintain the consistency of the overall appearance of the components and the shooting conditions; the residual ranking is obtained based on the category normal residual similarity and is used to highlight defect deviation signals. The two can be combined through a reciprocal ranking fusion method to reduce the influence of different similarity numerical scales on the fusion result.

[0041] The fusion score of the candidate cases can be calculated according to the following formula:

[0042] in, This represents the fusion score of candidate case i. Indicates candidate cases Rank in the original visual sorting Indicates candidate cases Rank in residual sorting Represents the original visual ranking weights. Indicates the residual sorting weight. This represents the smoothing constant. The system can be configured according to... Select reference evidence cases from high to low.

[0043] Furthermore, step S5 also includes priority selection of confirmed defect image cases. The system first sorts the confirmed defect candidate cases according to residual similarity and selects reference evidence cases; when the number of confirmed defect candidate cases is insufficient to meet the preset reference number, reference evidence is supplemented from the candidate cases of normal components of the same category according to residual similarity or original visual similarity. This rule enables the semantic diagnostic model to prioritize obtaining historical evidence with defect labels and treatment records, while retaining normal cases for comparison.

[0044] Furthermore, step S5 also includes stabilization processing when residual retrieval fails. If the component category identifier is missing, or if there is no set of normal component image cases under the current component category, the system can skip residual retrieval and switch to original visual retrieval. If the vector norm of the queried residual feature or candidate residual feature is less than a preset stabilization threshold, the system reverts to original image feature retrieval and records the residual reversion identifier in the retrieval metadata. The stabilization threshold can be configured according to the visual feature dimension and normalization accuracy. This stabilization processing rule is used to avoid unstable residual direction when the AOI image to be diagnosed is close to the normal center of the category, thereby causing interruption of reference evidence selection or abnormal sorting.

[0045] like Figure 2 As shown, Figure 2Steps S2 and S3 are further explained. Step S2 includes reading normal component image cases of the same component category, extracting visual features of the normal cases, calculating the average visual features, normalizing to obtain category normal centers, and updating the category normal center cache when a normal case is added, deleted, the normal status review conclusion changes, or the category configuration changes. Step S3 includes acquiring the AOI image to be diagnosed, extracting query image features, reading the normal centers of the same category, and generating query residual features based on the query image features and the normal centers of the same category. Thus, the AOI image to be diagnosed undergoes residualization based on the normal appearance benchmark of the same component category.

[0046] like Figure 3 As shown, Figure 3 Steps S4 and S5 are further explained. Step S4 includes inputting query residual features and component category identifiers, limiting the candidate case set to the same category, generating candidate residual features based on the visual features of each candidate case and the normal center of the same category, and reverting to original image feature retrieval when the residual norm falls below a preset stability threshold. Step S5 includes calculating the residual similarity between the query residual features and candidate residual features, prioritizing confirmed defect candidate cases, supplementing with normal component image candidate cases when the number is insufficient, fusing the original visual ranking and residual ranking, and outputting a set of reference evidence cases, residual similarity, and retrieval metadata. This process avoids cases from different component categories entering the residual comparison range and makes the ranking criteria more focused on defect deviation signals.

[0047] like Figure 4 As shown, Figure 4 Step S6 is further explained. Step S6 includes steps S6-1, S6-2, and S6-3. Specifically, step S6-1 is used to construct semantic diagnostic input, step S6-2 is used to parse the structured AOI defect diagnostic results and write them into the traceability field, and step S6-3 is used to output the diagnostic confidence based on the retrieval support quality constraint of the reference evidence cases.

[0048] In step S6-1, the system constructs the AOI image to be diagnosed, the reference evidence case image, and quality metadata as semantic diagnostic input. The quality metadata includes the component category, defect type, residual similarity, text description, historical treatment record, and evidence source identifier of the reference evidence case, which is used to enable the semantic diagnostic model to compare visual differences in the AOI image to be diagnosed based on the reference evidence case.

[0049] In step S6-2, the system sends the semantic diagnostic input to the semantic diagnostic model, parses it to obtain the structured AOI defect diagnosis result, and writes the reference evidence case identifier, residual similarity, and evidence source identifier into the structured AOI defect diagnosis result. The structured AOI defect diagnosis result may include defect category, severity, visual observation, possible cause, treatment suggestion, and confidence level.

[0050] In step S6-3, the system determines the upper limit of the semantic diagnostic output confidence level based on the retrieval support quality of the reference evidence case. The retrieval support quality is obtained by mapping the best retrieval score of the reference evidence case, and its value belongs to [0,1]. When the retrieval metric is cosine similarity or inner product similarity, the best similarity can be cropped to the [0,1] interval as the retrieval support quality. When the retrieval metric is distance, a distance-inverse mapping can be used to obtain the retrieval support quality. The upper limit confidence function can be determined according to the following piecewise function:

[0051] in, This indicates the quality of support provided by the referenced evidence cases for the retrieval of diagnostic results for defects in structured AOI. Indicates the boundary of low-quality evidence. Indicates the boundaries of high-quality evidence. This represents the upper limit of confidence allowed under weak evidence conditions. This represents the maximum allowed confidence level under strong evidence conditions. When the confidence level output by the semantic diagnostic model is higher than... At that time, the system will adjust the output confidence level to no more than [a certain value]. .

[0052] Furthermore, in step S6-3, the system can also execute defect type consistency constraints. The system collects a set of defect types from the quality metadata of the reference evidence cases and compares the defect categories output by the semantic diagnostic model with the set of defect types. When the output defect category does not belong to the set of defect types and there is no preset synonym mapping or partial matching relationship, the system reduces the confidence level according to the penalty parameter and generates a review prompt in the diagnostic results. The penalty parameter represents the amount of confidence penalty when the defect types are inconsistent.

[0053] Therefore, step S6 completes the construction of semantic diagnostic input, the tracing of diagnostic results, and the confidence constraint under the constraints of reference evidence cases, so that the output results simultaneously include defect diagnostic content, evidence citation information, and confidence limits imposed by the quality of retrieval support.

[0054] In one embodiment, the AOI image to be diagnosed is a case of insufficient solder in a capacitor. Normal centers of the same category characterize the capacitor package outline, end position, and normal solder joint appearance. After simultaneously residualizing the AOI image to be diagnosed and the candidate cases, the residual features weaken the influence of the capacitor body outline and silkscreen background, giving a higher weight to the deviation signal caused by insufficient solder in the pad area in the residual similarity. Therefore, the system can more easily recall confirmed defect image cases with similar insufficient solder morphology as reference evidence.

[0055] In another embodiment, the AOI image to be diagnosed is a resistor misalignment case. The normal center of the same category represents the normal package position and pad correspondence for that resistor category. After residual processing, the displacement difference of the component center relative to the pad is highlighted, and the selection of reference evidence shifts from overall package similarity to position deviation signal similarity, thereby providing the semantic diagnostic model with evidence closer to the current anomaly for judging the degree of misalignment and providing remedial recommendations.

[0056] In another embodiment, the AOI image to be diagnosed is an inductor tombstoning case. Since normal inductor images have stable package shapes and shooting postures, ordinary searches may recall cases with normal postures but similar backgrounds. With this invention, the abnormal component posture forms a more significant residual relative to the normal category center, allowing the system to prioritize reference evidence cases related to tombstoning or posture abnormalities.

[0057] In another embodiment, the AOI image to be diagnosed is a diode solder joint defect case. Residual processing highlights the difference between the solder joint area at the terminal and a normal solder joint, thus emphasizing the terminal connection anomaly related to the solder joint defect in the residual similarity ranking. For cases with excess solder or solder spikes, residual features can highlight solder morphology and solder joint edge anomalies, making the reference evidence cases more focused on similar solder deviations.

[0058] This invention is not limited to a specific visual feature extraction model. The visual feature extraction model can be a visual encoder or an encoder trained on AOI images; the visual evidence retrieval space can be a vector index, an approximate nearest neighbor index, or other data structures that support similarity retrieval; the semantic diagnostic model can be a visual language model or a multimodal diagnostic model capable of receiving image and text evidence.

[0059] It should be noted that the update cycle of the category normal center, the selection rules for normal component image cases, the fusion weight of residual sorting and original sorting, and the number of reference evidence cases are all important factors. Stability threshold Low-quality evidence boundary High-quality evidence boundaries , upper limit of confidence and All can be configured according to the specific AOI quality inspection process. The aforementioned formula is used to illustrate one feasible calculation method of the present invention. Those skilled in the art can use different normalization methods, similarity measures, ranking fusion methods, or confidence constraint functions to achieve the same or similar technical effects without departing from the concept of the present invention.

[0060] In summary, this invention constructs a closed loop through category normal centers of the same component category, bilateral residual processing, residual similarity evidence selection, result traceability fields, and evidence constraint confidence levels. This allows the AOI appearance defect diagnosis of mounted electronic components to no longer rely solely on the original global similarity or semantically generated data without evidence. Instead, it completes structured AOI defect diagnosis output supported by verifiable reference evidence cases. As long as the overall technical concept remains the same—simultaneously residualizing the AOI image to be diagnosed and candidate cases of the same category under the constraint of the normal center of the same component category, and selecting semantic diagnostic reference evidence based on residual similarity—it should fall within the protection scope of this invention.

Claims

1. A method for selecting visual evidence based on category-normal residuals for diagnosing appearance defects in surface-mount electronic components, characterized in that, The method includes the following steps: Step S1, establishing a historical quality case library for automated optical inspection of electronic components, the library including normal component image cases and confirmed defect image cases associated with component category identifiers; Step S2, for each component category, constructing a category normal center based on the visual features of normal component image cases of that component category; Step S3, acquiring the automated optical inspection image to be diagnosed and its component category identifier, extracting query image features, and generating query residual features based on the query image features and the corresponding category normal center; Step S4, determining a candidate case set within the same component category, and generating candidate residual features based on the visual features of each candidate case and the category normal center; Step S5, calculating the residual similarity between the query residual features and the candidate residual features, and selecting reference evidence cases based on the residual similarity; Step S6, inputting the automated optical inspection image to be diagnosed, the reference evidence cases, and their quality metadata into a semantic diagnostic model, and outputting a structured automated optical inspection defect diagnosis result.

2. The method according to claim 1, characterized in that, Each case in the historical quality case library of automated optical inspection of electronic components includes at least one of the following: case identifier, automated optical inspection image index, component category, defect type, anomaly mark, text description, and evidence source identifier; the confirmed defect image case is a defect image case confirmed based on automated optical inspection results, quality inspection records, or manual review results; the component category includes at least one of resistors, capacitors, inductors, and diodes; the defect type includes at least one of normal, insufficient solder, open solder joint, excessive solder, solder spike, tombstoning, misalignment, and breakage; the structured automated optical inspection defect diagnosis result includes at least one of the following: defect category, severity, handling recommendation, reference evidence case identifier, residual similarity, and evidence source identifier.

3. The method according to claim 1, characterized in that, The category of normal centers is according to the formula Construct, in which, Indicates the component category, Indicate component category A collection of normal component image examples, This indicates the number of cases in the set. Image representing an automated optical inspection element Visual features Indicates the normal center of the category. This indicates normalization processing; the category normal center is cached on a per-component-category basis and is only updated when a new normal component image case is added, a normal component image case is deleted, the normal status review conclusion changes, or the component category configuration changes.

4. The method according to claim 1, characterized in that, The query residual features are defined according to the formula. Generate candidate residual features according to formula Generate. Among them, This represents the image obtained from the automated optical detection system for diagnosis. This indicates candidate cases within the same component category. Indicates querying residual characteristics. Represents candidate residual features; the residual similarity is calculated according to the following formula: in, Indicates the image to be diagnosed by automated optical inspection. With candidate cases Residual similarity between them , This indicates inner product operation; when selecting reference evidence cases, the confirmed defect candidate cases are first sorted by residual similarity, and if the number is insufficient, normal component image candidate cases are added; when the norm of the queried residual feature or candidate residual feature is lower than the stable threshold, the process reverts to the original image feature retrieval.

5. The method according to claim 4, characterized in that, It also includes fusing the original visual ranking and the residual ranking, and calculating candidate cases according to the following formula. Fusion score: in, Indicates candidate cases The fusion score, Indicates the original visual ranking. Indicates the ranking of the residuals. and These represent the sorting weights, This represents the smoothing constant.

6. The method according to claim 1, characterized in that, This also includes the quality of search support based on referenced evidence cases. Determine the upper confidence level And adjust the confidence level of the semantic diagnostic model output to no more than ,in: in, This indicates the quality of support provided by the referenced evidence cases for the retrieval of defect diagnosis results from structured automated optical inspection. Indicates the boundary of low-quality evidence. Indicates the boundaries of high-quality evidence. This represents the upper limit of confidence under weak evidence conditions. This represents the upper limit of confidence under strong evidence conditions.

7. An electronic device comprising a processor and a memory, characterized in that, The memory stores a computer program, which, when executed by the processor, causes the electronic device to perform the method described in any one of claims 1 to 6.