A method and system for visual inspection of inductor coil appearance defects
Patent Information
- Application Number
- CN202611291410.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-10-30
AI Technical Summary
[0003]为了解决现有技术的不足,本申请提供一种电感线圈外观缺陷视觉检测方法及系统,能够解决现有技术中因模具磨损导致背景纹理发生系统性漂移,而静态检测逻辑无法区分正常纹理漂移与真实缺陷,从而引发大量系统性误判的技术问题
[0014]本申请通过引入动态背景基准更新机制,解决了电感线圈生产过程中因模具磨损导致的背景纹理渐变与缺陷判定逻辑之间的矛盾。通过将当前待检测样本的特征与动态更新的正常背景基准进行比对,并结合高维特征偏离距离与二维特征图空间分布的联合分类策略,能够有效区分正常的工艺背景漂移与真实的局部缺陷,不仅避免了因背景纹理渐变导致的系统性误判,还通过残差特征图分析实现了对真实缺陷的精准识别与量化,显著提升了连续生产环境下的检测准确率与良率统计的真实性,降低了生产成本。
Smart Images

Figure CN123016085A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of industrial visual inspection technology, and more specifically, to a visual inspection method and system for inductor coil appearance defects. Background Technology
[0002] In the long-term, continuous, automated production of inductor coils, as the production line continues to operate, minor wear and tear inevitably occurs on the equipment and molds. This physical change is directly reflected on the product, leading to increasingly obvious, regular shallow scratches or texture compression on specific areas of the coil surface in subsequent production. This gradual change in background texture caused by the slow drift of process conditions is continuous and unidirectional. Abrupt changes are difficult to detect on a single coil and are far from affecting product performance; it is a normal phenomenon within the mold's lifespan. During this process, the detection system continuously compares the surface texture features of the current coil with the previously established static normal background benchmark. When these gradually deepening normal process marks gradually increase in depth, width, and other geometric attributes, eventually crossing the boundary between the previously set normal texture and minor defects, the judgment logic becomes confused. Because the existing detection logic is fixed, it cannot perceive and adapt to the fact that the background texture itself has undergone systematic drift, thus continuously misjudging normal textures under the new normal as defects. This deep contradiction between the static logical benchmark and the continuously dynamic changes in the object's background leads to a significant, false decrease in yield data in the latter half of the production line. Distorted yield data not only causes a large number of qualified products to be scrapped and reworked unnecessarily, increasing manufacturing costs, but may also mislead field engineers to manually relax the overall judgment criteria, thereby greatly increasing the risk of truly occasional minor defects being missed, leading to a large number of systematic misjudgments in the detection system and triggering erroneous quality interventions. Summary of the Invention
[0003] To address the shortcomings of existing technologies, this application provides a visual inspection method and system for inductor coil appearance defects. This method and system can solve the technical problem in existing technologies where background textures drift systematically due to mold wear, and static detection logic cannot distinguish between normal texture drift and real defects, thus leading to a large number of systematic misjudgments.
[0004] In a first aspect, this application provides a visual inspection method for appearance defects in inductors, including: Acquire a timing queue of surface images of multiple inductor coils within the same production stage; Feature region images of inductor coil samples confirmed to be defect-free are extracted from the time-series queue of surface images. Texture baseline features of each feature region image are extracted, and an initial normal background baseline is established based on each texture baseline feature. The convolutional neural network is used to extract the local high-frequency geometric features and global low-frequency semantic features of the feature region image of the current sample to be detected. The multi-dimensional numerical vector representing the surface texture state of the current sample to be detected is used as the current high-dimensional feature and the two-dimensional matrix data used to represent the texture response intensity is used as the current two-dimensional feature map. Based on the deviation distance between the current high-dimensional features and the initial normal background benchmark, and the spatial distribution range of the feature response in the current two-dimensional feature map, the change state of the current sample to be detected is classified. The initial normal background benchmark is updated based on the current change state of the sample to be detected to obtain the current normal background benchmark. Based on the current normal background benchmark and the current two-dimensional feature map, it is confirmed whether there is a real defect in the current sample to be detected.
[0005] Optionally, the step of acquiring a timing queue of surface images of multiple inductor coils within the same production stage includes: Image data of multiple spectral channels of multiple inductors are acquired. The multiple spectral channels include a visible light channel and a near-infrared channel for acquiring images of the enameled wire winding area, and an ultraviolet channel for acquiring images of the terminal soldering area. Associate each image data with an absolute timestamp, production batch number, equipment mold number, and serial number in the surface image time sequence queue, and store them in the surface image time sequence queue.
[0006] Optionally, the step of extracting feature region images of inductor coil samples confirmed to be defect-free from the surface image time sequence queue includes: For the spectral image corresponding to the winding region of the enameled wire, guided filtering is used for enhancement. For the spectral image corresponding to the terminal welding area, an adaptive histogram equalization method is used for enhancement processing. Using a preset geometric template, the enameled wire winding area and terminal welding area of the inductor coil sample that has been confirmed to be defect-free are matched to generate corresponding binarized mask images. The enhanced spectral image is ANDed with the corresponding binarized mask image to extract the images of each feature region.
[0007] Optionally, the steps of extracting texture baseline features from the images of each feature region and establishing an initial normal background baseline based on each texture baseline feature include: Statistical analysis was performed on the images of each feature region to extract texture baseline features, which include the average depth of the indentation at the intersection of the windings, the average gradient amplitude of the texture edge, and the basic flatness of the terminal surface. Based on the extracted texture baseline features, a multidimensional distribution model of each feature region image is established, and the multidimensional distribution model is used as the initial normal background benchmark.
[0008] Optionally, the steps of using a convolutional neural network to extract local high-frequency geometric features and global low-frequency semantic features of the feature region image of the current sample to be detected, and outputting the current high-dimensional features and the current two-dimensional feature map, include: The pre-built convolutional neural network, which includes a multi-scale feature pyramid structure, is invoked. The shallow convolution of the convolutional neural network is used to extract the local high-frequency geometric features of the scratch edges and indentation contours of the current sample to be detected, and the deep convolution of the convolutional neural network is used to extract the global low-frequency semantic features of the winding density and overall indentation distribution of the current sample to be detected. The feature region image of the current sample to be detected is input into a convolutional neural network for forward propagation processing; Output the current high-dimensional features before the last fully connected layer of the convolutional neural network; The two-dimensional feature map output by the convolutional layer of the preset scale in the multi-scale feature pyramid structure is selected as the current two-dimensional feature map.
[0009] Optionally, the step of classifying the change state of the current sample to be detected based on the deviation distance between the current high-dimensional features and the initial normal background benchmark and the spatial distribution range of the feature responses in the current two-dimensional feature map includes: Calculate the deviation distance between the current high-dimensional feature and the mean vector of the initial normal background benchmark; When the deviation distance does not exceed the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map where the texture response intensity exceeds the preset intensity threshold is not less than the preset area threshold, the change state is determined to be neither overall drift nor local mutation. When the deviation distance exceeds the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map whose texture response intensity exceeds the preset intensity threshold is not less than the preset area threshold, the change state is determined to be only overall drift. When the deviation distance does not exceed the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map where the texture response intensity exceeds the preset intensity threshold is less than the preset area threshold, the change state is determined to be only a local mutation. When the deviation distance exceeds the preset tolerance range and the area of the continuous pixel region in the current two-dimensional feature map whose texture response intensity exceeds the preset intensity threshold is less than the preset area threshold, the change state is determined to be that both overall drift and local mutation exist simultaneously.
[0010] Optionally, the step of updating the initial normal background benchmark based on the current change state of the sample to be detected to obtain the current normal background benchmark includes: When the change state is neither global drift nor local abrupt change, the initial normal background reference is used as the current normal background reference. When the change state is only overall drift, if the deviation distance does not exceed the preset maximum wear limit threshold, the current high-dimensional features are fused into the initial normal background benchmark using a smooth update method to obtain the current normal background benchmark; otherwise, the update of the initial normal background benchmark is paused and a device maintenance alarm command is output. When the change is a local mutation only, the initial normal background benchmark is used as the current normal background benchmark; When the change state involves both overall drift and local mutation, the current high-dimensional features are purified to filter out local mutation components. The purified current high-dimensional features are then integrated into the initial normal background benchmark using a smooth update method to obtain the current normal background benchmark.
[0011] Optionally, the step of confirming whether there is a real defect in the current sample to be detected based on the current normal background benchmark and the current two-dimensional feature map includes: The mean vector of the current normal background benchmark is input into the decoding structure of the convolutional neural network for inverse mapping to generate a benchmark two-dimensional feature map with the same spatial scale and number of channels as the current two-dimensional feature map. The residual feature map is obtained by subtracting the features of the reference two-dimensional feature map from the current two-dimensional feature map pixel by pixel. Calculate the sum of the response intensities of all pixels on the residual feature map. If the sum of the response intensities exceeds the preset defect presence threshold, it is determined that there is a real defect in the current sample to be detected; if the sum of the response intensities does not exceed the defect presence threshold, it is determined that there is no real defect in the current sample to be detected.
[0012] Optionally, the steps also include: When a real defect is determined to exist, the residual feature map is input into the preset defect classification structure. The defect type with the highest probability in the probability distribution results output by the defect classification structure is taken as the defect type of the current sample to be detected. At the same time, the estimated length, width and depth of the defect of the current sample to be detected are output.
[0013] Secondly, this application also discloses a visual inspection system for appearance defects in inductors, used to perform the above-mentioned method, including: The image queue acquisition module is used to acquire the time sequence queue of surface images of multiple inductor coils within the same production stage. The baseline establishment module is used to extract feature region images of inductor coil samples that have been confirmed to be defect-free from the time sequence queue of surface images, extract the texture baseline features of each feature region image, and establish an initial normal background baseline based on each texture baseline feature. The feature extraction module is used to extract local high-frequency geometric features and global low-frequency semantic features of the feature region image of the current sample to be detected using a convolutional neural network. It outputs a multi-dimensional numerical vector representing the surface texture state of the current sample to be detected as the current high-dimensional feature and a two-dimensional matrix data representing the texture response intensity as the current two-dimensional feature map. The state classification module is used to classify the changing state of the current sample to be detected based on the deviation distance between the current high-dimensional features and the initial normal background benchmark, the changing trend of the high-dimensional features of the inductor coil sample that has been confirmed to be defect-free in the feature space, and the distribution range of the feature response in the current two-dimensional feature map in the spatial location. The benchmark update and defect determination module is used to update the initial normal background benchmark based on the change status of the current sample to be detected, to obtain the current normal background benchmark, and to confirm whether there is a real defect in the current sample to be detected based on the current normal background benchmark and the current two-dimensional feature map.
[0014] This application resolves the contradiction between background texture gradation caused by mold wear and defect judgment logic during inductor coil production by introducing a dynamic background benchmark update mechanism. By comparing the features of the current sample to be inspected with a dynamically updated normal background benchmark, and combining a joint classification strategy of high-dimensional feature deviation distance and two-dimensional feature map spatial distribution, it can effectively distinguish between normal process background drift and real local defects. This not only avoids systematic misjudgments caused by background texture gradation but also achieves accurate identification and quantification of real defects through residual feature map analysis. This significantly improves the detection accuracy and yield statistics in continuous production environments, and reduces production costs. Attached Figure Description
[0015] Figure 1 This is a flowchart illustrating a visual inspection method for appearance defects in inductors provided in an embodiment of this application.
[0016] Figure 2 This is a schematic diagram of the structure of a visual inspection system for appearance defects of inductor coils provided in an embodiment of this application.
[0017] Labeling Explanation: 210, Image Queue Acquisition Module; 220, Benchmark Establishment Module; 230, Feature Extraction Module; 240, State Classification Module; 250, Benchmark Update and Defect Judgment Module. Detailed Implementation
[0018] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments. The components of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0019] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0020] In the long-term, continuous, automated production of inductors, the existing detection logic is fixed and cannot perceive or adapt to the fact that the background texture itself has undergone systematic drift. Consequently, it continuously misjudges normal textures under the new normal as defects. This deep contradiction between the static logic benchmark and the continuously dynamic changes in the object background can lead to a false decline in yield data in the latter half of the production line and increase the risk of missing truly occasional minor defects. Therefore, how to effectively distinguish between overall normal texture drift and localized, genuine minor defects is a pressing technical problem that needs to be solved in current continuous production quality monitoring.
[0021] To provide a clearer and more detailed explanation of the technical solutions in this application, the basic concepts involved are explained below.
[0022] A surface image time sequence queue refers to a series of surface images of inductor coils that are continuously acquired and arranged in chronological order of product completion during the inductor coil production process. This queue not only contains the images themselves but can also be further associated with contextual information such as the acquisition time, production batch, equipment station, mold number, and product serial number for each image.
[0023] The initial normal background baseline refers to a mathematical model or feature set representing the standard surface texture state of the batch of products, established by extracting features and statistically analyzing images of qualified products that have been confirmed to be defect-free, at the beginning of a production batch and when the equipment and molds are in optimal condition. Furthermore, this baseline does not correspond to a single image, but rather is a stable reference formed by multiple defect-free samples, used to describe the common characteristics of each feature region under normal conditions in terms of texture intensity, texture direction, grayscale distribution, and local structural continuity.
[0024] Local high-frequency geometric features refer to the areas in an image where high-frequency components typically correspond to drastic changes in grayscale, such as edges, scratches, and spots. Local high-frequency geometric features are used to characterize minute, localized structural abrupt changes on the surface of an inductor coil.
[0025] Global low-frequency semantic features refer to low-frequency components corresponding to regions in an image with gradual gray-level changes, such as overall background texture and illumination distribution. Global low-frequency semantic features are used to characterize the large-scale, overall texture distribution and gradation trend of an inductor coil surface.
[0026] Firstly, see [the following] Figure 1 This application discloses a visual inspection method for appearance defects in inductors, including: S1. Obtain the timing queue of surface images of multiple inductor coils within the same production stage; S2. Extract the feature region images of the inductor coil samples that have been confirmed to be defect-free from the time sequence queue of surface images, extract the texture baseline features of each feature region image, and establish an initial normal background benchmark based on each texture baseline feature. S3. Use a convolutional neural network to extract the local high-frequency geometric features and global low-frequency semantic features of the feature region image of the current sample to be detected, and output a multi-dimensional numerical vector representing the surface texture state of the current sample to be detected as the current high-dimensional feature and a two-dimensional matrix data used to represent the texture response intensity as the current two-dimensional feature map. S4. Based on the deviation distance between the current high-dimensional features and the initial normal background benchmark and the spatial distribution range of the feature response in the current two-dimensional feature map, classify the change state of the current sample to be detected. S5. Update the initial normal background benchmark based on the current change state of the sample to be detected to obtain the current normal background benchmark. Confirm whether there is a real defect in the current sample to be detected based on the current normal background benchmark and the current two-dimensional feature map.
[0027] The acquisition of surface images of multiple inductors within the same production stage refers to the continuous or periodic acquisition of image data of the inductor surface during the inductor production process, organized chronologically. This can be achieved by setting up multiple industrial cameras, triggering image acquisition when the inductor passes a specific inspection station. Image acquisition can cover multiple key areas of the inductor, such as the enameled wire winding area and the terminal welding area. To obtain more comprehensive surface information, multispectral imaging technology can be used. For example, the visible light channel is used to acquire images of the enameled wire winding area, the near-infrared channel is used to capture features of minute defects inside the material or on the surface, and the ultraviolet channel is used to acquire images of the terminal welding area to detect welding quality or surface contamination. Each acquired image is associated with an absolute timestamp, production batch number, equipment mold number, and serial number in the surface image time sequence queue.
[0028] More specifically, after acquiring images of the initial defect-free samples, a fixed-coordinate cropping method is used. A rectangular region with a fixed aspect ratio is directly cropped from the image center point as the feature region image. This fixed aspect ratio is not limited to a single value but is pre-set based on the actual proportion of the inductor coil target area in the camera's field of view. This ensures the cropped area completely covers the surface area to be analyzed while minimizing irrelevant background. To ensure the stability of this cropped area, the positional distribution of the coil body in the image can be observed using several initial sample images before determining a uniform cropping window. Next, the gray-level co-occurrence matrix is calculated on the cropped feature region image, and statistics such as contrast, correlation, energy, and homogeneity are extracted as texture baseline features. In specific processing, the occurrence of gray-level combinations of adjacent pixels can be statistically analyzed in multiple directions, and the statistics obtained from each direction are then summarized to reduce the influence of texture bias in a single direction on the results. Subsequently, the statistics of the same type of feature regions on multiple defect-free samples were collected and organized to obtain the center value and dispersion of each texture baseline feature. These statistical results were then combined into a feature vector, which was stored in the database as the initial normal background benchmark.
[0029] Specifically, convolutional neural networks (CNNs) can employ residual connection structures, such as the ResNet50 architecture, or other CNN architectures with similar capabilities at the feature extraction level. The implementation process can be as follows: First, the feature region image is input into the network input, and size normalization, grayscale normalization, and channel organization are performed in a manner consistent with the training phase. Subsequently, the shallow convolutional units at the front of the network primarily respond to edges, corners, fine-line textures, and local abrupt changes in the image, making them more suitable for representing local high-frequency geometric features. The deep convolutional units at the back of the network, after stacking multiple receptive fields, can integrate texture distribution, structural continuity, and inter-region relationships over a larger range, making them more suitable for representing global low-frequency semantic features. After the global average pooling layer, the network outputs a fixed-dimensional numerical vector, which highly condenses the overall texture state of the sample, i.e., the current high-dimensional feature. Since different network architectures may correspond to different output dimensions, this fixed dimension is preferably consistent with the selected network structure, rather than being limited to a single, unique value. To obtain a current two-dimensional feature map that facilitates subsequent spatial analysis, the output of the intermediate convolutional layer can be aggregated along the channel dimension, for example, by using channel mean aggregation or channel maximum response aggregation, to compress the multi-channel features into a single two-dimensional matrix data.
[0030] Specifically, the Euclidean or cosine distance between the current high-dimensional feature vector and the initial normal background reference vector is calculated as the deviation distance. This deviation distance reflects the degree of change in the overall texture state of the current sample relative to the initial normal state. The larger the deviation distance, the further the current sample is from the initial normal background in the overall feature space. Simultaneously, the spatial distribution of high-response regions in the current two-dimensional feature map is analyzed. To make this analysis feasible, the current two-dimensional feature map can be normalized first, and then high-response regions can be extracted according to pre-defined response discrimination rules.
[0031] The initial normal background benchmark is updated based on the current changes in the sample to be detected, resulting in the current normal background benchmark. The presence of a true defect in the current sample is then confirmed using the current normal background benchmark and the current two-dimensional feature map. When the classification result indicates an overall drift, it suggests that the change in the current sample is more likely due to gradual texture changes caused by normal mold wear, rather than localized damage. In this case, the current high-dimensional features are incorporated into the benchmark with a certain smoothing coefficient, allowing the benchmark to update slowly. This smoothing coefficient is not limited to a fixed value but is preset based on production cycle stability, mold wear speed, and the risk of false absorption: a smaller smoothing coefficient is used when a more robust benchmark update is desired; a larger smoothing coefficient can be used when the production background changes rapidly and is confirmed to be a normal process drift. Specifically, a progressive update method can be used, where each time an overall drift sample is identified, its current high-dimensional features are incorporated into the existing benchmark with preset weights; or a windowed update method can be used, where the benchmark is updated uniformly only after several consecutive samples have been determined to be overall drifts, to reduce the impact of occasional fluctuations in a single sample.
[0032] Finally, the mean vector of the current normal background baseline is input into the decoding structure of the convolutional neural network (e.g., a U-Net decoder) for inverse mapping to generate a baseline 2D feature map with the same spatial scale and number of channels as the current 2D feature map. The baseline 2D feature map is then subtracted pixel-by-pixel from the current 2D feature map to obtain a residual feature map. The sum of the response intensities of all pixels on the residual feature map is calculated. If the sum exceeds a preset defect presence threshold (e.g., 10000), a real defect is determined to exist in the current sample to be detected; otherwise, no real defect is determined to exist.
[0033] This application dynamically updates the normal background benchmark, which can adapt to the gradual changes in background texture caused by equipment wear during the production process. This avoids misjudging new normal states as defects, thereby improving the accuracy of inductor coil appearance defect detection, reducing the distortion of yield data, scrapping of qualified products, and increased manufacturing costs, and reducing the risk of missing truly occasional minor defects.
[0034] Furthermore, the step of acquiring a timing queue of surface images of multiple inductor coils within the same production stage includes: Image data of multiple spectral channels of multiple inductors are acquired. The multiple spectral channels include a visible light channel and a near-infrared channel for acquiring images of the enameled wire winding area, and an ultraviolet channel for acquiring images of the terminal soldering area. Associate each image data with an absolute timestamp, production batch number, equipment mold number, and serial number in the surface image time sequence queue, and store them in the surface image time sequence queue.
[0035] Acquiring image data from multiple spectral channels of multiple inductors refers to capturing image information of the inductor surface using light of different wavelengths. This can be achieved using a multispectral camera system that integrates visible light, near-infrared, and ultraviolet light sources and corresponding sensors. For example, the visible light channel can use an LED light source with a wavelength range of 400-700 nm and a CCD / CMOS sensor to capture conventional surface features of the enameled wire winding area; the near-infrared channel can use an infrared LED light source with a wavelength range of 700-1000 nm and an InGaAs sensor to penetrate the enameled wire surface coating and reveal subsurface defects; and the ultraviolet channel can use an ultraviolet LED light source with a wavelength range of 200-400 nm and a UV-sensitive sensor to detect the fluorescence or absorption characteristics of the terminal soldering area and identify soldering defects.
[0036] Associating each image with an absolute timestamp, production batch number, equipment mold number, and sequence number in the surface image time sequence queue means binding image data with key information in the production process. This can be implemented using a data management system, which automatically retrieves this information from the production line control system during image acquisition and embeds it as metadata into the image file or stores it in an associated database. For example, the absolute timestamp can be accurate to milliseconds and is automatically generated by the system clock; the production batch number and equipment mold number can be obtained from the MES (Manufacturing Execution System); and the sequence number is automatically assigned by the image queue management module according to the image acquisition order.
[0037] Through the above technical solution, this application solves the problem that acquiring only a single type of image data may not be able to fully capture defect information in different areas of an inductor coil. For example, the enameled wire winding area and the terminal welding area may require images from different spectral channels to effectively identify defects.
[0038] Furthermore, the step of extracting feature region images of inductor coil samples confirmed to be defect-free from the surface image time sequence queue includes: For the spectral image corresponding to the winding region of the enameled wire, guided filtering is used for enhancement. For the spectral image corresponding to the terminal welding area, an adaptive histogram equalization method is used for enhancement processing. Using a preset geometric template, the enameled wire winding area and terminal welding area of the inductor coil sample that has been confirmed to be defect-free are matched to generate corresponding binarized mask images. The enhanced spectral image is ANDed with the corresponding binarized mask image to extract the images of each feature region.
[0039] The spectral image corresponding to the enameled wire winding region refers to the image data of the enameled wire winding region acquired through the visible light channel or near-infrared channel. Specifically, guided filtering can be used for enhancement processing. Guided filtering is an edge-preserving smoothing filter that uses the structural information of a guiding image to filter the input image, smoothing the image while preserving edge details, effectively removing noise and enhancing texture details. For example, the guided filter radius can be set to 5 pixels and the regularization parameter to 0.01 to balance the smoothing effect and edge preservation capability.
[0040] The spectral image corresponding to the terminal welding area refers to the image data of the terminal welding area acquired through the ultraviolet channel. Specifically, adaptive histogram equalization can be used for enhancement processing. Adaptive histogram equalization is an image enhancement technique that improves image contrast by calculating and equalizing the histogram of local image regions. It enhances contrast based on the grayscale distribution of local regions, effectively improving the overall visual effect and detail of the image. For example, the block size can be set to 8x8, and the contrast limit can be set to 0.02 to avoid excessive noise enhancement.
[0041] The preset geometric template refers to a pre-designed digital template that accurately describes the shape and position of the enameled wire winding area and the terminal welding area of the inductor coil. Specifically, geometric template matching can be used to match the enameled wire winding area and the terminal welding area of an inductor coil sample confirmed to be defect-free, generating corresponding binary mask images. Geometric template matching is a shape- or feature-based image matching method that locates the target by searching for regions similar to the template in the image. For example, a normalized cross-correlation algorithm can be used for template matching, with a matching threshold set to 0.85 to ensure matching accuracy. In the generated binary mask image, the pixel value of the target area is 1, and the pixel value of the non-target area is 0.
[0042] The bitwise AND operation refers to performing a pixel-by-pixel logical AND operation between the enhanced spectral image and the corresponding binarized mask image. Specifically, the bitwise AND operation can be used to extract each feature region image. The result of the bitwise AND operation is that the corresponding pixel in the output image is 1 (or non-zero) only if the corresponding pixel in both input images is 1 (or non-zero); otherwise, it is 0. In this way, the target feature region can be accurately separated from the enhanced spectral image.
[0043] By employing the aforementioned technical solutions, this application addresses potential image quality issues in the original spectral images, such as insufficient contrast and noise interference. These problems can lead to a decrease in the accuracy of subsequent feature extraction and benchmark establishment, thereby affecting the reliability of defect detection. Through targeted enhancement processing of spectral images in different regions, combined with geometric template matching to generate masks, high-quality feature region images are ultimately extracted accurately.
[0044] Furthermore, the steps of extracting texture baseline features from each feature region image and establishing an initial normal background baseline based on each texture baseline feature include: Statistical analysis is performed on the images of each feature region to extract texture baseline features, which include the average depth of the indentation at the intersection of the winding, the average gradient amplitude of the texture edge, and the basic flatness of the terminal surface. Based on the extracted texture baseline features, a multidimensional distribution model of the images of each feature region is established, and the multidimensional distribution model is used as the initial normal background benchmark.
[0045] Among them, texture baseline features refer to key quantitative indicators of the inductor coil surface texture, which can be implemented using image processing and pattern recognition techniques. For example, the average depth of the indentation at the winding intersection can be calculated by analyzing the grayscale values or depth map data of the indentation area in the image. Specifically, depth information can be obtained using a 3D topography measuring instrument, or estimated by combining local grayscale changes in the image with calibration parameters. The average gradient magnitude of the texture edge can be obtained by calculating and averaging the gradient values of edge pixels in the image. Specifically, edges can be detected using Sobel, Prewitt, or Canny operators, and their gradient intensity can be calculated. The basic flatness of the terminal surface can be evaluated by analyzing the surface height variation or texture uniformity of the terminal area. Specifically, surface contour data can be obtained using laser triangulation, or indirectly reflected by statistical features such as local variance and entropy of the image.
[0046] Furthermore, a multidimensional distribution model refers to a model that can comprehensively describe the statistical relationships between multiple texture baseline features. Specifically, it can be built using machine learning methods such as Gaussian Mixture Model (GMM), Kernel Density Estimation (KDE), or Support Vector Machine (SVM). For example, when using a Gaussian Mixture Model, each Gaussian component can represent a normal texture state. By learning the texture baseline feature data of defect-free samples, the mean, covariance, and weight parameters of the model can be obtained.
[0047] Therefore, statistical analysis of feature region images allows for in-depth mining of the texture information contained within the images. Based on this, representative texture baseline features are extracted, including the average depth of indentations at winding intersections, the average gradient amplitude of texture edges, and the basic flatness of the terminal surface. These specific texture features are optimized for the structure and potential defect types of the inductor coil. For example, the average depth of indentations at winding intersections directly reflects the uniformity of the winding process and the presence of excessive compression; the average gradient amplitude of texture edges effectively captures edge defects such as scratches and burrs; and the basic flatness of the terminal surface assesses the welding quality and the presence of unevenness. By extracting these physically meaningful and inspectable features, it is ensured that the subsequent benchmark establishment is based on a quantitative description of the product's key quality attributes.
[0048] Through the above technical solution, this application solves the problem of inaccurate defect detection and the tendency for misjudgments or missed detections in the detection of appearance defects in inductors, caused by the initial background reference failing to fully contain detailed texture information. By finely extracting the texture baseline features of the inductor and establishing a multidimensional distribution model based on these features as the initial normal background reference, a more reliable and refined reference system is provided, effectively reducing misjudgments and improving the accuracy of detection.
[0049] Furthermore, the steps of using a convolutional neural network to extract local high-frequency geometric features and global low-frequency semantic features from the feature region image of the current sample to be detected, and outputting the current high-dimensional features and the current two-dimensional feature map, include: The pre-built convolutional neural network, which includes a multi-scale feature pyramid structure, is invoked. The shallow convolution of the convolutional neural network is used to extract the local high-frequency geometric features of the scratch edges and indentation contours of the current sample to be detected, and the deep convolution of the convolutional neural network is used to extract the global low-frequency semantic features of the winding density and overall indentation distribution of the current sample to be detected. The feature region image of the current sample to be detected is input into a convolutional neural network for forward propagation processing; Output the current high-dimensional features before the last fully connected layer of the convolutional neural network; The two-dimensional feature map output by the convolutional layer of the preset scale in the multi-scale feature pyramid structure is selected as the current two-dimensional feature map.
[0050] The process of extracting local high-frequency geometric features and global low-frequency semantic features from the feature region image of the current sample to be detected using a convolutional neural network (CNN) and outputting the current high-dimensional features and the current two-dimensional feature map refers to performing multi-level analysis of the image through a deep learning model to obtain texture information of different granularities. Specifically, this can be achieved by calling a pre-built CNN with a multi-scale feature pyramid structure, which can simultaneously process image information of different scales. Shallow convolutions of the CNN are used to extract local high-frequency geometric features of scratch edges and indentation contours of the current sample to be detected. This is because shallow convolution kernels are typically small and can capture local details and high-frequency information of the image, making them advantageous for identifying subtle geometric defects such as scratches and indentations. Deep convolutions of the CNN are used to extract global low-frequency semantic features of the winding density and overall indentation distribution of the current sample to be detected. This is because deep convolutions, through multi-layer abstraction and expanded receptive fields, can capture the global structure and low-frequency semantic information of the image, making them more effective for evaluating macroscopic features such as winding density and overall indentation distribution. This combination of shallow and deep convolutions ensures the comprehensive extraction of local details and global semantic features of the inductor coil surface texture.
[0051] Inputting the feature region image of the current sample to be detected into a convolutional neural network for forward propagation processing refers to inputting the pre-processed image data into a trained convolutional neural network model, which then calculates layer by layer according to the network structure to generate feature representations. Specifically, this can be achieved by converting the image data into tensor form and feeding it into the input layer of the network.
[0052] Outputting the current high-dimensional feature before the last fully connected layer in a convolutional neural network refers to extracting a high-dimensional vector containing abstract semantic information of the image before the network's classification or regression layers. This can be achieved by designing an output interface before the fully connected layer in the network architecture to directly obtain the activation values of that layer. For example, this could be a 256-dimensional or 512-dimensional feature vector.
[0053] Selecting a 2D feature map output from a convolutional layer of a preset scale within a multi-scale feature pyramid structure as the current 2D feature map refers to selecting one or more feature maps with spatial information from convolutional layers of different depths within the network. Specifically, during network design, one of the output feature maps from layers P3, P4, or P5 of a multi-scale feature pyramid structure, such as FPN (Feature Pyramid Network), can be selected as the 2D feature map.
[0054] Through the above technical solution, this application can comprehensively capture the complex changes in the surface texture of inductor coils, especially the local high-frequency geometric features and the global low-frequency semantic features. These two features are crucial for accurately judging defects, effectively distinguishing between subtle process drifts and real defects, and avoiding misjudgment or omission of defects that may be caused by a single feature extraction method.
[0055] Furthermore, based on the deviation distance between the current high-dimensional features and the initial normal background benchmark, and the spatial distribution range of the feature responses in the current two-dimensional feature map, the steps for classifying the change state of the current sample to be detected include: Calculate the deviation distance between the current high-dimensional feature and the mean vector of the initial normal background benchmark; When the deviation distance does not exceed the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map where the texture response intensity exceeds the preset intensity threshold is not less than the preset area threshold, the change state is determined to be neither overall drift nor local mutation. When the deviation distance exceeds the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map whose texture response intensity exceeds the preset intensity threshold is not less than the preset area threshold, the change state is determined to be only overall drift. When the deviation distance does not exceed the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map where the texture response intensity exceeds the preset intensity threshold is less than the preset area threshold, the change state is determined to be only a local mutation. When the deviation distance exceeds the preset tolerance range and the area of the continuous pixel region in the current two-dimensional feature map whose texture response intensity exceeds the preset intensity threshold is less than the preset area threshold, the change state is determined to be that both overall drift and local mutation exist simultaneously.
[0056] Calculating the deviation distance between the current high-dimensional feature vector and the mean vector of the initial normal background benchmark quantifies the macroscopic difference between the overall texture state of the current sample and its historical normal state, providing a numerical basis for determining whether overall drift exists. This can be achieved using distance metrics such as Euclidean distance, Mahalanobis distance, or cosine similarity. For example, the Euclidean distance between the current high-dimensional feature vector and the mean vector of the initial normal background benchmark can be calculated; a larger distance value indicates a greater degree of deviation.
[0057] The deviation distance not exceeding the preset tolerance range means that the overall texture state of the current sample is only slightly different from the overall texture state of the initial normal background baseline, and is within an acceptable range. The preset tolerance range can be determined based on actual production experience, historical data analysis, or statistical methods. For example, it can be set as a multiple of the standard deviation of the mean vector of the initial normal background baseline.
[0058] Specifically, the condition that the area of a continuous pixel region in the current 2D feature map whose texture response intensity exceeds a preset intensity threshold is not less than a preset area threshold means that, within a local region, the area of the region with abnormal texture response intensity is relatively large, indicating the presence of a significant local anomaly. The preset intensity threshold can be set based on the statistical distribution of the texture response or expert experience; for example, it can be set as the average texture response intensity plus two standard deviations. The preset area threshold can be set based on the minimum detectable size of the defect or an empirical value; for example, it can be set to 100 square pixels.
[0059] Among them, the determination of the change state as having neither overall drift nor local mutation means that the overall texture of the current sample is consistent with the normal baseline and there are no significant local anomalies, which is a completely normal production state.
[0060] Among them, the change status is judged as only overall drift, which means that the overall texture of the current sample has undergone a systematic change, but this change is uniformly distributed and there are no concentrated local anomalies. It belongs to the normal process drift that requires updating the baseline.
[0061] Among them, the change state is judged as local mutation only, which means that the overall texture of the current sample is consistent with the normal benchmark, but an abnormal texture response appears in a local area. This is usually a typical manifestation of sporadic defects.
[0062] Among them, determining the change state as having both overall drift and local mutation means that the current sample has both overall process drift and anomalies in local areas. It is necessary to adapt the overall drift and at the same time pay attention to whether the local mutation is a real defect.
[0063] Through the above technical solution, this application can clearly define specific classification criteria and judgment logic, accurately distinguish between overall drift, local mutation, and both, and avoid misjudgment, thereby providing accurate state information for subsequent benchmark updates and defect determination. The deviation distance of high-dimensional features reflects the macroscopic differences in the overall texture state, while the local response distribution of the two-dimensional feature map reveals the microscopic anomalies in local areas.
[0064] Furthermore, the step of updating the initial normal background benchmark based on the current change state of the sample to be detected to obtain the current normal background benchmark includes: When the change state is neither global drift nor local abrupt change, the initial normal background reference is used as the current normal background reference. When the change state is only overall drift, if the deviation distance does not exceed the preset maximum wear limit threshold, the current high-dimensional features are fused into the initial normal background benchmark using a smooth update method to obtain the current normal background benchmark; otherwise, the update of the initial normal background benchmark is paused and a device maintenance alarm command is output. When the change is a local mutation only, the initial normal background benchmark is used as the current normal background benchmark; When the change state involves both overall drift and local mutation, the current high-dimensional features are purified to filter out local mutation components. The purified current high-dimensional features are then integrated into the initial normal background benchmark using a smooth update method to obtain the current normal background benchmark.
[0065] The current normal background baseline refers to the baseline obtained by updating the initial normal background baseline based on the current changes in the sample to be tested. This baseline can adapt to overall drift or local abrupt changes that may occur during the production process, thus more accurately reflecting the current normal production status.
[0066] The maximum wear limit threshold is a preset value used to define the permissible range of wear on production equipment or molds. When the deviation exceeds this threshold, it indicates that the wear level has exceeded the normal process drift range, which may indicate that the equipment needs maintenance.
[0067] A smooth update method refers to gradually and slowly integrating the current high-dimensional features into the initial normal background baseline. Specifically, methods such as Exponentially Weighted Moving Average (EWMA) or Kalman filtering can be used. For example, the new baseline mean can be expressed as: New baseline mean = α * Current high-dimensional features + (1-α) * Old baseline mean, where α is a smoothing factor between 0 and 1, used to control the speed and magnitude of the update.
[0068] Equipment maintenance alarm commands are alert messages issued when the deviation distance exceeds the maximum wear limit threshold. These commands can be implemented via audible and visual alarms, email notifications, SMS alerts, or integrated into the MES / SCADA system, promptly reminding operators to perform equipment inspections and maintenance.
[0069] Purification refers to processing the current high-dimensional features to filter out local mutation components. Specifically, methods such as Principal Component Analysis (PCA), Independent Component Analysis (ICA), wavelet denoising, or cluster-based outlier removal can be used. For example, by analyzing the contribution of each dimension in the high-dimensional feature vector, outlier dimensions related to local mutations can be identified and removed, or a Local Outlier Factor (LOF) model can be constructed to identify and remove local outliers.
[0070] Specifically, when the change state is determined to have neither overall drift nor local abrupt change, it indicates that the current production state is stable and the product appearance characteristics are highly consistent with the initial normal background reference. At this time, there is no need to adjust the reference, and the initial normal background reference can be directly used as the current normal background reference, thus ensuring the stability of the detection.
[0071] When the change is determined to be a mere overall drift, it indicates that slight wear may have occurred in the production equipment or mold, leading to a uniform and gradual change in the overall texture characteristics of the product. To accommodate this normal process drift, provided the deviation distance does not exceed the preset maximum wear limit threshold, a smooth update method is used to fuse the current high-dimensional features into the initial normal background baseline, thus obtaining the current normal background baseline. This smooth update mechanism allows the baseline to gradually adapt to the new normal state, avoiding misjudging normal process drift as a defect. If the deviation distance exceeds the maximum wear limit threshold, updating the initial normal background baseline is paused, and an equipment maintenance alarm command is output. This effectively prevents the baseline from over-adapting to abnormal wear and promptly reminds operators to perform equipment maintenance, avoiding potential serious defects.
[0072] When a change is determined to be a local mutation only, it indicates that the current sample may have sporadic defects, but the overall production status remains normal. In this case, to avoid introducing local defects into the normal background benchmark, this scheme directly uses the initial normal background benchmark as the current normal background benchmark, ensuring the purity of the benchmark and thus accurately identifying the true local defects.
[0073] When a change in state is determined to involve both overall drift and local mutations, it means that the production process exhibits both overall process drift and local anomalies. To accurately update the baseline under such complex conditions, the current high-dimensional features are first purified to filter out local mutation components, ensuring that only the impact of overall drift is considered when updating the baseline. Subsequently, a smooth update method is used to integrate the purified current high-dimensional features into the initial normal background baseline, resulting in the current normal background baseline. This approach can adapt to overall process drift while avoiding local defect contamination of the baseline.
[0074] This application introduces a dynamic baseline update mechanism. When the change state is determined to have neither overall drift nor local abrupt change, the initial baseline remains unchanged, ensuring the stability of the detection. When only overall drift is detected, the deviation distance is used to determine whether it is within the normal wear range, and the baseline is smoothly updated within the allowable range to adapt to process drift and avoid misjudgment. If the wear limit is exceeded, an alarm is issued for timely intervention. When only local abrupt change is detected, the baseline is not updated to prevent defect features from contaminating the normal baseline and to ensure accurate identification of real defects. When both overall drift and local abrupt change exist simultaneously, high-dimensional features are first purified to filter out local abrupt change components before smooth updating, thus accurately adapting to overall drift even in complex situations while avoiding local defect contamination of the baseline.
[0075] Furthermore, the steps for confirming whether there are real defects in the current sample to be detected based on the current normal background benchmark and the current two-dimensional feature map include: The mean vector of the current normal background benchmark is input into the decoding structure of the convolutional neural network for inverse mapping to generate a benchmark two-dimensional feature map with the same spatial scale and number of channels as the current two-dimensional feature map. The residual feature map is obtained by subtracting the features of the reference two-dimensional feature map from the current two-dimensional feature map pixel by pixel. Calculate the sum of the response intensities of all pixels on the residual feature map. If the sum of the response intensities exceeds the preset defect presence threshold, it is determined that there is a real defect in the current sample to be detected; if the sum of the response intensities does not exceed the defect presence threshold, it is determined that there is no real defect in the current sample to be detected.
[0076] The reverse mapping, where the mean vector of the current normal background benchmark is input into the decoding structure of the convolutional neural network, refers to using a pre-trained decoder to transform a low-dimensional mean vector into a high-dimensional feature map. Specifically, this can be achieved using a decoder composed of multiple upsampling layers and convolutional layers. For example, the decoder can include transposed convolutional layers, batch normalization layers, and activation function layers. Through layer-by-layer upsampling and feature fusion, the spatial information of the mean vector is gradually recovered, generating a two-dimensional feature map with rich details.
[0077] Generating a baseline 2D feature map with the same spatial scale and number of channels as the current 2D feature map means ensuring that the feature map obtained by inverse mapping is consistent with the current 2D feature map of the sample to be detected in terms of size and feature dimensions. Specifically, this can be achieved by adjusting the output size and number of channels of the last layer of the decoder. For example, if the current 2D feature map is 64x64 in size and has 256 channels, then the baseline 2D feature map output by the decoder should also be 64x64 with 256 channels.
[0078] The pixel-by-pixel subtraction between the baseline 2D feature map and the current 2D feature map refers to calculating the difference in pixel values between the two feature maps at corresponding positions. This can be achieved using matrix subtraction. For example, for two feature maps A and B of the same size, each pixel C(i,j) of the residual feature map C is equal to A(i,j) minus B(i,j).
[0079] The residual feature map refers to the feature map representing the difference obtained through feature subtraction. Specifically, this can be achieved by storing the subtraction result as a new two-dimensional matrix. For example, each pixel value in the residual feature map represents the degree of deviation of the current sample to be detected from the normal background benchmark at that location.
[0080] Calculating the sum of the response intensities of all pixels in the residual feature map involves accumulating the values of all pixels in the residual feature map. This can be achieved by performing a summation operation on the residual feature map. For example, if the pixel values in the residual feature map represent the intensity of feature differences, then the sum can reflect the overall degree of difference.
[0081] Specifically, determining the presence of a real defect in the current sample to be detected when the sum of response intensities exceeds a preset defect threshold means comparing the sum with a pre-defined value to determine if a defect exists. This can be achieved by setting an empirical threshold, for example, by statistically analyzing the sum of residual feature maps from a large number of normal and defective samples, ensuring that a high probability of a defect exists when the sum exceeds this threshold.
[0082] Specifically, determining that there is no real defect in the current sample to be tested when the sum of the response intensities does not exceed the defect presence threshold means that the sample is considered normal when the sum is lower than or equal to the preset threshold. This can be achieved using logic opposite to the above judgment; for example, this indicates that the difference between the current sample to be tested and the normal background baseline is insufficient to be considered a defect.
[0083] In a preferred embodiment, during the detection process, a feature region image of the current inductor coil to be detected is acquired, and a pre-trained convolutional neural network (e.g., an encoder-decoder network based on a U-Net architecture) is used to extract the current high-dimensional features and the current two-dimensional feature map. The current two-dimensional feature map has a size of 64x64 and 256 channels.
[0084] First, the initial normal background baseline was updated based on the changing state of the current sample to be detected, resulting in the current normal background baseline. Assume the mean vector of the current normal background baseline is a 256-dimensional vector. To confirm the presence of real defects, this 256-dimensional mean vector is input into the decoding structure of a convolutional neural network. This decoding structure consists of three transposed convolutional layers, each followed by a batch normalization layer and a ReLU activation function.
[0085] The first transposed convolutional layer upsamples the 256-dimensional vector and converts it into an 8x8x128 feature map.
[0086] The second transposed convolutional layer upsamples the 8x8x128 feature map and converts it into a 32x32x64 feature map.
[0087] The third transposed convolutional layer upsamples the 32x32x64 feature map and transforms it into a 64x64x256 feature map, which serves as the baseline 2D feature map. This baseline 2D feature map has the same 64x64 spatial scale and 256 channels as the current 2D feature map.
[0088] Next, the generated baseline 2D feature map is subtracted pixel by pixel from the current 2D feature map to obtain a 64x64x256 residual feature map.
[0089] Then, the sum of the response intensities of all pixels in the residual feature map is calculated. Specifically, the absolute values of the 64x64 pixel values of all 256 channels in the residual feature map are summed.
[0090] The preset defect threshold is set to 10000. If the sum of the calculated response intensities exceeds 10000, a real defect is determined to exist in the current sample to be tested. If the sum does not exceed 10000, a real defect is determined to not exist in the current sample to be tested.
[0091] Furthermore, it also includes the following steps: when it is determined that there is a real defect, the residual feature map is input into the preset defect classification structure, the defect type with the highest probability in the probability distribution result output by the defect classification structure is taken as the defect type of the current sample to be detected, and the length, width and depth estimates of the defect of the current sample to be detected are output at the same time.
[0092] The residual feature map, obtained by subtracting the features of the reference two-dimensional feature map from the current two-dimensional feature map pixel by pixel, represents the difference between the current sample to be detected and the normal background reference. Specifically, the residual feature map can be calculated using methods such as pixel value subtraction, absolute difference, and squared difference to highlight the feature response of the defect area.
[0093] A defect classification structure refers to a neural network model that takes a residual feature map as input and outputs a probability distribution of defect types and estimates of geometric dimensions. Specifically, a defect classification structure can be implemented using deep learning models such as Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), or Transformers. For example, a CNN containing multiple convolutional layers, pooling layers, and fully connected layers can be designed. The convolutional layers are used to extract local features from the residual feature map, the pooling layers are used to reduce the feature dimensionality, and the fully connected layers are used for classification and regression.
[0094] The probability distribution result refers to the set of confidence scores given by the defect classification structure for different defect types. Specifically, the probability distribution result can be output using the Softmax function, such that the sum of the probabilities of all defect types is 1. For example, if there are three defect types: scratch, indentation, and foreign object, the probability distribution result might be [0.8, 0.1, 0.1], indicating that the current defect is most likely a scratch.
[0095] Defect types refer to the classification of detected defects to facilitate subsequent quality control and production process improvement. Specifically, defect types can include scratches, indentations, foreign objects, bubbles, cracks, etc.
[0096] Length, width, and depth estimates are numerical values that quantify the geometric dimensions of a defect. Specifically, these estimates can be output from a regression model integrated with the defect classification structure, or they can be independent regression branches. For example, length can be represented as the maximum size of the defect along a certain direction in an image, width as the maximum size perpendicular to the length direction, and depth as the degree of indentation of the defect relative to a surface plane.
[0097] This application inputs the residual feature map into a preset defect classification structure. This structure can use the local high-frequency geometric features and global low-frequency semantic features extracted from the previous scheme, as well as the abnormal information reflected in the residual feature map, to conduct in-depth analysis of defects. It can not only identify defects, but also accurately determine the type of defects and quantify their size. This solves the problem in the existing scheme of how to accurately and efficiently classify defects and quantify their size after confirming the existence of real defects.
[0098] Secondly, see Figure 2 This application also proposes a visual inspection system for appearance defects in inductors, comprising: Image queue acquisition module 210 is used to acquire a time sequence queue of surface images of multiple inductor coils within the same production stage; The baseline establishment module 220 is used to extract feature region images of inductor coil samples that have been confirmed to be defect-free from the time sequence queue of surface images, extract the texture baseline features of each feature region image, and establish an initial normal background baseline based on each texture baseline feature. The feature extraction module 230 is used to extract local high-frequency geometric features and global low-frequency semantic features of the feature region image of the current sample to be detected using a convolutional neural network, and outputs a multi-dimensional numerical vector representing the surface texture state of the current sample to be detected as the current high-dimensional feature and a two-dimensional matrix data representing the texture response intensity as the current two-dimensional feature map. The state classification module 240 is used to classify the changing state of the current sample to be detected based on the deviation distance between the current high-dimensional features and the initial normal background benchmark, the changing trend of the high-dimensional features of the inductor coil sample that has been confirmed to be defect-free in the feature space, and the distribution range of the feature response in the current two-dimensional feature map in the spatial location. The benchmark update and defect determination module 250 is used to update the initial normal background benchmark based on the change state of the current sample to be detected, to obtain the current normal background benchmark, and to confirm whether there is a real defect in the current sample to be detected based on the current normal background benchmark and the current two-dimensional feature map.
[0099] The above technical solution can perfectly meet the high-cycle, high-precision quality monitoring requirements of continuous automated production lines for inductor coils.
[0100] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for visually inspecting appearance defects in inductor coils, characterized in that, include: Acquire a timing queue of surface images of multiple inductor coils within the same production stage; Feature region images of inductor coil samples confirmed to be defect-free are extracted from the time sequence queue of surface images. Texture baseline features of each feature region image are extracted, and an initial normal background baseline is established based on each texture baseline feature. The convolutional neural network is used to extract the local high-frequency geometric features and global low-frequency semantic features of the feature region image of the current sample to be detected, and outputs a multi-dimensional numerical vector representing the surface texture state of the current sample to be detected as the current high-dimensional feature and a two-dimensional matrix data for representing the texture response intensity as the current two-dimensional feature map. Based on the deviation distance between the current high-dimensional feature and the initial normal background benchmark, and the spatial distribution range of the feature response in the current two-dimensional feature map, the change state of the current sample to be detected is classified. The initial normal background benchmark is updated based on the change state of the current sample to be detected to obtain the current normal background benchmark. The presence of a real defect in the current sample to be detected is confirmed based on the current normal background benchmark and the current two-dimensional feature map.
2. The visual inspection method for appearance defects of inductor coils according to claim 1, characterized in that, The step of acquiring the timing queue of surface images of multiple inductor coils within the same production stage includes: Image data of multiple spectral channels of the multiple inductors are acquired. The multiple spectral channels include a visible light channel and a near-infrared channel for acquiring images of the enameled wire winding area, and an ultraviolet channel for acquiring images of the terminal welding area. Associate each image data with an absolute timestamp, production batch number, equipment mold number, and sequence number in the surface image time sequence queue, and store it in the surface image time sequence queue.
3. The visual inspection method for appearance defects of inductor coils according to claim 2, characterized in that, The step of extracting feature region images of inductor coil samples confirmed to be defect-free from the time-series queue of surface images includes: For the spectral image corresponding to the enameled wire winding region, a guided filtering method is used for enhancement processing; For the spectral image corresponding to the terminal welding area, an adaptive histogram equalization method is used for enhancement processing; Using a preset geometric template, the enameled wire winding area and terminal welding area of the inductor coil sample that has been confirmed to be defect-free are matched to generate corresponding binarized mask images. The enhanced spectral image is ANDed with the corresponding binarized mask image to extract the images of each feature region.
4. The visual inspection method for appearance defects of inductor coils according to claim 3, characterized in that, The step of extracting the texture baseline features of each of the feature regions and establishing an initial normal background baseline based on each of the texture baseline features includes: Statistical analysis is performed on the images of each of the aforementioned feature regions to extract texture baseline features, which include the average depth of the indentation at the intersection of the windings, the average gradient amplitude of the texture edge, and the basic flatness of the terminal surface. Based on the extracted texture baseline features, a multidimensional distribution model of each feature region image is established, and the multidimensional distribution model is used as the initial normal background reference.
5. The visual inspection method for appearance defects of inductor coils according to claim 4, characterized in that, The steps of using a convolutional neural network to extract local high-frequency geometric features and global low-frequency semantic features of the feature region image of the current sample to be detected, and outputting the current high-dimensional features and the current two-dimensional feature map, include: A pre-built convolutional neural network including a multi-scale feature pyramid structure is invoked. The shallow convolution of the convolutional neural network is used to extract the local high-frequency geometric features of the scratch edges and indentation contours of the current sample to be detected. The deep convolution of the convolutional neural network is used to extract the global low-frequency semantic features of the winding density and overall indentation distribution of the current sample to be detected. The feature region image of the current sample to be detected is input into the convolutional neural network for forward propagation processing; The current high-dimensional feature is output before the last fully connected layer of the convolutional neural network; The two-dimensional feature map output by the convolutional layer of the preset scale in the multi-scale feature pyramid structure is selected as the current two-dimensional feature map.
6. The method for visually inspecting appearance defects of an inductor coil according to claim 5, characterized in that, The step of classifying the change state of the current sample to be detected based on the deviation distance between the current high-dimensional features and the initial normal background benchmark and the spatial distribution range of the feature response in the current two-dimensional feature map includes: Calculate the deviation distance between the current high-dimensional feature and the mean vector of the initial normal background benchmark; When the deviation distance does not exceed the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map whose texture response intensity exceeds the preset intensity threshold is not less than the preset area threshold, the change state is determined to be neither overall drift nor local mutation. When the deviation distance exceeds the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map whose texture response intensity exceeds the preset intensity threshold is not less than the preset area threshold, the change state is determined to be only overall drift. When the deviation distance does not exceed the preset tolerance range, and the area of the continuous pixel region in the current two-dimensional feature map where the texture response intensity exceeds the preset intensity threshold is less than the preset area threshold, the change state is determined to be a local mutation only. When the deviation distance exceeds the preset tolerance range and the area of the continuous pixel region in the current two-dimensional feature map whose texture response intensity exceeds the preset intensity threshold is less than the preset area threshold, the change state is determined to be the simultaneous existence of overall drift and local mutation.
7. The method for visually inspecting appearance defects of inductor coils according to claim 6, characterized in that, The step of updating the initial normal background benchmark based on the change state of the current sample to be detected to obtain the current normal background benchmark includes: When the change state is characterized by neither overall drift nor local abrupt change, the initial normal background reference is used as the current normal background reference. When the change state is only overall drift, if the deviation distance does not exceed the preset maximum wear limit threshold, the current high-dimensional features are fused into the initial normal background benchmark using a smooth update method to obtain the current normal background benchmark; otherwise, the update of the initial normal background benchmark is paused and a device maintenance alarm command is output. When the change state is a local mutation only, the initial normal background benchmark is used as the current normal background benchmark; When the change state is characterized by both overall drift and local mutation, the current high-dimensional feature is purified to filter out local mutation components, and the purified current high-dimensional feature is then fused into the initial normal background benchmark using a smooth update method to obtain the current normal background benchmark.
8. The visual inspection method for appearance defects of inductor coils according to claim 7, characterized in that, The step of confirming whether there is a real defect in the current sample to be detected based on the current normal background benchmark and the current two-dimensional feature map includes: The mean vector of the current normal background benchmark is input into the decoding structure of the convolutional neural network for inverse mapping to generate a benchmark two-dimensional feature map with the same spatial scale and number of channels as the current two-dimensional feature map. The residual feature map is obtained by subtracting the features of the reference two-dimensional feature map from the features of the current two-dimensional feature map pixel by pixel. The sum of the response intensities of all pixels on the residual feature map is calculated. When the sum of the response intensities exceeds a preset defect presence threshold, it is determined that there is a real defect in the current sample to be detected. When the sum of the response intensities does not exceed the defect presence threshold, it is determined that there is no real defect in the current sample to be detected.
9. The visual inspection method for appearance defects of inductor coils according to claim 8, characterized in that, It also includes the following steps: When a real defect is determined to exist, the residual feature map is input into a preset defect classification structure. The defect type with the highest probability in the probability distribution results output by the defect classification structure is taken as the defect type of the current sample to be detected. At the same time, the estimated length, width and depth of the defect of the current sample to be detected are output.
10. A visual inspection system for appearance defects of inductors, used to perform the visual inspection method for appearance defects of inductors as described in any one of claims 1 to 9, characterized in that, The system includes: The image queue acquisition module is used to acquire the time sequence queue of surface images of multiple inductor coils within the same production stage. The baseline establishment module is used to extract feature region images of inductor coil samples that have been confirmed to be defect-free from the surface image time sequence queue, extract texture baseline features of each feature region image, and establish an initial normal background baseline based on each texture baseline feature. The feature extraction module is used to extract local high-frequency geometric features and global low-frequency semantic features of the feature region image of the current sample to be detected using a convolutional neural network, and outputs a multi-dimensional numerical vector representing the surface texture state of the current sample to be detected as the current high-dimensional feature and a two-dimensional matrix data representing the texture response intensity as the current two-dimensional feature map. The state classification module is used to classify the changing state of the current sample to be detected based on the deviation distance between the current high-dimensional feature and the initial normal background benchmark, the changing trend of the high-dimensional feature of the inductor coil sample confirmed to be defect-free in the feature space, and the distribution range of the feature response in the current two-dimensional feature map in the spatial location. The benchmark update and defect determination module is used to update the initial normal background benchmark based on the change state of the current sample to be detected, to obtain the current normal background benchmark, and to confirm whether there is a real defect in the current sample to be detected based on the current normal background benchmark and the current two-dimensional feature map.
