Supply chain intelligent quality inspection and defect identification system based on AI model

By using an AI-based intelligent quality inspection system for the supply chain, the texture feature parameters of the surface of chip resistors can be extracted and dynamically adjusted in real time. This solves the problem of high misjudgment rate of minor defects caused by texture fluctuations between batches, achieving high-precision defect identification and reducing downtime.

CN121599951APending Publication Date: 2026-03-03STATE GRID SHANDONG ELECTRIC POWER CO
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511802489.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-03
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing supply chain quality inspection technologies are difficult to adapt to the texture fluctuations between product batches, resulting in a high rate of misjudgment and missed judgment in the identification of minor defects. Traditional systems do not extract the texture features of the current batch in real time and compare them with historical batches, and lack consistency verification of defect spatial distribution, resulting in poor parameter adaptability and serious misjudgment and missed judgment.

Method used

An AI-based intelligent quality inspection system for the supply chain is adopted. The texture feature adaptive unit extracts the texture feature parameters of the surface of the current batch of chip resistors in real time, and compares them with the preset historical batch feature library. The gradient deviation threshold and gray value range of the defect identification model are dynamically adjusted, and a convolutional neural network model is used to identify minute defects. The adaptive parameter changes during batch switching are recorded by the control output unit.

Benefits of technology

It achieves accurate capture of batch texture differences, adaptive adaptation of defect recognition parameters, improved accuracy of minor defect recognition, reduced downtime for batch switching, and lowered the false positive and false negative rates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121599951A_ABST
    Figure CN121599951A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of supply chain product quality inspection, in particular to an AI model-based supply chain intelligent quality inspection and defect identification system, which comprises a texture feature adaptive unit, a defect identification dynamic adjustment unit, an AI defect identification unit and a control output unit, the texture feature adaptive unit extracts texture density, contrast and edge gradient direction distribution of a chip resistor grey-scale map in real time, the texture density, the contrast and the edge gradient direction distribution are dynamically compared with a historical batch feature library to generate texture feature difference mapping, the defect identification dynamic adjustment unit nonlinearly adjusts a gradient deviation threshold value through an S-shaped response function according to the difference mapping, and the defect identification accuracy is improved. The AI defect identification unit adopts a convolutional neural network, outputs a defect classification result through parallel branch processing, spatial pyramid pooling and secondary verification, controls the output unit to transmit the result to an execution mechanism, records batch switching parameters, solves the problem of false and missing judgment caused by batch texture fluctuation, and improves the detection accuracy. And the quality inspection precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of supply chain product quality inspection technology, and more specifically, to an AI-based intelligent supply chain quality inspection and defect identification system. Background Technology

[0002] Supply chain product quality inspection is an important technology. In the context of the current intelligent upgrading of the supply chain and the increasing requirements for precision product quality, this technology is a key support for breaking through the limitations of traditional manual quality inspection. It can not only replace manual visual inspection and solve the problems of human fatigue and low sensitivity to the identification of minor defects, but also realize the automation and standardization of the quality inspection process, reduce batch quality inspection differences, and optimize the production process through real-time quality inspection data feedback to ensure the stability of downstream product quality in the supply chain. Existing supply chain quality inspection technologies face a core problem in practical applications: difficulty in adapting to texture fluctuations between product batches, leading to high misjudgment and false negative rates for minor defects. Traditional quality inspection systems often use fixed texture feature benchmarks and defect identification parameters. In the production of chip resistors, differences in substrate purity, slurry concentration, or imaging light source between different batches can cause fluctuations in surface texture density, contrast, and edge gradient direction. Traditional systems do not extract the texture features of the current batch in real time and dynamically compare them with historical batches, making it impossible to quantify the texture differences between batches. The key parameters of the defect identification model, such as the gradient deviation threshold and grayscale range, remain fixed for a long time without nonlinear adjustments based on texture fluctuations. When the batch texture density increases or the contrast enhances, normal textures are easily misjudged as minor defects. Small defects, such as sparse textures or reduced contrast, can lead to the failure to detect weak defect signals. Furthermore, traditional systems rely solely on a single feature to output recognition results, lacking verification of the spatial distribution consistency of defects and secondary comparison with historical texture templates. This makes it difficult to eliminate misjudgments of isolated noise points, further exacerbating recognition bias. These defects result in poor parameter adaptability due to the failure to capture texture differences, and fixed parameters can lead to misjudgments and missed judgments. The lack of a verification mechanism makes it impossible to correct the bias. Ultimately, this either results in qualified products being judged as defective, causing rework and waste, or defective products flowing into the downstream supply chain, causing end-product failures. This increases supply chain operation and maintenance costs and damages the company's quality reputation. To solve this technical problem, we provide an AI-based intelligent supply chain quality inspection and defect identification system. Summary of the Invention

[0003] The purpose of this invention is to provide an AI-based intelligent quality inspection and defect identification system for the supply chain to solve the problems mentioned in the background.

[0004] To achieve the above objectives, an AI-based intelligent quality inspection and defect identification system for the supply chain is provided, including: The texture feature adaptive unit is used to extract texture feature parameters of high-resolution grayscale images of the surface of the current production batch of chip resistors in real time, including texture density, contrast and edge gradient direction distribution, and to perform dynamic comparison based on a preset historical batch feature library. The historical batch feature library stores texture benchmark data of multiple historical batches, which is accumulated through offline training and online updating to generate texture feature difference mapping. The defect identification dynamic adjustment unit is used to adaptively adjust the gradient deviation threshold and gray value range of the defect identification model according to the texture feature difference mapping. The gradient deviation threshold is non-linearly compressed or expanded according to the batch texture contrast change to solve the problem of small defects and texture confusion caused by batch texture density and contrast fluctuation. The AI ​​defect recognition unit uses a convolutional neural network model, which takes an adjusted gradient deviation threshold and grayscale range as input, and outputs the classification results of minor defects. The control output unit is used to transmit the classification results to the quality inspection line actuator and record the adaptive parameter changes during batch switching to reduce downtime for adjustment.

[0005] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention utilizes a texture feature adaptive unit to extract the texture density, contrast, and edge gradient direction distribution features of high-resolution grayscale images of the surface of chip resistors in the current production batch in real time. Based on a preset historical batch feature library, it performs Euclidean distance matching and principal component analysis for dimensionality reduction, generating a texture feature difference mapping that quantifies batch texture differences. A defect identification dynamic adjustment unit, based on this difference mapping, uses an S-shaped response function to nonlinearly compress or expand the gradient deviation threshold of the defect identification model. It also combines grayscale range adjustment weights to bidirectionally stretch the grayscale value range differentiation benchmark, while injecting a texture clutter compensation vector. The AI ​​defect identification unit employs a convolutional neural network model to adjust... The parameters input are then used to generate edge intensity masks and candidate defect regions through parallel branches. After channel splicing, spatial pyramid pooling, and multi-scale classification head output, the results are further optimized through dynamic confidence threshold filtering, defect spatial distribution consistency verification, and cosine similarity verification with historical texture templates. The output unit then transmits the classification results to the execution mechanism and records batch switching parameters. This achieves the effects of accurate capture of batch texture differences, adaptive adaptation of defect recognition parameters, improved accuracy of small defect recognition, and reduced downtime for batch switching adjustments. It effectively solves the problem of high misjudgment and high missed judgment rates of small defect recognition caused by the difficulty in adapting to texture fluctuations between product batches. Attached Figure Description

[0006] Figure 1 This is an overall block diagram of the present invention.

[0007] The meanings of the labels in the diagram are as follows: 1. Texture feature adaptive unit; 2. Defect recognition dynamic adjustment unit; 3. AI defect recognition unit; 4. Control output unit. Detailed Implementation

[0008] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0009] This invention provides an AI-based intelligent quality inspection and defect identification system for the supply chain. Please refer to [link / reference]. Figure 1 As shown, it includes: The texture feature adaptive unit 1 is used to extract texture feature parameters of the high-resolution grayscale image of the surface of the current production batch of chip resistors in real time, including texture density, contrast and edge gradient direction distribution, and to perform dynamic comparison based on the preset historical batch feature library. The historical batch feature library stores texture benchmark data of multiple historical batches, which is accumulated through offline training and online updating to generate texture feature difference mapping. The defect identification dynamic adjustment unit 2 is used to adaptively adjust the gradient deviation threshold and gray value range of the defect identification model according to the texture feature difference mapping. The gradient deviation threshold is non-linearly compressed or expanded according to the batch texture contrast change to solve the problem of small defects and texture confusion caused by batch texture density and contrast fluctuation. AI Defect Recognition Unit 3 uses a convolutional neural network model, inputting an adjusted gradient deviation threshold and grayscale range, and outputting the classification results of minor defects; The control output unit 4 is used to transmit the classification results to the quality inspection line actuator and record the adaptive parameter changes during batch switching to reduce downtime for adjustment.

[0010] The methods for extracting texture density, contrast, and edge gradient direction distribution in texture feature adaptive unit 1 include: Texture enhancement of high-resolution grayscale images is achieved through multi-scale Gaussian difference filtering. In the enhanced image, an adaptive grid segmentation method is used to divide the resistive surface into several sub-regions. The energy entropy of the gray-level co-occurrence matrix is ​​calculated in each sub-region to quantify the texture density. The ratio of the maximum gray-level difference to the average gray-level in the sub-region is calculated based on the local gray-level extreme value difference algorithm as the contrast. The edge response of each sub-region is captured by a direction-adjustable Gabor filter bank. The direction angle distribution of edge line segments is detected by combining Hough transform. Finally, the mean variance of the direction angle of the edge line segments in each sub-region is used as the edge gradient direction distribution feature.

[0011] Further explanation is needed regarding the specific implementation of the texture feature adaptive unit for extracting texture feature parameters. When the texture feature adaptive unit 1 extracts features from the high-resolution grayscale image of the surface of the current production batch of chip resistors, it first needs to highlight subtle texture information through texture enhancement, and then quantize key feature parameters by region to avoid feature misjudgment caused by image noise or uneven texture. The specific implementation is as follows: First, texture enhancement is performed on the high-resolution grayscale image using multi-scale Gaussian difference filtering. This filtering method constructs Gaussian kernels at different scales and performs convolution operations on the original grayscale image to obtain three sets of images with different smoothness levels. Then, the difference between adjacent scale Gaussian images is calculated to generate two sets of difference images. Finally, the difference images and the original image are superimposed with a weight of 0.6:0.4 to enhance the grayscale difference at the texture edges while suppressing background noise, thus completing texture enhancement and laying a clear texture foundation for subsequent feature extraction. After texture enhancement, an adaptive grid segmentation method is used to divide the resistor surface into several sub-regions. The adaptive grid segmentation method is a segmentation method that dynamically adjusts the grid size according to the changes in the texture of the resistor surface, avoiding the analysis bias of uneven texture regions caused by a fixed grid. The specific segmentation process is as follows: First, the physical boundaries of the chip resistor are determined using an edge detection algorithm to exclude the background area of ​​the image, thus obtaining the effective area of ​​the resistor. Then, the texture change rate within the effective area is calculated. The standard deviation of grayscale values ​​within a sliding 5×5 window is statistically analyzed; a larger standard deviation indicates more drastic texture changes. For areas with a texture change rate greater than 20, a small 100×100 pixel grid is used to ensure the capture of subtle local textures. For uniform areas with a texture change rate less than 10, a large 200×200 pixel grid is used to reduce redundant calculations. Finally, the effective area of ​​the resistor is divided into several sub-regions, each accurately reflecting local texture characteristics. To quantify texture density, the energy entropy of the gray-level co-occurrence matrix is ​​calculated within each sub-region. The gray-level co-occurrence matrix describes the distance between points within each sub-region. A matrix representing the probability of two pixel grayscale values ​​occurring at a fixed pixel distance is used. The energy entropy is calculated by statistically analyzing the information entropy of all probability values ​​in this matrix. Specifically, a grayscale co-occurrence matrix is ​​first constructed for each sub-region. Then, the sum of -probability × log2 (probability) of all matrix elements is calculated to obtain the energy entropy. This energy entropy is compared with a benchmark value in the historical batch feature library. For every 0.5 increase in energy entropy above the benchmark value, the texture density is considered to have increased by 10%, thus quantifying the texture density. When calculating contrast, a local grayscale extreme difference algorithm is used. This algorithm finds the maximum and minimum grayscale values ​​within a sub-region and calculates the difference between them to reflect the degree of grayscale fluctuation within the region. Higher contrast indicates more significant grayscale differences at texture edges. The specific process is as follows: For each sub-region, the maximum and minimum grayscale values ​​are found by traversing all pixels, and the difference between them is calculated. Then, the average grayscale of the sub-region is calculated using an arithmetic mean. The ratio of the maximum grayscale difference to the average grayscale is used as the contrast of the sub-region. For the extraction of edge gradient direction distribution, an adjustable Gabor filter bank is first used to capture the edge response of each sub-region. This adjustable Gabor filter bank is a filter set composed of multiple Gabor filters with different orientation angles. It can dynamically adjust the filter orientation according to the texture direction to accurately capture edges in specific directions. Specifically, during construction, the center frequency and bandwidth ratio of the filters are dynamically set based on the statistical range of texture density in the historical batch feature library. The filter orientation angles are rotated at 15° intervals to generate 12 channels. Each channel produces a strong response to the edge in the corresponding direction. Non-maximum suppression is applied to the output response intensity of each channel to generate the edge direction map of the sub-region, completing the edge response capture. The direction angle distribution of edge line segments is then detected using Hough transform. Hough transform detection converts edge pixels in image space to a parameter space, polar coordinate space, where the parameter is the length of the line segment from the origin. With direction angle The algorithm for locating line segments by accumulating voting values ​​in the parameter space is as follows: For edge pixels in the edge orientation map, i.e., pixels with a response intensity greater than 100, in polar coordinate space, according to Calculate the corresponding pixel The parameters, x and y, are pixel coordinates, and are voted on in the accumulator in the parameter space. When a certain value in the accumulator is selected... When the voting value exceeds the threshold, the parameter is determined to correspond to a real edge segment, and the direction angles of all detected edge segments are counted. Calculate the variance of these orientation angles, and then take the average of the variances of all sub-regions as the edge gradient direction distribution characteristics of the entire resistance image.

[0012] The construction method of directional tunable Gabor filter banks specifically includes: Based on the statistical range of texture density in the historical batch feature library, the center frequency and bandwidth ratio of the filter are dynamically set to cover the spatial frequency spectrum of typical textures. The filter orientation angle is rotated at preset angle intervals to generate multi-channel responses. The response intensity of each channel output is suppressed by non-maximum to generate an edge orientation map. The calculation of edge gradient orientation distribution features further introduces an orientation consistency verification mechanism to remove edge segments with lengths below a preset threshold, and only retain the orientation angles of continuous edges to participate in the variance calculation.

[0013] Further explanation is needed regarding the specific implementation of the directional adjustable Gabor filter bank. After the texture feature adaptive unit 1 completes texture enhancement and adaptive mesh segmentation through multi-scale Gaussian difference filtering, a directional adjustable Gabor filter bank needs to be constructed to accurately capture the texture edges of the chip resistor surface in different directions. The core advantage of this filter bank is that it can dynamically adjust parameters according to the texture characteristics of historical batches, avoiding edge response distortion caused by texture differences in fixed filters. The specific implementation is as follows: Based on the statistical range of texture density in the historical batch feature library, the center frequency and bandwidth ratio of the filter are dynamically set. The historical batch feature library stores the texture reference data of chip resistors from past production batches. Typical texture is defined as the inherent, defect-free texture formed by the chip resistor under normal production processes, including the epoxy material texture of the resistor body, the resistive paste texture printed on the surface, and the packaging texture around the leads. The spatial frequencies of these textures have a fixed range and are the core basis for setting filter parameters. The center frequency is set according to the principle that the higher the texture density, the higher the center frequency, ensuring that the center frequency always falls in the middle of the spatial frequency range of the typical texture of the current batch. The bandwidth ratio is fixed at 0.5 of the center frequency. This ratio allows the filter's frequency response to cover ±25% of the spatial frequency range of the current typical texture, which precisely includes the frequency fluctuations of textures at different locations within the same batch, thereby achieving complete coverage of the typical texture spatial frequency spectrum and avoiding edge response loss due to frequency offset. Multi-channel response is generated by rotating the filter direction angle at preset angle intervals. The preset angle interval is set to... ,from Start, every rotation One filter channel is generated, resulting in a total of 12 channels. The filters for each channel, except for their orientation angles, maintain the same center frequency and bandwidth ratio as described above, ensuring that edges in different directions receive equally strong response detection. When generating multi-channel responses, the enhanced image of each sub-region is input into the 12 Gabor filters. Each filter only produces a strong response to edges with the same orientation angle as itself. The response intensity matrix output by each channel is initially normalized to obtain the original response maps for the 12 channels, completing the multi-channel response generation. The response intensity output by each channel is then subjected to non-maximum suppression (NMS) to generate an edge direction map. NMS is an edge refinement technique that retains the maximum response intensity of the edge's center pixel while suppressing redundant responses from adjacent pixels on both sides of the edge, avoiding excessive edge coarsening. The specific process is as follows: For each pixel in the original response map of each channel, the response intensities of its two adjacent pixels are compared along the direction angle of that channel filter. If the response intensity of the current pixel is the maximum value among the three pixels, the intensity value is retained; otherwise, it is set to 0. After non-maximum suppression of all pixels, each channel retains only the fine edge lines along its own direction angle. Based on this, an edge direction map is generated. For the 12 suppressed response maps of each sub-region, a pixel-by-pixel maximum response channel operation is performed. That is, for each pixel, its response intensity is compared among the 12 channels, and the direction angle corresponding to the channel with the highest response intensity is taken as the edge direction of that pixel. The final shape is... An edge direction map is generated, with each pixel marked with an orientation angle. To further improve the accuracy of the edge gradient orientation distribution features, an orientation consistency verification mechanism is introduced into the calculation of the edge gradient orientation distribution features. The orientation consistency verification mechanism is a technique that verifies whether the orientation angles of adjacent pixels on an edge segment are continuous, eliminates isolated short edges caused by noise interference, and retains continuous edges of real texture. In specific applications, the 8-neighborhood chain code tracking algorithm is first used to extract the edge segments in the edge direction map. Starting from the pixel with a response intensity greater than 50 (the preset edge pixel threshold), it sequentially searches its 8 neighborhoods for pixels that also satisfy the condition of a response intensity greater than 50 and an orientation angle difference of less than 50 from the current pixel's orientation angle. Pixels with a (directional consistency threshold) are connected to form an edge segment. If there are no matching pixels in the neighborhood of a pixel, the tracking of the current edge segment ends. After tracking, the number of pixels contained in each edge segment is counted, i.e., the edge segment length. The preset threshold for edge segment length is set to 5 pixels. This threshold is calibrated using historical data. Edges shorter than 5 pixels are mostly false edges caused by noise. Edge segments shorter than 5 pixels are removed, and only continuous edge segments with a length of 5 pixels or more are retained. Finally, only the orientation angles of the retained continuous edge segments are used to participate in the variance calculation of the edge gradient orientation distribution features. For each sub-region, the orientation angles of all pixels on the continuous edge segments are collected, and the variance of these orientation angles is calculated. The variance reflects the dispersion of the orientation angles. The smaller the variance, the more concentrated the edge orientation is, and the more it conforms to the orientation characteristics of typical textures. The arithmetic mean of the variances of all sub-regions is then taken to obtain the edge gradient orientation distribution features of the entire resistance image, providing directional feature basis for subsequent defect identification.

[0014] Specific methods for dynamic comparison based on a pre-defined historical batch feature database include: The texture density, contrast, and edge gradient direction distribution feature vectors extracted from the current batch are matched with all records in the historical batch feature library using Euclidean distance. Several historical batches with the smallest distance are selected as reference benchmark sets. After dimensionality reduction using principal component analysis, the projection residuals of the current batch features in the space spanned by the reference benchmark set are constructed. The difference in texture features between batches is quantified by the residual modulus. At the same time, the KL divergence between the edge gradient direction distribution of the current batch and the reference benchmark set is calculated to evaluate the offset of the gradient direction statistical characteristics.

[0015] Further explanation is needed regarding the specific implementation of dynamic comparison based on historical batch feature library. After the texture feature adaptive unit 1 completes the extraction of texture density, contrast, and edge gradient direction distribution features of the current production batch of chip resistors, dynamic comparison needs to be performed based on the preset historical batch feature library. Comparing only the numerical values ​​of a single feature can easily overlook the collaborative changes between multiple features. Therefore, it is necessary to use multi-dimensional matching and difference quantification methods to accurately assess the degree of texture deviation between the current batch and historical normal batches. The specific implementation method is as follows: The feature vector extracted from the current batch is matched with all records in the historical batch feature library using Euclidean distance. The feature vector of the current batch is a three-dimensional vector containing texture density, contrast, and edge gradient direction distribution. The historical batch feature library stores feature records of past normal production batches, each of which is also a vector composed of the above three-dimensional features. Euclidean distance matching calculates the straight-line distance between the current feature vector and each historical feature vector in three-dimensional space. The smaller the distance, the more similar the features of the two batches are. In specific calculation, the squared difference between the corresponding dimensions of the current vector and a certain historical vector is first summed, and then the square root of the sum is taken. After traversing all records in the historical library, the top 5 historical batches with the smallest Euclidean distance are selected as the reference set. Selecting 5 batches is the optimal number verified through experiments. This number covers the characteristic fluctuation range of historical normal batches without causing computational redundancy due to excessive batches. After completing the selection of the reference set, to reduce feature dimensionality redundancy and focus on core differences, principal component analysis (PCA) is used to reduce dimensionality and construct the projection residuals of the current batch features in the spanned space of the reference set. PCA is a dimensionality reduction technique that maps high-dimensional features to a low-dimensional space through linear transformation. Its core is to retain the principal components that contribute the most to the data differences, i.e., the direction with the largest feature variance, and eliminate redundant information. The spanned space of the reference set refers to the low-dimensional space composed of the principal components of the reference set features, which can represent the feature distribution range of historical normal batches. The specific process is as follows: The five 3D eigenvectors of the reference set are centered. The mean of each eigendimensional is calculated, and the mean is subtracted from each eigenvalue of each vector to eliminate the influence of absolute numerical offset. The covariance matrix of the centered vectors is calculated, and the correlation between the eigendimensional vectors is analyzed. The eigenvalues ​​and eigenvectors of the covariance matrix are solved, and the two eigenvectors with the largest eigenvalues ​​are selected as principal components. The centered eigenvectors of the current batch are projected onto the two-dimensional space formed by these two principal components to obtain the projection vector, which is the projection of the current vector into the space spanned by the reference set. The projection residual is obtained by subtracting the projection vector from the centered eigenvectors of the current batch. The projection residual is the part of the current vector that is not covered by the space spanned by the reference set. The larger the residual, the more significant the deviation of the current batch's features from the historical normal range. The residual modulus quantifies the difference in texture features between batches. The residual modulus, or the length of the projected residual vector, is obtained by taking the square root of the sum of the squares of each dimension of the residual vector. The modulus is positively correlated with the degree of difference: a modulus less than 0.05 indicates a small difference, between 0.05 and 0.1 indicates a moderate difference, and greater than 0.1 indicates a significant difference. The residual modulus provides a direct way to quantify the overall texture difference between the current batch and historical batches. Simultaneously, the KL divergence between the edge gradient direction distribution of the current batch and the reference set is calculated to assess the shift in the statistical characteristics of the gradient direction. KL divergence is an indicator of the difference between two probability distributions; a larger value indicates a more severe shift. Here, it is used to focus on the difference in the key feature of edge direction, preventing overall differences from masking local directional shifts. The specific calculation process is as follows: The edge gradient direction is divided into 12 equal-angle intervals, covering all possible direction ranges. The percentage of pixels in each interval for the current batch edge gradient direction is counted to obtain the probability vector of the current direction distribution. The average direction distribution probability vector of the reference set is calculated. The direction distribution probability vectors of the five historical batches in the reference set are averaged by dimension. The difference between the two probability vectors is calculated according to the definition of KL divergence. For each interval, the current probability is multiplied by the logarithm ratio of the current probability to the historical average probability, and then summed to obtain the KL divergence value. The adjustment of direction-related feature parameters needs to be focused on in subsequent defect identification.

[0016] The process of generating texture feature difference maps specifically includes: Texture feature difference and gradient direction KL divergence are input into a pre-trained difference transformation model, which is constructed using a deep forest algorithm. Its input layer receives multidimensional difference indices, and the hidden layer learns the association rules between difference indices and defect identification model parameter adjustment through hierarchical decision tree combination. The output layer generates a multidimensional difference mapping vector containing gradient deviation threshold offset coefficient, grayscale range adjustment weight, and texture disorder compensation factor. The offline training of the historical batch feature library uses a semi-supervised clustering method to accumulate initial data. During online updates, the incremental learning of the feature library is triggered by the misjudged samples fed back by the output unit 4.

[0017] Further explanation is needed regarding the specific implementation of the texture feature difference mapping generation. After obtaining the texture feature difference degree through dynamic comparison and quantizing it by the projection residual modulus to reflect the overall texture deviation and gradient direction KL divergence between the current and historical batches, in order to transform these two abstract difference indicators into adjustment parameters that can be directly called by the defect recognition model, the texture feature adaptive unit 1 needs to generate the texture feature difference mapping based on the pre-trained difference transformation model. This model is constructed using the deep forest algorithm and can accurately learn the intrinsic relationship between differences and parameter adjustment. The specific implementation is as follows: First, we focus on the specific construction process of the pre-trained difference conversion model. Valid sample pairs are selected from the historical batch feature library. Each sample pair contains two parts: input and output. The input is the texture feature difference and gradient direction KL divergence of a certain historical batch, and the output is the optimal parameter adjustment value corresponding to that batch. These are the parameters that, as verified experimentally, enable the defect recognition model to achieve the highest accuracy. These parameters include the gradient bias threshold offset coefficient, grayscale range adjustment weight, and texture clutter compensation factor. The sample pairs are divided into training and validation sets in an 8:2 ratio. During training, each layer of the decision tree is based on the output of the previous layer and the original input features, learning through a voting mechanism. The association rule is learned, and the error between the model's output parameters and the optimal parameters is evaluated using a validation set every 3 training rounds. Training stops when the error remains below 5% for 3 consecutive rounds, resulting in a pre-trained difference transformation model that can stably output parameter adjustment values. Here, it's necessary to clarify the definition of the defect recognition model. It is a convolutional neural network model used in subsequent AI defect recognition unit 3 to detect minute defects in chip resistors. Its core function is to extract features from the resistor's grayscale image and determine whether a defect exists. The gradient deviation threshold is used to distinguish whether edges are normal textures or defects. The grayscale value range distinction benchmark is used to filter grayscale intervals that may be defects. Texture clutter compensation... The parameters used to correct feature extraction biases in areas with cluttered textures are key adjustable parameters of this model. If these parameters are fixed, batch texture differences will lead to misjudgments of defects. Therefore, they must be dynamically adjusted based on the texture differences between the current batch and historical batches. The output of the difference transformation model provides the basis for this adjustment. When the texture feature difference degree and gradient direction KL divergence of the current batch are input into the pre-trained difference transformation model, the input layer standardizes these two difference indicators to ensure consistency with the feature range during model training. These standardized difference indicators enter the hidden layer, and each of the 50 decision trees in the layer will independently determine the difference based on the texture feature difference degree and gradient direction KL divergence of the current batch. The previously learned rules provide predicted values ​​for parameter adjustments. Then, the average value is obtained through voting within each layer to determine the output of that layer. This process is performed sequentially across the 10-layer decision tree. Each layer further optimizes the prediction based on the results of the previous layer. Finally, at the output layer, the three optimized parameter adjustment values ​​from the 10 layers are packaged into a multi-dimensional difference mapping vector containing these three core parameters. This vector is directly passed to the defect identification dynamic adjustment unit 2 for accurate adjustment of subsequent model parameters. To ensure that the training data and dynamic comparison reference data of the difference conversion model always closely match actual production conditions, the historical batch feature library is used...The system employs a dual-mechanism maintenance approach. During the offline training phase, initial data is efficiently accumulated through semi-supervised clustering. First, unannotated texture feature vectors from normal production batches are collected. These vectors are then clustered into 5 clusters based on texture similarity using the K-means algorithm. Next, 20 samples are randomly selected from each cluster for manual verification and annotation to confirm the absence of defects and normal texture features. These annotated samples are then stored as initial baseline data in the feature library. This approach reduces the workload of full manual annotation while ensuring the reliability of the initial data. During the online update phase, incremental learning is triggered by misjudged samples fed back from control output unit 4. Output unit 4 detects a misjudgment in the defect identification results of a certain batch. It automatically packages the texture feature vector of that batch, the corresponding difference index, and the manually corrected parameter adjustment values ​​into a misjudged sample and feeds it back to the historical batch feature library. The system within the library first calculates the similarity between the misjudged sample and existing data in the library. If the similarity is less than 80%, it is added to the feature library, and incremental training of the difference conversion model is immediately triggered. Only the newly added misjudged sample is used to update the decision tree of the last two layers of the model. The model and feature library can continuously adapt to minor changes in the production process, always maintaining the ability to accurately map texture differences.

[0018] The adaptive adjustment of the defect identification dynamic adjustment unit 2 specifically includes: Based on the gradient deviation threshold offset coefficient in the texture feature difference mapping, the preset gradient deviation benchmark threshold is dynamically scaled. At the same time, the weights are adjusted according to the gray range. The lower and upper limits of the gray value range of the defect candidate region are multiplied by the corresponding weight coefficients. For the output texture disorder compensation factor, a compensation vector is injected into the feature fusion layer of the defect recognition model. This vector maps the compensation factor into feature channel attention weights through a fully connected network.

[0019] Further explanation is needed regarding the specific implementation of the adaptive adjustment of the defect recognition dynamic adjustment unit. After the texture feature adaptive unit 1 generates a multi-dimensional difference mapping vector containing gradient deviation threshold offset coefficients, grayscale range adjustment weights, and texture disorder compensation factors, the defect recognition dynamic adjustment unit 2 needs to adaptively adjust the core parameters of the defect recognition model based on this vector. After all, the texture differences between different batches will cause fixed parameters to be unable to accurately distinguish between normal textures and minor defects. Therefore, the adjustment needs to be carried out in three dimensions for the three key parameters: gradient, grayscale, and texture disorder, to ensure that the defect recognition model can adapt to the texture characteristics of the current batch. The specific implementation is as follows: First, the gradient deviation threshold is dynamically scaled. The core basis is the gradient deviation threshold offset coefficient in the difference mapping vector. This coefficient is a parameter adjustment coefficient generated based on the difference in texture features between the current batch and historical batches. The value range is usually between 0.8 and 1.2. When the coefficient is greater than 1, it means that the preset gradient deviation benchmark threshold needs to be expanded, which is suitable for batches with dense textures or high contrast, to avoid misjudging normal texture edges as defects. When the coefficient is less than 1, it means that the threshold needs to be compressed, which is suitable for batches with sparse textures or low contrast, to avoid missing weak defect edges. The specific process of dynamic scaling is as follows: First, a preset gradient deviation baseline threshold is retrieved from the defect recognition model. This baseline threshold is calibrated using historical normal batch data. For example, for the surface texture of a chip resistor, the baseline threshold is set to 20, meaning that pixels with a gradient amplitude exceeding 20 are initially identified as potential defect edges. Then, this baseline threshold is directly multiplied by the gradient deviation threshold offset coefficient to obtain the adjusted gradient deviation threshold. For example, if the current batch has high texture density and the offset coefficient in the difference mapping vector is 1.1, then the adjusted threshold = 20 × 1.1 = 22. This means that only pixels with a gradient amplitude exceeding 22 will be included in the defect candidate edge list, reducing false positives for texture edges. If the current batch has low contrast... With an offset coefficient of 0.9, the adjusted threshold is 20 × 0.9 = 18. This lowers the edge detection standard to capture weaker defect gradient signals, ensuring that the gradient deviation threshold accurately matches defect identification requirements across batches with different texture characteristics. After adjusting the gradient deviation threshold, the grayscale range of the defect candidate region needs to be adjusted simultaneously based on the grayscale range adjustment weight. This is because batch differences in texture contrast can cause a shift in the grayscale signal of the defect. The adjustment weight is a parameter used to amplify or reduce the grayscale range, typically between 0.95 and 1.05. A weight greater than 1 requires expanding the grayscale range, while a weight less than 1 requires narrowing the range. The specific adjustment process is as follows: First, determine the original grayscale range of the defect candidate region, obtained from the statistical analysis of defect grayscale values ​​in historical normal batches. Then, combine this with the historical batch average grayscale deviation (i.e., the difference between the current batch's grayscale value and the historical average grayscale value) to perform a bidirectional adjustment on the original range. The adjusted lower limit of the grayscale range = original lower limit - (adjustment weight × historical average grayscale lower limit deviation), and the adjusted upper limit = original upper limit + (adjustment weight × historical average grayscale upper limit deviation). By expanding the grayscale range, the defect signal caused by batch grayscale offset is covered. If the adjustment weight is 0.98, the lower limit = 50 - (0.98 × 5) = 4. 5.1, Upper limit = 200 + (0.98 × 10) = 209.8. The range is appropriately reduced to decrease noise interference, ensuring that the adjusted grayscale range can accurately define the defect candidate region for the current batch. Finally, parameter compensation is performed on the texture messiness compensation factor output in the difference mapping vector. The texture messiness compensation factor is a parameter that quantifies the degree of texture messiness in the current batch. The messier the texture, the larger the factor value. Its function is to correct the recognition deviation caused by feature confusion in the texture messy region of the defect recognition model. In specific implementation, a compensation vector needs to be injected into the feature fusion layer of the defect recognition model: First, the texture clutter compensation factor is input into a pre-defined fully connected network. This network contains one hidden layer, and the number of neurons is the same as the number of feature channels in the feature fusion layer. The fully connected network dynamically generates feature channel attention weights according to the magnitude of the compensation factor. Then, these attention weights are multiplied channel by channel with the feature map output by the feature fusion layer. By assigning weights, the signal strength of the defect feature channel is enhanced and the interference of redundant texture feature channels is suppressed. Even in batches with cluttered textures, the model can accurately focus on the feature information of small defects and avoid misjudgment or missed detection caused by texture interference.

[0020] The gradient deviation threshold is non-linearly compressed or expanded based on batch texture contrast variations, specifically including: An S-shaped response function is established with batch texture contrast as the independent variable and threshold scaling ratio as the dependent variable. When the contrast of the current batch is higher than that of the reference batch, the output value of the response function increases logarithmically with the increase of the contrast difference, thus achieving threshold expansion. When the contrast is lower than that of the reference batch, the output value of the response function decreases exponentially with the increase of the difference, thus achieving threshold compression. The curvature parameter of the response function is dynamically adjusted by the KL divergence in the gradient direction.

[0021] Further explanation is needed regarding the specific implementation of nonlinear compression and expansion of the gradient deviation threshold. After the defect identification dynamic adjustment unit 2 performs basic dynamic scaling on the gradient deviation threshold, considering that the influence of batch texture contrast variation on the threshold is not linear, linear adjustment alone is insufficient to accurately adapt to different contrast fluctuation scenarios. Therefore, it is necessary to establish an S-shaped response function with batch texture contrast as the core variable to achieve nonlinear compression or expansion of the threshold. The specific implementation is as follows: The basis and expression of the S-shaped response function are clearly defined. The S-shaped response function is a non-linear function with an S-shaped curve. Its core characteristic is that the changes are gentle at both ends and steep in the middle, avoiding over- or under-adjustment of the threshold under extreme contrast conditions, as is the case with linear functions. Before establishing the function, key benchmark values ​​must be determined. The reference batch texture contrast is the average contrast extracted from the reference benchmark set of the historical batch feature library, serving as the benchmark for judging the contrast level of the current batch. The independent variable of the function is defined as the difference between the texture contrast of the current batch and the contrast of the reference batch, i.e., contrast difference = current contrast - reference contrast. A positive difference indicates that the current contrast is higher than the reference, and a negative difference indicates that it is lower than the reference. The dependent variable is defined as the threshold scaling ratio, used for non-linear adjustment of the gradient deviation benchmark threshold. A ratio greater than 1 achieves threshold expansion, and a ratio less than 1 achieves threshold compression. The function can be described as follows: when the contrast difference is negative, the threshold scaling ratio decreases exponentially with the increase of the absolute value of the difference, and the rate of decrease gradually slows down; when the contrast difference is positive, the threshold scaling ratio increases logarithmically with the increase of the difference, and the rate of increase gradually slows down. The entire function curve is defined as follows: when the difference is 0, the scaling ratio... When the threshold is set to 1, no adjustment is needed. The curve exhibits a symmetrical S-shaped distribution centered on this point, ensuring that the threshold remains in a baseline state when consistent with the characteristics of the reference batch. The nonlinear adjustment process of the function is refined under different contrast scenarios. When the contrast of the current batch is higher than that of the reference batch, the threshold scaling ratio output by the response function increases logarithmically with the increase of the contrast difference, ensuring that even if the contrast increases significantly, the threshold will not expand indefinitely and always retain the ability to capture small defect gradient signals. When the contrast of the current batch is lower than that of the reference batch, the threshold scaling ratio output by the response function decreases exponentially with the increase of the absolute value of the difference, ensuring that the threshold will not be over-compressed in low-contrast scenarios, balancing the needs of defect capture and noise suppression. Finally, the curvature parameter of the response function is dynamically adjusted through the gradient direction KL divergence. The curvature parameter is the core parameter controlling the steepness of the S-shaped curve. The larger the parameter value, the steeper the change in the middle section of the curve; the smaller the parameter value, the smoother the curve. The adjustment logic is based on the gradient direction statistical characteristic offset reflected by the gradient direction KL divergence. Ultimately, through the dynamic adjustment of the curvature parameter, the S-shaped response function can adapt to contrast changes while taking into account the influence of gradient direction offset, achieving comprehensive nonlinear optimization of the threshold.

[0022] The adjustment method for the grayscale value range differentiation benchmark includes: The weights are adjusted based on the grayscale range. The original grayscale range of the defect candidate region is stretched bidirectionally. The lower limit of the range is adjusted by subtracting the product of the weight coefficient and the average grayscale lower limit deviation of the historical batch from the original lower limit. The upper limit of the range is adjusted by adding the product of the weight coefficient and the average grayscale upper limit deviation of the historical batch from the original upper limit. At the same time, an edge gradient magnitude constraint is introduced. Only when the gradient magnitude of a pixel exceeds the adjusted gradient deviation threshold is its grayscale value included in the adjusted candidate region.

[0023] Further explanation is needed regarding the specific implementation of the grayscale value range differentiation benchmark adjustment. After completing the nonlinear compression and expansion of the gradient deviation threshold, the defect identification dynamic adjustment unit 2 also needs to perform adaptive adjustments to the grayscale value range differentiation benchmark. In the production of chip resistors, differences in the purity of epoxy resin, the concentration of resistive slurry, or the intensity of the quality inspection imaging light source in different batches can cause a systematic shift in the grayscale signal of defects. If a fixed grayscale value range differentiation benchmark is used, it is easy to miss the shifted defects or misjudge normal textures. Therefore, it is necessary to combine the grayscale range adjustment weights output by the texture feature difference mapping to implement bidirectional stretching, and introduce edge gradient amplitude constraints to further accurately screen candidate regions. The specific implementation is as follows: The core benchmark parameters for biaxial stretching are clearly defined. The original grayscale range of the defect candidate region is a fixed benchmark obtained by screening real defect samples from normal production batches in the historical batch feature library and statistically analyzing their grayscale distribution 95% confidence interval. The historical batch average grayscale deviation is obtained by calculating the average difference between the defect grayscale range of each batch and the original grayscale range in the reference benchmark set. It is divided into the historical average grayscale lower limit deviation and the historical average grayscale upper limit deviation. These deviation values ​​reflect the fluctuation pattern of the historical normal batch defect grayscale relative to the original range, providing an adjustment basis for biaxial stretching. The specific process of bidirectional stretching revolves around adjusting the grayscale range weights. These weights are parameters used in texture feature difference mapping to quantify the degree of grayscale offset in the current batch. For adjusting the lower limit, the adjusted lower limit is calculated as: Adjusted lower limit = Original lower limit - (Grayscale range adjustment weight × Historical average grayscale lower limit deviation). By correcting the lower limit upwards, high-grayscale offset defects are avoided from being missed. For adjusting the upper limit, the adjusted upper limit is calculated as: Adjusted upper limit = Original upper limit + (Grayscale range adjustment weight × Historical average grayscale upper limit deviation). By correcting the upper limit downwards, high-grayscale offset defects are covered. Ultimately, bidirectional stretching of the original grayscale range is achieved, ensuring that the adjusted range completely encompasses the true defect grayscale distribution of the current batch. To avoid mistakenly including pixels with grayscale values ​​within the adjusted range but actually normal textures in the defect candidate region, edge gradient magnitude constraints need to be introduced simultaneously. Gradient magnitude constraint means that a pixel's grayscale value is only included in the adjusted defect candidate region when the gradient magnitude of the pixel reflects the degree of grayscale change between the pixel and its surrounding pixels and exceeds the gradient deviation threshold adjusted nonlinearly as mentioned above. Through dual screening of grayscale and gradient, interference from normal textures is eliminated. In specific implementation, the gradient magnitude of each pixel in the high-resolution grayscale image is first calculated. The gradient magnitude is obtained by calculating the horizontal and vertical gradients using the Sobel operator and taking the square root of the sum of their squares. Then, the adjusted gradient deviation threshold is retrieved. Finally, all pixels within the adjusted grayscale range are traversed, and only pixels with a gradient magnitude greater than 22 are retained as the final defect candidate pixels. This ensures that the defect candidate region only contains potential defect pixels that simultaneously satisfy grayscale and gradient characteristics, significantly reducing the misjudgment probability of the subsequent AI defect recognition unit 3.

[0024] The processing procedure of the convolutional neural network model in AI defect recognition unit 3 specifically includes: A high-resolution grayscale image is input into a shared feature extraction network, and its output feature map is input into two parallel branches. The first branch receives the adjusted gradient deviation threshold and generates an edge intensity mask through a differentiable binarization module. The second branch receives the adjusted grayscale value range and filters candidate defect regions through a region truncation function. The outputs of the two branches are concatenated in the feature space, weighted by a texture clutter compensation vector, and then input into a spatial pyramid pooling module. The pooled features are output as the class probability of small defects through a multi-scale defect classification head.

[0025] Further explanation is needed regarding the specific implementation of the AI ​​defect recognition unit's convolutional neural network model. After the defect recognition dynamic adjustment unit 2 completes the nonlinear optimization of the gradient deviation threshold and the bidirectional stretching of the grayscale value range, the AI ​​defect recognition unit 3 needs to use the convolutional neural network model to accurately extract and classify defect features from the high-resolution grayscale image of the chip resistor. This not only allows for the unified extraction of general image features but also enables targeted focus on two key defect signals: gradient and grayscale. Furthermore, by optimizing feature representation through compensation and pooling, the system ultimately achieves efficient identification of minute defects. The specific implementation method is as follows: A high-resolution grayscale image is input into a shared feature extraction network (SMR), a fundamental feature extraction module of convolutional neural networks. Its core function is to extract general-purpose low-level features such as texture, edges, and contours from the original grayscale image, avoiding the computational waste caused by repeated extraction of the same features in subsequent dual branches. This network consists of 5 convolutional layers and 3 max-pooling layers. The first three convolutional layers use 3×3 kernels (32, 64, and 128 kernels respectively), employing the ReLU activation function to enhance non-linear expression and capture detailed textures. The last two convolutional layers use 5×5 kernels (256 kernels each), focusing on extracting more macroscopic regional features. A 2×2 max-pooling layer is added after every two convolutional layers to reduce the feature map dimensionality, preserve key features, and suppress overfitting. Finally, the shared feature extraction... The network output feature map (height × width × number of channels) with dimensions of 64×64×256 is taken. This feature map contains both general low-level information of the image and provides basic feature support for subsequent dual-branch specialized processing. After the shared feature map is generated, it is input into two parallel branches for specialized feature optimization. The first branch receives the adjusted gradient deviation threshold output by the defect recognition dynamic adjustment unit 2 and generates an edge intensity mask through the differentiable binarization module. The differentiable binarization module is a binarization processing module that can realize gradient backpropagation during training. Unlike the traditional non-differentiable hard binarization, it can simulate the binarization process through a smoothing function to ensure that the model is trainable. Its core function is to convert continuous edge intensity values ​​into a 0-1 binary mask, highlighting the effective defect edges and suppressing background texture interference. The specific generation process of the edge intensity mask is as follows: Edge intensity is calculated for the edge feature channels in the shared feature map. The Sobel operator is used to calculate the gradient values ​​of each pixel in the horizontal and vertical directions. The square root of the sum of these two squares is taken as the edge intensity of that pixel. The edge intensity is compared with an adjusted gradient deviation threshold. A smoothing function from the differentiable binarization module is applied. Pixels with edge intensities exceeding the threshold are mapped to 1, representing defect edges; pixels with intensities below the threshold are mapped to 0, representing normal texture or background. A 3×3 morphological closing operation is performed on the generated preliminary binary image to fill in minor breaks in the edges, resulting in an edge intensity mask with the same number of channels as the edge feature channels. This mask retains only defect edge features that meet the gradient threshold requirements, significantly reducing interference from normal texture edges. The second branch receives the adjusted grayscale value range and filters candidate defect regions using a region truncation function. This function filters pixel values ​​in the feature map based on grayscale range. Its core function is to suppress pixel signals in the shared feature map whose grayscale values ​​are outside the adjusted range, retaining only grayscale regions that may contain defects. The specific filtering process is as follows: First, gray-level related feature channels are extracted from the shared feature map. The first three convolutional layers of the shared feature extraction network output 128 channels, which focus more on gray-level details. Then, the gray-level value of each 64×64 pixel is judged. If the original image gray-level value corresponding to the pixel is within the adjusted gray-level range, the original value of that pixel in the feature channel is retained; otherwise, the pixel value is set to 0, trunculating redundant signals. This feature map only focuses on areas where the gray-level conforms to defect features, narrowing the target range for subsequent classification. After completing the dual-branch processing, the outputs of the two branches need to be concatenated in the feature space. The core of channel concatenation is to merge the feature maps of the two branches according to the channel dimension, achieving complementary fusion of gradient edge features and gray-level region features. The specific process is as follows: The edge intensity mask output by the first branch has a dimension of 64×64×64, and the candidate defect region feature map output by the second branch has a dimension of 64×64×128. When stitching, the height (64) and width (64) of the feature map are kept unchanged, and only the number of channels is superimposed, finally obtaining a fused feature map of 64×64×(64+128)=64×64×192. This stitching method allows subsequent modules to simultaneously obtain the edge contour and gray distribution information of the defect, avoiding defect misjudgment caused by a single feature. After the fused feature map is generated, it needs to be optimized by weighted optimization of the texture messiness compensation vector. The texture messiness compensation vector is a one-dimensional vector generated according to the texture messiness compensation factor in the texture feature difference mapping. The dimension is consistent with the number of channels of the fused feature map. Its core function is to strengthen the defect-related features and suppress the redundant features caused by texture messiness by dynamically adjusting the weight of different feature channels. The specific weighting process is as follows: First, the texture clutter compensation factor is input into a pre-defined 1-layer fully connected network with 192 neurons. This network outputs 192 weight values ​​based on the compensation factor, forming a texture clutter compensation vector. Then, each channel of the fused feature map is multiplied pixel-by-pixel by the corresponding weight value in the compensation vector. This weighting method highlights the signal strength of the defect feature channel while weakening the interference of cluttered texture channels. The optimized fused feature map better meets the needs of defect recognition. The weighted fused feature map is then input into a spatial pyramid pooling module. The spatial pyramid pooling module is a pooling module that can extract features at multiple scales. Its core advantage is that it breaks the limitation of traditional pooling, which can only obtain features at a single scale, by using pooling kernels of different sizes. To capture defects of different sizes, this module includes three parallel pooling branches. The first branch uses a 4×4 pooling kernel to pool a 64×64 feature map, outputting a 16×16×192 feature map, corresponding to large-sized defects. The second branch uses an 8×8 pooling kernel, outputting an 8×8×192 feature map, corresponding to medium-sized defects. The third branch uses a 16×16 pooling kernel, outputting a 4×4×192 feature map, corresponding to small-sized defects. The pooling results of the three branches are flattened into one-dimensional vectors, resulting in 16×16×192=49152 dimensions, 8×8×192=12288 dimensions, and 4×4×192=3072 dimensions respectively. These vectors are then sorted by dimension. The features are concatenated in order of degree to form a multi-scale feature vector with a total dimension of 49152 + 12288 + 3072 = 64512. This vector fully covers the feature information of defects from small to large sizes, providing comprehensive feature support for subsequent classification. Finally, the pooled multi-scale feature vector outputs the class probability of small defects through a multi-scale defect classification head. The multi-scale defect classification head is a classification module of a convolutional neural network, employing fully connected layers and a multi-class output structure. It can distinguish different defect types of sheet resistors based on the multi-scale feature vector. This classification head contains two fully connected layers and one output layer. The first fully connected layer contains 1024 neurons, compressing the 64512-dimensional multi-scale feature vector to 1024 dimensions. The ReLU activation function enhances the nonlinear classification capability. The second fully connected layer contains 256 neurons, further compressing the feature vector to 256 dimensions and focusing on core classification features. The output layer uses the softmax activation function to map the 256-dimensional feature vector to probability values ​​corresponding to 5 categories. The sum of the probabilities of all categories is 1. The specific output process of the category probability is as follows: the softmax function calculates the similarity ratio between the feature of each category and the total features, indicating that the model determines that the resistor has a micron-level scratch defect. At the same time, to ensure the reliability of classification, the output probability value will be accompanied by a feature source identifier, which is convenient for subsequent tracing of the classification basis. Finally, the entire process from image input to defect category probability output is completed.

[0026] The methods for outputting classification results include: A dynamic confidence threshold is applied to the category probability. This threshold is generated by mapping the magnitude of the texture feature difference mapping vector using the Sigmoid function. At the same time, a defect spatial distribution consistency verification mechanism is constructed. When the number of defect points identified on a single resistor surface exceeds the preset number and the spatial distribution conforms to the texture direction, a secondary verification process is triggered. This involves comparing the cosine similarity of the candidate region features with the normal texture templates at the same position in the historical batch feature library. Only when the similarity is lower than the adaptive threshold is it confirmed as a real defect. The final output result includes a parameter traceability identifier.

[0027] Further explanation is needed regarding the specific implementation method of the AI ​​defect recognition unit's classification result output. After the convolutional neural network model of AI defect recognition unit 3 outputs the category probability of micro-defects in the chip resistor, relying solely on a single category probability may lead to misjudgment due to batch texture differences. Therefore, it is necessary to further improve the reliability of the results through dynamic confidence threshold screening, defect spatial distribution consistency verification, and secondary verification processes. Finally, an accurate classification result with parameter traceability identification is output. The specific implementation method is as follows: A dynamic confidence threshold is applied to the category probability. This dynamic confidence threshold is a judgment threshold that is dynamically adjusted based on the difference in texture features between the current batch and historical batches. Unlike a fixed threshold, its core advantage is that it can adapt the judgment strictness according to the degree of texture difference. The greater the texture difference, the higher the threshold to avoid false positives; the smaller the texture difference, the lower the threshold to avoid false negatives. The specific generation process of this threshold revolves around the texture feature difference mapping vector. First, the multi-dimensional difference mapping vector is retrieved to calculate the magnitude of the vector, which is the square root of the sum of the squares of the values ​​of each dimension of the vector. This reflects the overall degree of texture difference between the current batch and historical batches. The larger the magnitude, the more significant the difference. Then, the magnitude is input into the Sigmoid function for mapping. The gmoid function is a non-linear function that maps values ​​to the 0-1 range, ensuring that the threshold is always within a reasonable judgment range. A dynamic confidence threshold is generated, and this dynamic threshold is then used to filter category probabilities. If the probability of a defect category exceeds the dynamic threshold, it is initially classified as a candidate defect. If the probabilities of all categories are below the threshold, it is classified as requiring further verification, avoiding direct output of uncertain results. To eliminate misjudgments of isolated defect points, a defect spatial distribution consistency verification mechanism needs to be constructed simultaneously. The spatial distribution of real defects is usually continuous and does not completely deviate from the direction of normal textures, while misjudged isolated points are often few in number and randomly distributed. The specific construction and implementation process is as follows: A preset value for the number of defect points was determined. By statistically analyzing historical real defect samples, it was found that a real defect on a single resistor surface typically contains at least 5 consecutive defect points. Here, a defect point refers to a pixel region that the model identifies as a defect, with each region corresponding to 10×10 pixels in the original image. Therefore, the preset number was set to 5. That is, when the number of defect points identified on a single resistor surface is less than or equal to 5, it is not considered a real defect and further verification is needed based on the distribution. This involves determining whether the spatial distribution of defect points conforms to the texture direction, retrieving the edge gradient direction distribution characteristics of the resistor surface, statistically analyzing the edge gradient direction angles of all defect points, and calculating the deviation of these direction angles from the normal texture direction angles. If the direction angle deviation of more than 80% of the defect points is less than 5, the defect is considered a real defect. If the defect distribution is consistent with the texture direction, then the distribution is considered to meet the consistency requirement. If the deviation is greater than 1 / 3, the distribution is considered to meet the consistency requirement. The percentage of defects exceeds If the distribution is messy, it may be noise, and therefore the judgment is not valid. When the number of defect points is greater than the preset number and the spatial distribution conforms to the texture direction, a secondary verification process is triggered. Otherwise, the candidate defects initially judged are marked as suspected misjudgments, and no results are output for the time being. The secondary verification process achieves accurate judgment by comparing the cosine similarity between the candidate region features and the normal texture templates at the same position in the historical batch feature library. Cosine similarity is an indicator that measures the similarity between two feature vectors. The specific process is as follows: The physical location of candidate regions on the resistor surface is determined. Based on the coordinates of candidate defect regions output by the convolutional neural network, normal texture feature templates with the same resistor model and physical location are selected from the historical batch feature library. The historical library stores normal texture feature vectors for different locations of resistor models. Each template is a 128-dimensional feature vector, including features such as gray-level co-occurrence matrix and edge direction. The feature vector of the current candidate region is extracted. The high-resolution grayscale image of the candidate region is recalculated into a 128-dimensional feature vector according to the feature dimensions of the historical templates to ensure consistency with the template dimensions for easy comparison. The cosine similarity between the current candidate feature vector and the historical normal template vector is calculated using the vector dot product formula. An adaptive threshold is set and compared. The adaptive threshold is a dynamic threshold determined based on the statistical value of the cosine similarity between normal texture and defect texture in the historical batch. By analyzing the similarity between historical normal and defective samples, the minimum similarity of normal samples is taken as the adaptive threshold. That is, when the cosine similarity between the current candidate region and the normal template is less than the adaptive threshold, it is confirmed as a real defect. If it is greater than or equal to the adaptive threshold, it is judged as a misjudgment of normal texture and the candidate defect is removed. After completing all verification processes, the final output classification result must be accompanied by a parameter traceability label. The parameter traceability label is an information label that records the key parameters in the classification process, which facilitates subsequent quality traceability and parameter optimization. The label content specifically includes the generation basis of the dynamic confidence threshold, the key data of defect spatial distribution verification, the core parameters of secondary verification, and the parameter version of the convolutional neural network model. This not only clarifies the defect type, but also completely retains the key parameters of the judgment process, providing support for the traceability of supply chain quality inspection and model iterative optimization.

[0028] In this invention, the texture feature adaptive unit 1 extracts the texture density, contrast, and edge gradient direction distribution of the grayscale image of the sheet resistor in real time, and dynamically compares it with the historical batch feature library to generate a texture feature difference mapping. The defect identification dynamic adjustment unit 2 adjusts the gradient deviation threshold nonlinearly through the S-shaped response function based on the difference mapping, bidirectionally stretches the grayscale value range, and injects a texture disorder compensation vector. The AI ​​defect identification unit 3 uses a convolutional neural network, and outputs the defect classification result through parallel branch processing, spatial pyramid pooling, and secondary verification. The control output unit 4 transmits the result to the execution mechanism, records the batch switching parameters, solves the problem of misjudgment and omission caused by batch texture fluctuation, and improves the quality inspection accuracy.

[0029] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. An AI-based intelligent quality inspection and defect identification system for the supply chain, characterized in that, include: The texture feature adaptive unit (1) is used to extract texture feature parameters of the high-resolution grayscale image of the surface of the current production batch of chip resistors in real time, including texture density, contrast and edge gradient direction distribution, and to make dynamic comparisons based on the preset historical batch feature library, wherein the historical batch feature library stores texture benchmark data of multiple historical batches, which is accumulated through offline training and online updating to generate texture feature difference mapping. The defect identification dynamic adjustment unit (2) is used to adaptively adjust the gradient deviation threshold and gray value range of the defect identification model according to the texture feature difference mapping. The gradient deviation threshold is nonlinearly compressed or expanded according to the batch texture contrast change to solve the problem of small defects and texture confusion caused by batch texture density and contrast fluctuation. The AI ​​defect recognition unit (3) adopts a convolutional neural network model, inputs the adjusted gradient deviation threshold and gray value range, and outputs the classification results of minor defects; The control output unit (4) is used to transmit the classification results to the quality inspection line actuator and record the adaptive parameter changes during batch switching to reduce downtime adjustment time.

2. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 1, characterized in that: The extraction methods for texture density, contrast, and edge gradient direction distribution in the texture feature adaptive unit (1) include: Texture enhancement of high-resolution grayscale images is achieved through multi-scale Gaussian difference filtering. In the enhanced image, an adaptive grid segmentation method is used to divide the resistive surface into several sub-regions. The energy entropy of the gray-level co-occurrence matrix is ​​calculated in each sub-region to quantify the texture density. The ratio of the maximum gray-level difference to the average gray-level in the sub-region is calculated based on the local gray-level extreme value difference algorithm as the contrast. The edge response of each sub-region is captured by a direction-adjustable Gabor filter bank. The direction angle distribution of edge line segments is detected by combining Hough transform. Finally, the mean variance of the direction angle of the edge line segments in each sub-region is used as the edge gradient direction distribution feature.

3. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 2, characterized in that: The construction method of directional tunable Gabor filter banks specifically includes: Based on the statistical range of texture density in the historical batch feature library, the center frequency and bandwidth ratio of the filter are dynamically set to cover the spatial frequency spectrum of typical textures. The filter orientation angle is rotated at preset angle intervals to generate multi-channel responses. The response intensity of each channel output is suppressed by non-maximum to generate an edge orientation map. The calculation of edge gradient orientation distribution features further introduces an orientation consistency verification mechanism to remove edge segments with lengths below a preset threshold, and only retain the orientation angles of continuous edges to participate in the variance calculation.

4. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 1, characterized in that: Specific methods for dynamic comparison based on a pre-defined historical batch feature database include: The texture density, contrast, and edge gradient direction distribution feature vectors extracted from the current batch are matched with all records in the historical batch feature library using Euclidean distance. Several historical batches with the smallest distance are selected as reference benchmark sets. After dimensionality reduction using principal component analysis, the projection residuals of the current batch features in the space spanned by the reference benchmark set are constructed. The difference in texture features between batches is quantified by the residual modulus. At the same time, the KL divergence between the edge gradient direction distribution of the current batch and the reference benchmark set is calculated to evaluate the offset of the gradient direction statistical characteristics.

5. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 1, characterized in that: The process of generating texture feature difference maps specifically includes: The texture feature difference degree and gradient direction KL divergence are input into the pre-trained difference transformation model, which is constructed by the deep forest algorithm. Its input layer receives multidimensional difference indicators, and the hidden layer learns the association rules between the difference indicators and the parameter adjustment of the defect identification model through hierarchical decision tree combination. The output layer generates a multidimensional difference mapping vector containing gradient deviation threshold offset coefficient, gray range adjustment weight and texture disorder compensation factor. The offline training of the historical batch feature library uses semi-supervised clustering to accumulate initial data. When updating online, the feature library incremental learning is triggered by the misjudged samples fed back by the output unit (4).

6. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 1, characterized in that: The adaptive adjustment of the defect identification dynamic adjustment unit (2) specifically includes: Based on the gradient deviation threshold offset coefficient in the texture feature difference mapping, the preset gradient deviation benchmark threshold is dynamically scaled. At the same time, the weights are adjusted according to the gray range. The lower and upper limits of the gray value range of the defect candidate region are multiplied by the corresponding weight coefficients. For the output texture disorder compensation factor, a compensation vector is injected into the feature fusion layer of the defect recognition model. This vector maps the compensation factor into feature channel attention weights through a fully connected network.

7. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 6, characterized in that: The gradient deviation threshold is non-linearly compressed or expanded based on batch texture contrast variations, specifically including: An S-shaped response function is established with batch texture contrast as the independent variable and threshold scaling ratio as the dependent variable. When the contrast of the current batch is higher than that of the reference batch, the output value of the response function increases logarithmically with the increase of the contrast difference, thus achieving threshold expansion. When the contrast is lower than that of the reference batch, the output value of the response function decreases exponentially with the increase of the difference, thus achieving threshold compression. The curvature parameter of the response function is dynamically adjusted by the KL divergence in the gradient direction.

8. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 6, characterized in that: The adjustment method for the grayscale value range differentiation benchmark includes: The weights are adjusted based on the grayscale range. The original grayscale range of the defect candidate region is stretched bidirectionally. The lower limit of the range is adjusted by subtracting the product of the weight coefficient and the average grayscale lower limit deviation of the historical batch from the original lower limit. The upper limit of the range is adjusted by adding the product of the weight coefficient and the average grayscale upper limit deviation of the historical batch from the original upper limit. At the same time, an edge gradient magnitude constraint is introduced. Only when the gradient magnitude of a pixel exceeds the adjusted gradient deviation threshold is its grayscale value included in the adjusted candidate region.

9. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 1, characterized in that: The processing procedure of the convolutional neural network model in the AI ​​defect identification unit (3) specifically includes: A high-resolution grayscale image is input into a shared feature extraction network, and its output feature map is input into two parallel branches. The first branch receives the adjusted gradient deviation threshold and generates an edge intensity mask through a differentiable binarization module. The second branch receives the adjusted grayscale value range and filters candidate defect regions through a region truncation function. The outputs of the two branches are concatenated in the feature space, weighted by a texture clutter compensation vector, and then input into a spatial pyramid pooling module. The pooled features are output as the class probability of small defects through a multi-scale defect classification head.

10. The AI-based intelligent quality inspection and defect identification system for supply chains according to claim 9, characterized in that: The methods for outputting classification results include: A dynamic confidence threshold is applied to the category probability. This threshold is generated by mapping the magnitude of the texture feature difference mapping vector using the Sigmoid function. At the same time, a defect spatial distribution consistency verification mechanism is constructed. When the number of defect points identified on a single resistor surface exceeds the preset number and the spatial distribution conforms to the texture direction, a secondary verification process is triggered. This involves comparing the cosine similarity of the candidate region features with the normal texture templates at the same position in the historical batch feature library. Only when the similarity is lower than the adaptive threshold is it confirmed as a real defect. The final output result includes a parameter traceability identifier.

Citation Information

Cited By

  • Online detection method for surface defects of semiconductor equipment shell

    CN122175978A