A few-sample method for detecting surface defects in inductor cores based on model interaction
By using a dual-model interactive optimization framework that combines unsupervised statistical models and supervised semantic segmentation models, the problem of sample scarcity in inductor core surface defect detection is solved, achieving high-precision and low-cost defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG UNIV OF TECH
- Filing Date
- 2026-01-13
- Publication Date
- 2026-05-26
AI Technical Summary
In the detection of surface defects in inductor cores, existing technologies face the problems of insufficient generalization ability of unsupervised statistical models due to the scarcity of defect samples and the tendency of supervised deep learning models to overfit, making it difficult to meet the requirements of high-precision detection.
A dual-model interactive optimization framework is constructed, which enables interactive learning between an unsupervised statistical model and a supervised semantic segmentation model. Through iterative optimization, the unsupervised model generates pseudo-labels to expand the training data, while the supervised model provides accurate defect localization, thereby achieving mutual calibration and optimization of model parameters.
Achieving high-precision detection with very few labeled samples significantly reduces data preparation costs, shortens system deployment cycles, and improves detection accuracy and robustness.
Smart Images

Figure CN121504928B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine vision and industrial defect detection technology, specifically relating to a few-sample inductor core surface defect detection method based on model interaction. Background Technology
[0002] With the development of the electronic component manufacturing industry, the quality and reliability of inductor cores, as crucial components in electronic devices, are particularly critical. During the production process, inductor cores may exhibit various surface defects such as cracks, chipping, porosity, and exposed copper wires in the coil. These defects can range from minor issues affecting inductor performance (e.g., causing magnetic circuit discontinuities, decreased permeability, and increased magnetic losses) to serious safety accidents such as short circuits, overheating, or even fires. Therefore, defect detection on the surface of inductor cores is of great significance.
[0003] Currently, defect detection on the surface of inductor cores mainly relies on manual visual inspection or traditional machine vision for defect screening. While manual methods are flexible, they are limited by fatigue, subjective experience, and slow speed, making it difficult to guarantee consistent results and meet the efficiency requirements of large-scale production. Traditional machine vision methods require engineers to manually design textures, grayscale, or geometric features, and their adaptability to changes in lighting, processes, and product types is limited. Once a new, unseen defect morphology appears or the shooting conditions change, the detection performance drops significantly. Meanwhile, the success of deep learning in image recognition has provided a new opportunity for automated defect detection. Convolutional neural networks can automatically extract discriminative features during end-to-end training, thereby achieving rapid and accurate differentiation between normal and defective areas and significantly reducing the false negative rate.
[0004] However, deep learning methods heavily rely on a large number of high-quality labeled samples to train stable models. In inductor core defect detection, acquiring and accumulating defect samples faces numerous difficulties. Some rare defect types may only have a handful of samples available for training, which is insufficient to meet the data requirements of deep networks. Furthermore, finely labeling the boundaries of defects such as cracks and pores requires professionals to delineate them pixel by pixel, which is costly and time-consuming, further exacerbating the problem of insufficient training data. Under conditions of few samples, deep learning models struggle to fully learn the complete distribution of defect features, are prone to overfitting to limited training sets, and lack generalization ability for unseen defect morphologies. This makes traditional supervised deep learning solutions inadequate for practical detection needs.
[0005] In contrast, unsupervised defect detection does not require defect labels. Instead, it identifies defect regions by statistically modeling a large number of defect-free samples, giving it a natural advantage in scenarios with scarce samples. Algorithms based on probability distributions, generative adversarial mechanisms, or autoencoders have been proven to detect defects under low-contrast, small-sized defect conditions. However, these methods typically only provide coarse defect localization and are susceptible to interference from lighting and complex background textures, resulting in a high false alarm rate. More importantly, because they rely solely on the statistical characteristics of normal samples, their generalization ability is significantly insufficient when faced with diverse defect morphologies on inductor core surfaces, and they struggle to generate accurate defect contours. Summary of the Invention
[0006] To overcome the shortcomings of existing technologies, this invention aims to provide a method for detecting surface defects in inductor cores with few samples based on model interaction. Addressing the issues of insufficient generalization ability of unsupervised statistical models and overfitting of supervised deep learning models due to the scarcity of defect samples, this invention constructs a dual-model interactive optimization framework. This framework involves interactive learning between an unsupervised statistical model and a supervised semantic segmentation model. Through mutual verification and iterative optimization of the two models, it not only solves the fundamental problem of scarce defect data and significantly reduces the cost of manual annotation, but also enables continuous iterative optimization, thereby continuously improving detection accuracy and robustness.
[0007] To achieve the above objectives, the present invention may adopt the following specific technical solutions:
[0008] The aforementioned model-interaction-based method for detecting surface defects in inductor cores using few samples includes the following steps:
[0009] Step 1: Data acquisition and image preprocessing, constructing three types of sample datasets: normal samples, labeled samples, and unlabeled samples;
[0010] Step 2: Input defect-free inductor core image samples and construct an unsupervised statistical model based on statistical learning;
[0011] Step 3: Construct a supervised semantic segmentation model using labeled images of normal and defective inductor cores;
[0012] Step 4: Simultaneously input the image of the inductor core to be detected into both the unsupervised statistical model and the supervised semantic segmentation model for processing to generate segmentation results;
[0013] Step 5: Compare the binarized segmentation map of the unsupervised model with the pixel mask of the supervised model, and quantify the difference in detection results;
[0014] Step 6: Update the parameters of the unsupervised statistical model;
[0015] Step 7: Generating pseudo-labels based on unsupervised statistical models;
[0016] Step 8: Update the weights of the supervised semantic segmentation model;
[0017] Step 9: Input the batch of images to be detected processed in Step 7 into the unsupervised statistical model updated in Step 6 and the supervised semantic segmentation model in Step 8 to obtain the detection results, and calculate the system performance index based on the consistency analysis of the two models.
[0018] Furthermore, the specific steps for constructing the unsupervised statistical model in step 2 are as follows:
[0019] Step 2.1 Feature extraction and representation: For each pixel position in the normal inductor core image The surface texture features are extracted using a local binary mode; and feature vectors are constructed by combining multi-scale neighborhood information of pixels, and the feature vectors of all normal sample pixels are normalized.
[0020] Step 2.2 Statistical distribution parameter learning: The distribution parameters of the Gaussian mixture model are learned using the expectation-maximization algorithm.
[0021] Furthermore, in step 3, the DeepLabV3+ architecture is used as the supervised semantic segmentation model. First, the labeled inductor core image is input into the improved Xception as the backbone network. The encoder extracts features through depthwise separable convolutions, progressively extracting multi-level features in three stages: the input stage (Entry Flow), the middle stage (Middle Flow), and the output stage (Exit Flow). At the end of the encoder, an ASPP module is introduced, containing a 1×1 convolution, three 3×3 dilated convolutions with different dilation rates, and a global average pooling branch. Then, the decoder restores the ASPP output to the original value through bilinear upsampling. Figure 1 / 4 resolution, and fused with low-level features of the encoder; during the training phase, the supervised semantic segmentation model adopts a combined loss function, combining binary cross-entropy loss and Dice loss.
[0022] Furthermore, in step 4, thresholding is performed on all pixel positions in the image to obtain an unsupervised model binary segmentation map; and binarization is performed on all pixel positions in the image to obtain a supervised model mask map.
[0023] Further, in step 5, for the same image to be detected, the binarized segmentation map generated by the unsupervised statistical model and the mask map generated by the supervised semantic segmentation model are compared, and the intersection-union ratio (IUGR) is calculated to quantify the degree of overlap between the detection results of the two models. A three-level conditional branch decision is executed based on the comprehensive similarity S: when S≥0.75, it is determined that the two models have reached a high degree of consensus, and the image and mask are added to the supervised model training set for weight updates. Simultaneously, samples confirmed as normal by both models are selected, and their features are fed into the unsupervised model to update the GMM parameters, optimizing the statistical distribution benchmark of normal features; when 0.5≤S < 0.75, it is determined that there is a moderate difference, and the image is sent to the manual review queue for confirmation and feedback to the corresponding model optimization; when S < 0.5, it is determined that there is a significant divergence, and such samples are not included in this round of model updates.
[0024] Furthermore, the specific operation of step 6 is as follows:
[0025] Step 6.1 High-confidence normal sample expansion: Collect inductor core images that are confirmed as normal by both models from the conditional branching process. Use pixel-level feature extraction process on these images to calculate the LBP value of each pixel and construct feature vectors by combining multi-scale neighborhood information. After normalization, a new set of normal features is obtained.
[0026] Step 6.2 GMM parameter update: Merge the newly added normal feature set with the original normal training set to form an expanded normal sample training set, and update the GMM parameters using the EM algorithm.
[0027] Furthermore, the specific operation of step 7 is as follows:
[0028] Step 7.1 New batch of image defect detection: Input the new batch of inductor core images to be detected into the unsupervised statistical model updated in Step 6, perform the detection process for each image, namely extract LBP features, calculate the log likelihood score of each pixel under the GMM model, generate a defect probability map, and perform binarization based on the optimized detection threshold to obtain preliminary detection results.
[0029] Step 7.2 Pseudo-label generation and dataset expansion: Based on the detection results of the unsupervised model, a corresponding pixel-level pseudo-label mask is generated for each image; where the pseudo-label mask for normal images is all 0, and the pseudo-label mask for defective images has 255 for defective areas and 0 for normal areas.
[0030] Furthermore, the specific operation of step 8 is as follows:
[0031] Step 8.1 Construct a training dataset containing two sources: one is the highly consistent samples with a comprehensive similarity S≥0.75 from Step 5, which are assigned a weight w=1.0; the other is the pseudo-label samples generated in Step 7, including normal samples and defective samples, which are assigned a weight w=0.8; the two types of data are mixed in an 8:2 ratio.
[0032] Step 8.2 Update the weights of the supervised semantic segmentation model using a fine-tuning strategy.
[0033] Furthermore, through the iterative mechanism of steps 5→6→7→8→9, the unsupervised statistical model and the supervised semantic segmentation model achieve interactive optimization. The unsupervised model generates pseudo-labels to expand the training set, and the supervised model reversely calibrates the statistical features, forming a virtuous cycle of mutual verification.
[0034] Compared with the prior art, the present invention has the following advantages:
[0035] This invention proposes a dual-model interactive optimization mechanism to address the performance limitations of a single model in scenarios with few samples. It captures the feature distribution of normal samples through unsupervised statistical modeling and automatically generates pseudo-labels to alleviate the scarcity of labeled data. A supervised semantic segmentation model provides accurate defect localization capabilities based on limited labeled samples. The two models achieve mutual parameter calibration through difference quantization and mutually verify and optimize each other during iteration. This interactive method retains the robust modeling capability of unsupervised methods for normal patterns while leveraging the precise segmentation advantages of supervised learning. It achieves high-precision detection even with very few labeled samples, significantly reducing data preparation costs and shortening system deployment cycles, providing an economical and efficient technical solution for inductor core quality control. Attached Figure Description
[0036] Figure 1 This is a flowchart of the model-interaction-based few-sample inductor core surface defect detection method of the present invention;
[0037] Figure 2 This is a top view of the inductor core image acquisition device of the present invention;
[0038] Figure 3 This is a schematic diagram of the camera module of the inductive magnetic core acquisition device of the present invention, wherein (a) is a diagram of the acquisition device on the top surface of the electromagnetic magnetic core, (b) is a diagram of the acquisition device on the bottom surface of the electromagnetic magnetic core, and (c) is a diagram of the acquisition device on the side surface of the electromagnetic magnetic core. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0040] like Figure 1 As shown, the few-sample inductor core surface defect detection method based on model interaction includes the following steps:
[0041] (a) Step S1: Data acquisition and image preprocessing, constructing three types of sample datasets: normal samples, labeled samples, and unlabeled samples.
[0042] S1.1 Image Acquisition
[0043] A multi-camera synchronous acquisition system for imaging the surface of an inductor core was constructed to acquire images of all six sides of the inductor core. The system mainly consists of six high-resolution industrial cameras, a ring LED light source, a transparent glass turntable, optical prisms, and an image acquisition and control unit.
[0044] The inductor core surface imaging system adopts a ring-shaped symmetrical layout design, such as... Figure 2 The diagram illustrates the spatial configuration of multiple cameras. In the figure, AF represents six high-resolution industrial cameras, evenly distributed at 60° intervals. Cameras A and D are located above and below the transparent glass turntable, respectively, capturing images of the top and bottom surfaces of the inductor core. Cameras B, C, E, and F are horizontally distributed around the turntable, each capturing an image of one side of the inductor core, achieving full surface coverage. The transparent glass turntable, labeled G, uses optical-grade glass to provide stable support while ensuring that camera D at the bottom can clearly image through it.
[0045] To achieve optimal imaging results from different angles, the inductor core surface imaging system is designed with three camera configurations, the specific structures of which are as follows: Figure 3 As shown. Figure 3 1 is a high-resolution industrial camera, 2 is a ring LED light source, 3 is a transparent glass turntable, 4 is an inductive magnetic core, and 5 is an optical prism. The three devices are as follows: Figure 3 The top surface acquisition device shown in (a) is as follows: Figure 3 The bottom surface acquisition device shown in (b) and as shown in the figure Figure 3 The side acquisition device is shown in (c). In the top acquisition device, the camera is mounted vertically downwards, and uniform illumination from a ring light source achieves optimal imaging of the top surface of the inductor core. In the bottom acquisition device, the camera is positioned below the turntable, and clear imaging of the bottom surface of the inductor core is achieved through transparent glass and a ring light source. In the side acquisition device, the camera is mounted at an angle, and optimal imaging angle for the sides of the inductor core is achieved through prism refraction and a ring light source. Each camera is fixed by an adjustable bracket to ensure precise focusing when the inductor core is rotated to the shooting position.
[0046] In the actual data acquisition process, point calibration is first performed to determine the parameters for rotating the inductor core to the optimal imaging position for each camera. During acquisition, the inductor core is placed on a circular track of a transparent glass turntable and rotates at a constant speed with the turntable. When the inductor core rotates to the preset position of each camera, the image is automatically triggered. After one rotation, a complete image of all six sides is obtained. A ring-shaped LED light source provides constant illumination throughout the acquisition process, effectively eliminating shadows and reflections to ensure consistent image quality. The entire acquisition process is automated, efficiently completing full-surface imaging of a single inductor core.
[0047] S1.2 Image Preprocessing
[0048] The acquired raw images were preprocessed to unify the data format and optimize image quality. First, size unification was performed by centering the images to 512×512 pixels using a center-cropping strategy. Edge detection was used to locate the inductor core region, and the target-size image was extracted with the inductor core center as the cropping center, ensuring the inductor core remained intact within the field of view. Second, grayscale equalization was performed using a contrast-limited adaptive histogram equalization algorithm, dividing the image into several sub-blocks for independent processing to mitigate the effects of uneven illumination and enhance local contrast. Finally, interference removal was implemented to eliminate the influence of small blemishes on the lens or glass turntable. A morphology-based fixed-pattern noise removal algorithm was used to eliminate point-like interference on non-inductor core surfaces through opening operations, while preserving the true defect features of the inductor core surface.
[0049] S1.3 Dataset Construction
[0050] Three types of datasets are constructed based on the preprocessed images. The first type is a normal sample dataset, containing only images of defect-free inductor cores, used for normal feature extraction in the unsupervised model. The second type is a small number of labeled sample datasets, containing a small number of labeled normal and defective inductor core images. Defective regions are precisely labeled at the pixel level and used for the initial training of the semantic segmentation model. The third type is an unlabeled sample test dataset, containing a large number of normal and defective samples, used for model testing and validation and subsequent model interaction.
[0051] (ii) Step S2: Input defect-free inductor core image samples and construct an unsupervised statistical model based on statistical learning.
[0052] This invention employs a statistical learning method based on Gaussian Mixture Model (GMM) to construct an unsupervised defect detection model. GMM is a powerful probability density estimation method that models complex data distributions through a weighted combination of multiple Gaussian distributions, effectively learning the surface features of normal inductor cores. This method requires only normal samples for training, does not rely on defect annotations, and identifies defects by calculating the probability density of new samples, making it particularly suitable for production scenarios with few samples.
[0053] S2.1 Feature Extraction and Representation
[0054] For each pixel position of a normal inductor core image The Local Binary Pattern (LBP) method is used to extract surface texture features. The LBP operator encodes the local surface pattern by comparing the grayscale values of the center pixel with those of its neighboring pixels, effectively describing subtle changes on the surface of the inductor core.
[0055] (1)
[0056] in, The grayscale value of the center pixel. Let P be the gray values of equally spaced sampling points on a radius R. For sign functions: when x≥0 ,otherwise The parameter R controls the neighborhood range, P determines the number of samples, p is the index of the sampling point, and the range is... Go to P-1.
[0057] The LBP operator possesses grayscale invariance and rotation invariance, effectively capturing the microstructural information of the inductor core surface. To enhance feature representation capabilities, feature vectors are constructed by combining multi-scale neighborhood information of pixels:
[0058] (2)
[0059] in, The original grayscale value. and for The mean and standard deviation of gray levels within the neighborhood window. Normalization is performed on the feature vectors of all normal sample pixels.
[0060] (3)
[0061] in, and These are the mean and standard deviation of all features in the training set, respectively.
[0062] S2.2 Learning Statistical Distribution Parameters
[0063] The distribution parameters of a Gaussian mixture model are learned using the Expectation-Maximization (EM) algorithm. The GMM data consists of a mixture of K Gaussian distributions, and its probability density function is expressed as:
[0064] (4)
[0065] Where x is the feature vector to be modeled, and K is the number of Gaussian components, corresponding to the feature distribution of different parts of a normal inductor core (upper surface, lower surface, side surface, etc.); The mixing weights for the k-th component satisfy the following condition: and ; This represents the k-th Gaussian distribution. Let be the mean vector of this component. Covariance matrix; parameter set The statistical properties of the surface features of a normal inductor core are fully described.
[0066] The Expectation-Maximization (EM) algorithm is used to iteratively optimize the model parameters. This algorithm maximizes the log-likelihood function of the observed data by alternately executing the E-step and M-step. Specifically:
[0067] E-step (expectation step): Calculates the expected value for each sample given the current parameters. Posterior probability of belonging to the k-th component:
[0068] (5)
[0069] in, The responsibility of generating the nth feature sample from the kth Gaussian component is represented, reflecting the degree of correlation between the sample and each component.
[0070] M-step (maximization step): Updates the parameters of each component based on the posterior probability.
[0071] (6)
[0072] (7)
[0073] (8)
[0074] Where N is the total number of training samples, that is, the total number of pixels in all normal inductor cores.
[0075] The algorithm repeats the E-step and M-step, monitoring the changes in the log-likelihood function:
[0076] (9)
[0077] When the likelihood value of adjacent iterations is less than the convergence threshold The algorithm is considered converged when the maximum number of iterations is reached. The final parameter set is then obtained. The modeling of the surface feature distribution of a normal inductor core was completed.
[0078] (III) Step S3: Construct a supervised semantic segmentation model using labeled normal and defective inductor core images.
[0079] This invention employs the DeepLabV3+ architecture as the semantic segmentation model. DeepLabV3+ captures multi-scale contextual information through the dilated spatial pyramid pooling (ASPP) module, effectively identifying defects in inductor cores of different sizes. Its encoder-decoder structure combines deep semantic features with shallow detail features to achieve accurate defect boundary localization. The dilated convolution of this architecture avoids resolution loss, making it particularly suitable for detecting minute defects.
[0080] The specific process is as follows: First, a small number of labeled inductor core images are input into the improved Xception network as the backbone. The encoder extracts features through depthwise separable convolutions, progressively extracting multi-level features in three stages: the input stage (Entry Flow), the middle stage (Middle Flow), and the output stage (Exit Flow). At the end of the encoder, an ASPP module is introduced, containing a 1×1 convolution, three 3×3 dilated convolutions with different dilation rates (6, 12, 18), and a global average pooling branch.
[0081] (10)
[0082] Where F represents the encoder output feature. This is a 1×1 convolution operation. The ASPP output is a dilated convolution with an inflation rate of r, GAP is a global average pooling operation, and Concat is a feature concatenation operation. Each branch captures contextual information from different receptive fields. Subsequently, the decoder restores the ASPP output to its original state through bilinear upsampling. Figure 1 / 4 resolution, and fused with low-level features from the encoder:
[0083] (11)
[0084] in, The shallow features of the encoder are adjusted for the number of channels by a 1×1 convolution and then concatenated with the upsampled ASPP features. Finally, the final segmentation image is obtained by refining through a 3×3 convolution and upsampling by a factor of 4.
[0085] During the training phase, the model employs a combined loss function, integrating the binary cross-entropy loss and the Dice loss:
[0086] (12)
[0087] (13)
[0088] (14)
[0089] in, For real labels, For the predicted probability, N is the total number of pixels, and ε is the smoothing term (values...). ), The weighting coefficients are set to 0.5. Specifically, the binary cross-entropy loss optimizes pixel-level classification accuracy, while the Dice loss improves region overlap; the two complement each other. Furthermore, the Adam optimizer is used for parameter updates, with an initial learning rate set to... The learning rate was dynamically adjusted using a cosine annealing strategy. A batch size of 8 was set, and the model was trained for 100 epochs. The weights of the model with the best performance were then saved. After this training process, the model possesses the ability to perform pixel-level precise segmentation of surface defects in inductor cores.
[0090] (iv) Step S4: Input the image of the inductor core to be detected into both the unsupervised statistical model and the supervised semantic segmentation model for processing to generate the segmentation result.
[0091] S4.1 Unsupervised statistical model generates binarized segmentation map
[0092] First, feature extraction is performed on the image of the inductor core to be tested. The same pixel-level feature extraction process as in step S2.1 is used, at each pixel location. Calculate the LBP value, construct a feature vector by combining multi-scale neighborhood information, and then perform standardization using the normalization parameters saved during the training phase.
[0093] Then, the defect score is calculated. Based on the GMM parameters obtained from step S2.2, the probability density of each pixel feature in the model is calculated:
[0094] (15)
[0095] The Gaussian distribution density function is:
[0096] (16)
[0097] Convert probability density into defect score Next, an adaptive segmentation threshold is determined. Defect scores for all pixels are collected, and the mean is calculated. and standard deviation Establish adaptive threshold The sensitivity parameter α controls the sensitivity of the detection and can be optimized with a small number of validation samples.
[0098] Finally, a pixel-level binary segmentation map is generated. For each pixel location... Defect determination is performed, and the binarized result at that location is obtained based on the threshold:
[0099] (17)
[0100] in, Indicates the location of the segmentation map pixel values, For indicator functions, when Output a white defect area (255) if the condition is met, otherwise output a black normal area (0). Apply the same thresholding to all pixel locations in the image to obtain the unsupervised model binary segmentation map. This segmentation image The output of the model will be compared and analyzed with that of the supervised semantic segmentation model to provide a basis for subsequent model interaction.
[0101] S4.2 Supervised semantic segmentation model generates pixel masks
[0102] The same image of the inductor core to be detected as in step S4.1 is directly input into the DeepLabV3+ model trained in step S3 for forward propagation. The image first passes through the improved Xception backbone network, extracting features layer by layer through depthwise separable convolutions; then it enters the ASPP module, where multi-scale contextual information is captured through parallel processing of dilated convolutions with different dilation rates and global pooling; the decoder upsamples the ASPP output and fuses it with shallow features to restore spatial details. Finally, a pixel-level probability map is generated through the Sigmoid activation function of the output layer. Each pixel value represents the probability that the location belongs to a defect, with a value range of [0, 1]. A binary segmentation mask is generated based on the probability map, and a segmentation threshold is set. Binarize the probability map:
[0103] (18)
[0104] in, This indicates the position of the mask. The pixel value. P The defect probability is the output of the model, where This is an indicator function. Pixels with a probability greater than a threshold are marked as 255 (white, defective area), otherwise marked as 0 (black, normal area). The supervised model mask is obtained by performing the same binarization process on all pixel locations in the image. The mask The exact location, shape, and boundary of the defects on the surface of the inductor core were clearly marked, providing a high-quality reference benchmark for the quantitative analysis of the difference between the results and the unsupervised model in the subsequent step S5.
[0105] (v) Step S5: Compare the binarized segmentation map of the unsupervised model with the pixel mask of the supervised model, and quantify the difference in detection results.
[0106] S5.1 Difference Calculation
[0107] For the same image to be detected, compare the binarized segmentation images generated by the unsupervised statistical model in step S4.1. and the mask generated by the supervised semantic segmentation model in step S4.2 First, the Intersection over Union (IoU) metric is calculated to quantify the degree of overlap between the detection results of the two models:
[0108] (19)
[0109] Furthermore, the Dice coefficient is introduced to assess the consistency of detection:
[0110] (20)
[0111] Overall similarity index:
[0112] (twenty one)
[0113] Both IoU and Dice have values in the range [0,1]. The weighting coefficient is set to 0.5. The overall similarity S is achieved by fusing the IoU and Dice metrics with equal weights to comprehensively evaluate region overlap and boundary consistency. The larger the value, the more consistent the detection results of the two models for this image.
[0114] S5.2 Conditional Branching Strategy
[0115] A three-level conditional branch decision is executed based on the comprehensive similarity S. When S ≥ 0.75, it is determined that the two models have reached a high degree of consensus. The image and its mask (consistently defective regions are marked as defective, and consistently normal regions are marked as normal) are added to the supervised model training set for weight updates, improving the model's accuracy and generalization ability. Simultaneously, samples confirmed as normal by both models are selected, and their features are fed into the unsupervised model to update the GMM parameters, optimizing the statistical distribution benchmark of normal features and improving the modeling accuracy of normal samples, thereby reducing subsequent false detections. When 0.5 ≤ S < 0.75, it is determined that there is a moderate difference. The image is sent to the manual review queue for confirmation and feedback to the corresponding model optimization. When S < 0.5, it is determined that there is a significant discrepancy, and such samples are not included in this round of model updates.
[0116] Through the aforementioned multi-level differential quantification and conditional branching mechanisms, unsupervised and supervised models form a progressive complementary synergy, adopting corresponding optimization strategies at different confidence levels to achieve continuous improvement in detection performance.
[0117] (vi) Step S6: Update the parameters of the unsupervised statistical model.
[0118] S6.1 High-Confidence Normal Sample Augmentation
[0119] From the conditional branching process in step S5.2, images of inductor cores that are confirmed to be normal in both models are collected. These images are then processed using the same pixel-level feature extraction procedure as in step S2.1, calculating the LBP value for each pixel and constructing a feature vector by combining it with multi-scale neighborhood information. After normalization, a new set of normal features is obtained.
[0120] S6.2 GMM parameter update
[0121] The newly added normal feature set is merged with the original normal training set to form an expanded normal sample training set. The GMM parameters are updated using the EM algorithm, and the posterior probability is calculated in the E-step:
[0122] (twenty two)
[0123] in, Let represent the posterior probability that the i-th feature sample is generated by the k-th Gaussian component.
[0124] Use a weighted update strategy in step M:
[0125] (twenty three)
[0126] (twenty four)
[0127] (25)
[0128] in, The learning rate is used to ensure that the model can learn new normal patterns without forgetting existing knowledge.
[0129] The updated GMM model expands the coverage of normal feature distributions, enabling it to correctly identify previously misclassified normal surface patterns. By continuously receiving normal samples confirmed by both models, the detection boundary of the unsupervised model is continuously optimized, the false detection rate is significantly reduced, and interactive optimization with the supervised model is achieved.
[0130] Step S7: Generating pseudo-labels based on unsupervised statistical models.
[0131] S7.1 New Batch of Image Defect Detection
[0132] A new batch of inductor core images to be inspected is input into the unsupervised statistical model updated in step S6. The same detection process as in step S2.1 is performed on each image: LBP features are extracted, the log-likelihood score of each pixel under the GMM model is calculated, and a defect probability map is generated. Binarization is performed based on the optimized detection threshold to obtain preliminary detection results. .
[0133] S7.2 Pseudo-label generation and dataset expansion
[0134] Detection results based on unsupervised models Generate a corresponding pixel-level pseudo-label mask for each image. :
[0135] (26)
[0136] in, The symbol represents morphological erosion, ⊕ represents morphological dilation, and SE is a 3×3 structuring element. Opening operations remove isolated noise points, and closing operations fill internal holes in defects and smooth boundaries. Subsequently, connected component analysis is applied to remove tiny regions with an area less than 50 pixels.
[0137] Pixel-level pseudo-tags were generated after morphological optimization. Among them, normal images All zeros, defective image The defect area is 255, and the normal area is 0. The image to be detected is compared with the corresponding pseudo-label. Training sample pairs are added to the supervised model's training set. Through this pseudo-label generation mechanism, the unsupervised model automatically generates pixel-level labels for a large number of unlabeled images, significantly reducing the cost of manual labeling, while simultaneously expanding the training data scale of the supervised model and improving detection performance.
[0138] (viii) Step S8: Update the weights of the supervised semantic segmentation model.
[0139] S8.1 Training Data Integration
[0140] The training dataset is constructed from two sources: first, high-consistency samples with a comprehensive similarity S≥0.75 from step S5, which are validated by both models and have high reliability, and are assigned a weight w=1.0; second, pseudo-labeled samples generated in step S7, including normal and defective samples, and are assigned a weight w=0.8. The two types of data are mixed in an 8:2 ratio to ensure that the training process reinforces both validated reliable knowledge and newly discovered defect patterns.
[0141] S8.2 Supervised Semantic Segmentation Model Weight Update
[0142] A fine-tuning strategy was used to update the DeepLabV3+ model weights. The parameters of the Entry Flow and Middle Flow in the Xception backbone were frozen, and only the parameters of the Exit Flow, ASPP module, and decoder were updated to prevent catastrophic forgetting. The initial learning rate was set to 0.0001, dynamically adjusted using a cosine annealing scheduler, with a batch size of 8. A weighted cross-entropy loss function was used.
[0143] (27)
[0144] in, For sample weights, For tags, To predict probabilities, the model is trained for 20 epochs, and the weights of the best-performing model are saved. Through this learning mechanism, the supervised model continuously absorbs new knowledge, its detection capabilities steadily improve, and it achieves adaptive evolution.
[0145] (ix) Step S9: Use the batch of images to be detected processed in step S7 to input into the unsupervised statistical model updated in step S6 and the supervised semantic segmentation model in step S8 to detect and obtain detection results. Calculate the system performance index based on the consistency analysis of the two models.
[0146] S9.1 Performance Index Calculation
[0147] The batches of images to be detected processed in step S7 are input into the updated unsupervised and supervised models respectively to obtain detection results. For each image, the comprehensive similarity S defined in step S5.1 is calculated, and the consistency distribution of the test batches is statistically analyzed.
[0148] (28)
[0149] (29)
[0150] (30)
[0151] in, The number of samples with a comprehensive similarity S ≥ 0.85. The number of samples where 0.5 ≤ S < 0.85 The number of samples where S < 0.5 This represents the total number of samples in this batch. The three proportions represent the percentages of samples with high consistency, moderate difference, and significant divergence, respectively. The average overall similarity of this batch is also calculated. and standard deviation To evaluate the overall consistency and stability of the detection results of the two models.
[0152] S9.2 Convergence Determination and Iterative Optimization
[0153] Based on the calculated performance metrics, a triple convergence criterion is set to determine the system state: the proportion of highly consistent samples. The proportion of samples with obvious discrepancies And compared to the average similarity change in the previous iteration .
[0154] Continuous recording during iteration , and The system's convergence trend is observed. If the system does not meet the convergence condition, a new round of iterative optimization is initiated. The test batch samples are returned to step S5 for differential quantification analysis, and the threshold parameters of the unsupervised model in step S6 are updated based on the analysis results. In step S7, a new batch of inductor core images is introduced, and pseudo-labels are generated using the updated unsupervised model. In step S8, these pseudo-labels are used to train the supervised semantic segmentation model, and the model weights are updated. After the dual-model update is completed, the image batch processed in S7 is used as the test set to re-execute the evaluation process in step S9 to determine the system's convergence status. When the convergence condition is met, the system is determined to have reached a stable state, and the final dual-model defect detection system is output.
[0155] Through a cyclical iterative mechanism of steps S5→S6→S7→S8→S9, the unsupervised statistical model and the supervised semantic segmentation model achieve interactive optimization. The unsupervised model generates pseudo-labels to expand the training set, while the supervised model reverse-calibrates the statistical features, forming a virtuous cycle of mutual verification. This mechanism fully leverages the complementary advantages of the two types of models, achieving high-precision and low-false-detection-rate inductor core defect detection under conditions of few samples.
[0156] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting surface defects in inductor cores using a few-sample model-interaction approach, characterized in that, Includes the following steps: Step 1: Data acquisition and image preprocessing, constructing three types of sample datasets: normal samples, labeled samples, and unlabeled samples; Step 2: Input defect-free inductor core image samples and construct an unsupervised statistical model based on statistical learning. The unsupervised statistical model is constructed using a statistical learning method based on Gaussian mixture models. Step 3: Construct a supervised semantic segmentation model using labeled images of normal and defective inductor cores; Step 4: Simultaneously input the image of the inductor core to be detected into the unsupervised statistical model and the supervised semantic segmentation model for processing to generate segmentation results; perform thresholding on all pixel positions in the image to obtain the binarized segmentation map of the unsupervised statistical model; and perform binarization on all pixel positions in the image to obtain the mask map of the supervised semantic segmentation model. Step 5: Compare the binarized segmentation map of the unsupervised statistical model with the mask map of the supervised semantic segmentation model to quantify the difference in detection results. For the same image to be detected, compare the binarized segmentation map generated by the unsupervised statistical model and the mask map generated by the supervised semantic segmentation model. Calculate the intersection-union ratio (IU / R) to quantify the overlap between the detection results of the unsupervised statistical model and the supervised semantic segmentation model, and introduce the Dice coefficient to evaluate detection consistency. The comprehensive similarity S is fused with equal weights between the IU and Dice coefficients. Based on the comprehensive similarity S, a three-level conditional branch decision is executed: When S ≥ 0.75, it is determined that the unsupervised statistical model and the supervised semantic segmentation model have reached a high degree of consensus. The image and mask are added to the training set of the supervised semantic segmentation model for weight updates. Simultaneously, samples confirmed as normal by both the unsupervised statistical model and the supervised semantic segmentation model are selected, and their features are fed into the unsupervised statistical model. When 0.5 ≤ S < 0.75, it is determined that there is a moderate difference. The image is sent to the manual review queue for confirmation and feedback to the corresponding model optimization. When S < At a value of 0.5, there is a significant discrepancy in the judgment, and such samples will not be included in this round of model updates. Step 6: Update the parameters of the unsupervised statistical model; Step 7: Input the new batch of inductor core images to be tested into the unsupervised statistical model updated in Step 6, and generate pseudo-labels based on the unsupervised statistical model; Step 8: Update the weights of the supervised semantic segmentation model; Step 9: Use the batch of images of the inductor cores to be detected processed in Step 7 to input into the unsupervised statistical model updated in Step 6 and the supervised semantic segmentation model in Step 8 to obtain the detection results.
2. The method for detecting surface defects in inductor cores based on model interaction according to claim 1, characterized in that, The specific steps for constructing the unsupervised statistical model in step 2 are as follows: Step 2.1 Feature extraction and representation: For each pixel position (x,y) of the normal inductor core image, surface texture features are extracted using local binary mode; and feature vectors are constructed by combining the multi-scale neighborhood information of the pixels, and the feature vectors of all normal sample pixels are normalized. Step 2.2 Statistical distribution parameter learning: The distribution parameters of the Gaussian mixture model are learned using the expectation-maximization algorithm.
3. The method for detecting surface defects in inductor cores based on model interaction according to claim 1, characterized in that, In step 3, the DeepLabV3+ architecture is used as the supervised semantic segmentation model. First, the labeled inductor core image is input into the improved Xception as the backbone network. The encoder extracts features through depthwise separable convolutions, progressively extracting multi-level features in the input, intermediate, and output stages. At the end of the encoder, an ASPP module is introduced, which includes a 1×1 convolution, three 3×3 dilated convolutions with different dilation rates, and a global average pooling branch. Then, the decoder restores the ASPP output to 1 / 4 resolution of the original image through bilinear upsampling and fuses it with the low-level features of the encoder. During the training phase, the supervised semantic segmentation model employs a combined loss function, integrating binary cross-entropy loss and Dice loss.
4. The method for detecting surface defects in inductor cores based on model interaction according to claim 1, characterized in that, The specific operations for step 6 are as follows: Step 6.1 High-confidence normal sample expansion: From the conditional branching process, collect inductor core images that are confirmed as normal by both the unsupervised statistical model and the supervised semantic segmentation model. For these images, use a pixel-level feature extraction process to calculate the LBP value of each pixel and combine it with multi-scale neighborhood information to construct a feature vector. After normalization, a new set of normal features is obtained. Step 6.2 Gaussian Mixture Model Parameter Update: Merge the newly added normal feature set with the original normal training set to form an expanded normal sample training set, and update the Gaussian Mixture Model parameters using the EM algorithm.
5. The method for detecting surface defects in inductor cores based on model interaction according to claim 1, characterized in that, The specific operation of step 7 is as follows: Step 7.1 New batch of image defect detection: Input the new batch of inductor core images to be detected into the unsupervised statistical model updated in Step 6, perform the detection process for each image, namely extract LBP features, calculate the log likelihood score of each pixel under the Gaussian mixture model, generate a defect probability map, and perform binarization based on the optimized detection threshold to obtain preliminary detection results. Step 7.2 Pseudo-label generation and dataset expansion: Based on the detection results of the unsupervised statistical model, a corresponding pixel-level pseudo-label mask is generated for each image; where the pseudo-label mask for normal images is all 0, and the pseudo-label mask for defective images has 255 for defective areas and 0 for normal areas.
6. The method for detecting surface defects in inductor cores based on model interaction according to claim 1, characterized in that, The specific operation of step 8 is as follows: Step 8.1 Construct a training dataset containing two sources: one is the highly consistent samples with a comprehensive similarity S≥0.75 from Step 5, which are assigned a weight w=1.0; the other is the pseudo-label samples generated in Step 7, including normal samples and defective samples, which are assigned a weight w=0.8; the two types of data are mixed in an 8:2 ratio. Step 8.2 Update the weights of the supervised semantic segmentation model using a fine-tuning strategy.
7. The method for detecting surface defects in inductor cores based on model interaction according to any one of claims 1-6, characterized in that, Through the iterative mechanism of steps 5→6→7→8→9, the unsupervised statistical model and the supervised semantic segmentation model achieve interactive optimization. The unsupervised statistical model generates pseudo-labels to expand the training set, and the supervised semantic segmentation model reversely calibrates the statistical features, forming a virtuous cycle of mutual verification.