A defect detection and rating method, device, equipment and storage medium
Through the combination of coaxial adjustable dual light source vision system and semantic segmentation network, the complexity and reflection problems of copper wire winding posture in inductive detection are solved, and efficient and accurate defect detection and rating are achieved.
Patent Information
- Application Number
- CN202510452247.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-04-10
AI Technical Summary
In the prior art, there are difficulties in detecting inductance defects, such as misjudgment or misjudgment caused by copper wire cross-blocking and copper wire reflection. Traditional manual detection is inefficient and susceptible to interference from subjective factors.
Image acquisition is performed using a coaxial adjustable dual light source vision system, and the coil contour area is accurately extracted in combination with a semantic segmentation network, feature areas are screened through multiple image processing algorithms, and defect level quantization neural network is used for rating.
It significantly improves the accuracy and efficiency of inductive defect detection, reduces the risk of misjudgment, realizes automated defect level assessment, and shortens the detection process.
Smart Images

Figure CN119963559B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular, to a method, device, equipment and storage medium for defect detection and rating. Background Art
[0002] In the field of electronic component manufacturing, as a key component, the quality detection of inductors is crucial. Among them, the defect detection of inductor coils is a key link to ensure the performance of inductors.
[0003] However, in current industrial production, there are many difficulties in inductor defect detection. For example, the winding postures of copper wires are diverse and there is no unified standard; the copper wires cross and block each other, making it difficult to judge their positions and states, and it is easy to make misjudgments or omissions; the reflection of copper wires causes inconsistent colors, greatly reducing the accuracy of the detection method based on color features.
[0004] Traditional manual detection has low detection efficiency when facing such diverse detection difficulties, and is easily interfered by subjective factors, resulting in misjudgments and omissions, seriously affecting the control of product quality and the improvement of production efficiency.
[0005] It can be seen that there is still room for improvement in the prior art. Summary of the Invention
[0006] In order to overcome the deficiencies of the prior art, the purpose of the present invention is to provide a method, device, equipment and storage medium for defect detection and rating, which comprehensively uses diversified image processing technologies and neural networks, comprehensively optimizes the process and accuracy of defect detection, and significantly improves the accuracy and efficiency of detection.
[0007] The first aspect of the present invention provides a method for defect detection and rating, including: performing image acquisition on an inductor to obtain a basic image; constructing a semantic segmentation network, and using the semantic segmentation network to extract regions from the basic image to obtain a coil contour region; performing image processing and region screening on the coil contour region to obtain a feature region; extracting the center coordinates of the magnetic core, and calculating the distance between the edge points of the feature region and the center coordinates of the magnetic core to obtain magnetic core distance data; constructing a defect level quantization neural network, and using the defect level quantization neural network to rate the magnetic core distance data to obtain a rating result.
[0008] Optionally, in the first implementation manner of the first aspect of the present invention, the performing image acquisition on an inductor to obtain a basic image includes: constructing a coaxial adjustable dual-light source vision system; performing image acquisition on the inductor through the coaxial adjustable dual-light source vision system to obtain an inductor red-green-blue image; performing data preprocessing on the inductor red-green-blue image to obtain a basic image.
[0009] Optionally, in the second implementation manner of the first aspect of the present invention, the steps of constructing a semantic segmentation network and using the semantic segmentation network to extract regions from the base image to obtain the coil contour region include: preliminarily classifying the base image to obtain unqualified inductor images; labeling connected regions of the unqualified inductor images to obtain labeled images; constructing a semantic segmentation network; and using the semantic segmentation network to extract regions of interest from the labeled images to obtain the coil contour region.
[0010] Optionally, in the third implementation manner of the first aspect of the present invention, the steps of constructing a semantic segmentation network include: constructing a basic network framework; embedding a coordinate attention module into the basic network framework to obtain a first improved network; replacing the standard convolution of the first improved network with a selective convolution kernel to obtain a second improved network; and training the second improved network to obtain the semantic segmentation network.
[0011] Optionally, in the fourth implementation manner of the first aspect of the present invention, the steps of performing image processing and region screening on the coil contour region to obtain a feature region include: performing morphological processing on the coil contour region to obtain a repaired region; performing region growing on the repaired region to obtain a connected region; and performing region screening on the connected region to obtain the feature region.
[0012] Optionally, in the fifth implementation manner of the first aspect of the present invention, the steps of extracting the core center coordinates and calculating the distances between the edge points of the feature region and the core center coordinates to obtain core distance data include: using a circle fitting algorithm to detect the edges of the core to obtain the first core center coordinates and the second core center coordinates; calculating the distances between the edge points of the feature region and the first core center coordinates to obtain first distance data; calculating the distances between the edge points of the feature region and the second core center coordinates to obtain second distance data; and integrating the first distance data and the second distance data to obtain the core distance data.
[0013] Optionally, in the sixth implementation manner of the first aspect of the present invention, the steps of constructing a defect level quantization neural network and using the defect level quantization neural network to rate the core distance data to obtain a rating result include: pre-rating the inductor according to a preset scoring threshold to obtain comparison data; constructing a defect level quantization neural network; and inputting the core distance data and the comparison data into the defect level quantization neural network for defect rating to obtain the rating result.
[0014] In a second aspect of the present invention, a defect detection and rating device is provided, including: an acquisition module for acquiring an image of an inductor to obtain a basic image; a segmentation module for constructing a semantic segmentation network and using the semantic segmentation network to extract regions from the basic image to obtain a coil contour region; an optimization module for performing image processing and region screening on the coil contour region to obtain a feature region; a calculation module for extracting the coordinates of the magnetic core center and calculating the distances between the edge points of the feature region and the magnetic core center coordinates to obtain magnetic core distance data; a rating module for constructing a defect level quantization neural network and using the defect level quantization neural network to rate the magnetic core distance data to obtain a rating result.
[0015] In a third aspect of the present invention, a defect detection and rating device is provided. The defect detection and rating device includes: a memory and at least one processor, wherein instructions are stored in the memory; at least one of the processors calls the instructions in the memory so that the defect detection and rating device executes each step of the defect detection and rating method described in any one of the above.
[0016] In a fourth aspect of the present invention, a computer-readable storage medium is provided. Instructions are stored on the computer-readable storage medium, and when the instructions are executed by a processor, each step of the defect detection and rating method described in any one of the above is implemented.
[0017] In the technical solution of the present invention, first, inductor image data is acquired, and then the coil contour region is accurately extracted by means of an advanced semantic segmentation network to effectively separate the copper wire and the magnetic core on the inductor; a variety of image processing algorithms are used to deeply optimize the extracted coil contour region to screen out a more accurate feature region; based on the screened feature region, the magnetic core distance for judging defects is accurately calculated; finally, the magnetic core distance is input into a neural network, and the neural network completes the defect rating; the present invention comprehensively uses diversified image processing technologies and neural networks to comprehensively optimize the defect detection process and accuracy, and significantly improves the detection accuracy and efficiency. Description of the Drawings
[0018] The above and / or additional aspects and advantages of the present invention will become apparent and be readily understood from the following description of the embodiments in conjunction with the accompanying drawings, where:
[0019] Figure 1 is the first flow chart of the defect detection and rating method provided by the embodiment of the present invention;
[0020] Figure 2 is the second flow chart of the defect detection and rating method provided by the embodiment of the present invention;
[0021] Figure 3The third flowchart of the defect detection and rating method provided by the embodiments of the present invention;
[0022] Figure 4 The fourth flowchart of the defect detection and rating method provided by the embodiments of the present invention;
[0023] Figure 5 The fifth flowchart of the defect detection and rating method provided by the embodiments of the present invention;
[0024] Figure 6 The sixth flowchart of the defect detection and rating method provided by the embodiments of the present invention;
[0025] Figure 7 The seventh flowchart of the defect detection and rating method provided by the embodiments of the present invention;
[0026] Figure 8 The structural schematic diagram of the defect detection and rating device provided by the embodiments of the present invention;
[0027] Figure 9 The structural schematic diagram of the defect detection and rating equipment provided by the embodiments of the present invention. Detailed implementation manners
[0028] The present invention provides a defect detection and rating method, device, equipment and storage medium. First, inductance image data is collected, and then the coil contour area is accurately extracted by means of an advanced semantic segmentation network to effectively separate the copper wire and the magnetic core on the inductance; a variety of image processing algorithms are used to deeply optimize the extracted coil contour area to screen out more accurate feature areas; based on the screened feature areas, the magnetic core distance for judging defects is accurately calculated; finally, the magnetic core distance is input into the neural network, and the neural network completes the defect rating. The present invention comprehensively uses diversified image processing technologies and neural networks to comprehensively optimize the defect detection process and accuracy, and significantly improves the detection accuracy and efficiency.
[0029] The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of the present invention are used to distinguish similar objects and do not have to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order different from that shown or described herein. In addition, the terms "comprising" or "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment comprising a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or equipment.
[0030] For ease of understanding, the specific process of the embodiments of the present invention will be described below. Please refer to Figure 1 One embodiment of the defect detection and rating method in the embodiments of the present invention includes:
[0031] 101. Collect an image of the inductor to obtain a basic image;
[0032] In this embodiment, the red - green - blue image (RGB image) of the inductor is collected through a multi - modal vision system (such as a dual - light source system), and image quality is improved using pre - processing techniques such as denoising and normalization. Step 101 provides the original data input for all subsequent steps, and its sampling result and pre - processing result directly affect the segmentation accuracy.
[0033] 102. Construct a semantic segmentation network and use the semantic segmentation network to extract regions from the basic image to obtain the coil contour region;
[0034] In this embodiment, an improved semantic segmentation network is constructed. The semantic segmentation network is used to separate the copper wire from the magnetic core in the inductor image and accurately extract the coil contour region, solving the problem of feature blurring under complex winding postures. The semantic segmentation result of step 102 is the basis for the image processing in step 103, ensuring the accuracy of feature region extraction.
[0035] 103. Perform image processing and region screening on the coil contour region to obtain a feature region;
[0036] In this embodiment, algorithms such as morphological processing and region growing are applied to the coil contour region to repair the broken regions and screen the connected regions, and further filter out noise in combination with geometric features (such as area) to obtain a feature region with defect - indicating significance.
[0037] 104. Extract the center coordinates of the magnetic core and calculate the distance between the edge points of the feature region and the center coordinates of the magnetic core to obtain magnetic core distance data;
[0038] In this embodiment, the center coordinates of the magnetic core are obtained based on the circle fitting algorithm, the distance between the edge points of the feature region and the magnetic core is quantified, and magnetic core distance data reflecting the positional relationship between the copper wire and the magnetic core is generated, providing an objective basis for defect determination.
[0039] 105. Construct a defect level quantification neural network and use the defect level quantification neural network to rate the magnetic core distance data to obtain a rating result;
[0040] In this embodiment, a defect level quantification neural network is constructed, and the defect level quantification neural network is used to fuse and calculate the magnetic core distance data and the scoring data of the manual control experiment, and the automatic assessment of the defect level is realized through non - linear mapping.
[0041] In the embodiment of the present invention, first, inductance image data is collected. Subsequently, the coil contour area is accurately extracted by means of an advanced semantic segmentation network to effectively separate the copper wire and the magnetic core on the inductance. A variety of image processing algorithms are used to deeply optimize the extracted coil contour area to screen out a more accurate feature area. Then, based on the screened feature area, the magnetic core distance for defect judgment is accurately calculated. Finally, the magnetic core distance is input into the neural network, and the neural network completes the defect rating. By combining the vision system and algorithms, the present invention solves the problem of blurred features caused by copper wire reflection and cross occlusion in a single modality, and improves the robustness of defect recognition in complex scenarios. Moreover, the quantization neural network integration algorithm is used to integrate algorithm data and manual experience, reduce subjective judgment differences, and realize automatic defect level assessment. An end-to-end detection and rating process is realized, forming a closed loop from image acquisition to rating result output, shortening the manual intervention link in traditional detection, significantly improving the detection efficiency, and reducing the risk of misjudgment. The present invention comprehensively uses a variety of image processing technologies and neural networks to comprehensively optimize the defect detection process and accuracy, and significantly improve the detection accuracy and efficiency.
[0042] Please refer to Figure 2 , two embodiments of the defect detection and rating method in the embodiment of the present invention include:
[0043] 201. Construct a coaxial adjustable dual-light source vision system;
[0044] In this embodiment, the coaxial adjustable dual-light source vision system includes an industrial camera, a lens, a first ring light source, a second ring light source, and a mounting bracket. The industrial camera, as the core device for image acquisition, is responsible for observing and collecting the red, green, and blue images of the inductance and copper wire in real time. The first ring light source and the second ring light source have different diameters and are coaxially installed up and down. By adjusting their brightness, the distribution and intensity of the light are changed to provide multi-angle and multi-intensity illumination for the inductance, so as to reduce the influence of shadows on the image quality. The mounting bracket is used to fix the industrial camera, lens, first ring light source, and second ring light source to ensure the relative positions between them are stable, and to ensure the stability and accuracy of the entire vision system;
[0045] The coaxial adjustable dual-light source vision system irradiates the inductance from different angles with two ring light sources. By separately adjusting the brightness of the two ring light sources, the incident angle and intensity of the light are changed, so as to realize flexible control of the illumination conditions on the surface of the inductance. This multi-angle and adjustable illumination method can effectively reduce the shadow area, make the features on the surface of the inductance, especially the edges of the copper wire, more clearly presented, effectively solve the problem of image shadows caused by uneven illumination, and make the edges of the copper wire in the collected inductance image clearer.
[0046] 202. The image of the inductor is captured through a coaxial adjustable dual-light source vision system to obtain the red, green, and blue images of the inductor.
[0047] In this embodiment, after the coaxial adjustable dual-light source vision system is constructed and the light source brightness is adjusted, the industrial camera starts to observe the inductor in real time. When the image of the inductor meets the set standard, the industrial camera automatically triggers the image capture function to capture the red, green, and blue images of the inductor. The red, green, and blue images contain the information of the inductor in the red, green, and blue color channels, which can comprehensively reflect the appearance characteristics of the inductor and provide rich data for subsequent image processing and analysis.
[0048] 203. The red, green, and blue images of the inductor are preprocessed to obtain a basic image.
[0049] In this embodiment, the data preprocessing mainly includes operations such as denoising, normalization, and image enhancement. The denoising operation removes the noise interference in the image through a filtering algorithm to improve the clarity of the image. The normalization operation adjusts the pixel values of the image to a unified range, making different images comparable and reducing the image differences caused by factors such as light intensity. The image enhancement operation expands the diversity of the dataset through methods such as flipping, translation, scaling, rotation, brightness adjustment, contrast adjustment, and saturation adjustment.
[0050] By preprocessing the red, green, and blue images of the inductor, the noise in the image can be effectively removed, the pixel range of the image can be unified, and the diversity of the dataset can be expanded. A basic image with higher image quality and richer features can be obtained, improving the accuracy and reliability of defect detection.
[0051] Please refer to Figure 3 , the three embodiments of the defect detection and rating method in the embodiments of the present invention include:
[0052] 301. The basic image is initially classified to obtain the images of unqualified inductors.
[0053] In this embodiment, the initial classification is to judge the basic image based on a preset standard, and the inductor samples are divided into two categories: OK (qualified inductor image) and NG (unqualified inductor image). The inductor is divided into a first magnetic core (inner magnetic core, generally an I-shaped magnetic core), a second magnetic core (outer magnetic core, generally a toroidal magnetic core) arranged outside the first magnetic core, and a copper coil wound around the first magnetic core. If the wire of the copper coil in the inductor image exceeds the first magnetic core by one wire diameter size visually, or touches the second magnetic core (regardless of whether it exceeds one wire diameter size), then the inductor image can be judged as an unqualified inductor image; otherwise, it is a qualified inductor image. During subsequent model testing, the omission rate and misjudgment rate can be evaluated based on the tested OK images and NG images.
[0054] By initially classifying the base image, inductance images that may have defects (unqualified inductance images) can be quickly screened out, quickly locating the parts that need to be focused on, and improving the detection efficiency.
[0055] 302. Perform connected component labeling on the unqualified inductance image to obtain a labeled image;
[0056] In this embodiment, connected component labeling is an image processing technique used to identify sets of connected pixels in an image and assign a unique label to each connected component; in the unqualified inductance image, by analyzing the connectivity between pixels, different objects or regions such as copper wires and magnetic cores can be distinguished; for example, for the copper wire region, its pixels are usually connected, and a labeling tool is used to perform pixel-level labeling on the copper wire contour, marking the connected pixels as a whole; providing a more accurate basis for subsequent extraction of the region of interest (ROI).
[0057] At the same time, aiming at the problem that it is difficult to distinguish due to the intersection of copper wires during the detection of traditional algorithms, estimated line segments are added to connect closed regions into connected domains during labeling to ensure accurate labeling of each sample.
[0058] 303. Construct a semantic segmentation network;
[0059] In this embodiment, a U-Net architecture is adopted to construct the semantic segmentation network; and part of the labeled images are used to train the semantic segmentation network so that it can learn the connected domain features of the copper wire.
[0060] 304. Use the language segmentation network to extract the region of interest from the labeled image to obtain the coil contour region;
[0061] In this embodiment, after being trained, the semantic segmentation network can classify each pixel in the labeled image. By analyzing the class labels of each pixel, the pixels belonging to the coil (copper wire) are screened out and connected to form a complete region, that is, the coil contour region; thus, more precisely analyzing the shape, position and other features of the coil to determine whether the inductance has defects.
[0062] Please refer to Figure 4 , the four embodiments of the defect detection and rating method in the embodiments of the present invention include:
[0063] 401. Construct a basic network framework;
[0064] In this embodiment, the basic framework of the semantic segmentation network adopts a U-Net (encoder-decoder) structure; the encoder consists of multiple convolutional layers and pooling layers. The convolutional operation is used to extract the features of the image, and the pooling operation reduces the size of the feature map, reduces the computational amount, and at the same time increases the receptive field, enabling the network to learn more advanced features; the decoder restores the feature map to the size of the original image through the upsampling layer and convolutional layer to achieve pixel-level classification; the basic network framework provides a stable structural basis for subsequent improvement and optimization, enabling the network to perform preliminary feature extraction and processing on the input image.
[0065] 402. Embed the coordinate attention module into the basic network framework to obtain the first improved network;
[0066] In this embodiment, a coordinate attention (CoordinateAttention) module is embedded after each downsampling block of the encoder in the U-Net architecture; the core idea of the coordinate attention module is to encode the horizontal and vertical position information into the channel attention, then perform horizontal and vertical global pooling on the feature map to generate position-sensitive channel attention weights, and finally multiply the weights element-wise with the original features to enhance the global position perception ability;
[0067] Specifically, for the scenario of copper wire cross-region fracture, the coordinate attention module can encode global position information and connect the occluded copper wires; for the scenario of uneven color caused by reflection, the coordinate attention module can highlight the copper wire region by increasing the channel attention; for the scenario of diverse copper wire thicknesses, the coordinate attention module can utilize its position perception to enhance the integrity of the overall contour of the copper wire; in addition, because the additional computational amount introduced by the coordinate attention module is relatively small and will not have too much impact on the running efficiency of the network, it is suitable for industrial real-time detection;
[0068] By adding the coordinate attention module, the first improved network has enhanced position perception ability compared to the basic network framework.
[0069] 403. Replace the standard convolution of the first improved network with a selective convolution kernel to obtain the second improved network;
[0070] In this embodiment, some standard convolutions in the convolutional layers of the encoder and decoder of the first improved network are replaced with selective convolution kernels (SKConv). The selective convolution kernels process feature maps in parallel through multiple convolution kernels of different sizes (such as 3×3, 5×5, etc.); each selective convolution kernel has a different receptive field and can capture feature information of different scales; when processing the feature map, the selective convolution kernel dynamically adjusts the weights of each convolution kernel according to the input features, and then fuses the outputs of different convolution kernels to obtain the final feature representation; in this way, the network can adaptively select an appropriate receptive field to process targets of different scales, enhancing the perception ability of multi-scale features, thereby achieving multi-scale adaptation of copper wires and increasing the perception of the thickness change of copper wires;
[0071] Specifically, for the scenario of copper wire breakage in the crossing area, the selective convolution kernel can use its multi-scale receptive field to capture the details of the crossing points of copper wires, so as to identify the broken copper wire area; for the scenario of uneven color caused by reflection, the selective convolution kernel can dynamically adjust the receptive field to adapt to the gray-scale change of the copper wire reflection area; for the scenario of diverse copper wire thicknesses, the selective convolution kernel can utilize its multi-branch fusion characteristic to adapt to different wire diameter features;
[0072] By replacing the selective convolution kernel, the second improved network has increased multi-scale feature capture ability compared with the first improved network.
[0073] 404. Train the second improved network to obtain a semantic segmentation network;
[0074] In this embodiment, the labeled inductor image dataset (including a large number of inductor images and their corresponding true annotation results) is used as the training set of the second improved network to train the second improved network; during the training process, the input image is input into the second improved network, and the network will output the segmentation result of the image; then, the output result of the network is compared with the true annotation result, and the loss function is used to calculate the difference between the two; the loss function usually selects the cross-entropy loss function; then, the optimizer updates the parameters of the network according to the gradient of the loss function, so that the value of the loss function gradually decreases; through multiple iterative trainings, the network continuously adjusts the parameters and learns the features of different objects and defects in the inductor image, thereby improving the segmentation ability of the inductor image and being able to accurately identify copper wires, magnetic cores, and various defect areas in practical applications.
[0075] Please refer to Figure 5 , the five embodiments of the defect detection and rating method in the embodiments of the present invention include:
[0076] 501. Perform morphological processing on the coil contour area to obtain a repair area;
[0077] In this embodiment, the processing of the coil contour region is divided into three levels of processing steps. The first-level processing is morphological processing to repair the holes and fracture regions generated during coil segmentation and smooth the edges of the copper wires. Specifically, first, the opening operation is used to eliminate isolated noise points and disconnect small adhesions, and then the closing operation is used to fill the small holes inside the copper wires and connect the fractured copper wires. Through morphological operations, the preliminary repair of the coil contour region is completed, providing a more complete basis for subsequent region growing.
[0078] 502. Perform region growing processing on the repaired region to obtain a connected region.
[0079] In this embodiment, the second-level processing of the coil contour region is region growing processing. Its purpose is to solve the fracture problem caused by the reflection of crossed copper wires, avoid region fragmentation caused by uneven illumination or reflection, and ensure the connectivity of the segmented regions. Specifically, first, calculate the zero-order moment (area) and the first-order moment (centroid) of the repaired region, and take the centroid as the seed point. Then, according to the region growing criteria (such as gray difference and color difference), search and gradually expand the region through 4-neighborhood or 8-neighborhood (selected based on the copper wire density). Stop growing when no neighborhood points that meet the conditions can be found or the preset number of iterations is reached, and complete the region growing processing.
[0080] 503. Perform region screening processing on the connected region to obtain a characteristic region.
[0081] In this embodiment, the third-level processing of the coil contour region is region screening processing. Its purpose is to perform noise filtering, screen out and exclude false regions with too small an area, and retain the real copper wire regions. Specifically, calculate the zero-order moment of the connected region to calculate the area of the coil contour, and then screen out the regions that meet the requirements according to their area sizes, that is, the characteristic regions.
[0082] It should be noted that morphological processing provides a more complete repaired region for region growing processing, reducing the deviation in seed point selection caused by holes. Region growing repairs the remaining fractures after morphological processing through connectivity expansion to generate a connected region with a continuous copper wire contour. Region screening processing filters out the connected regions that do not meet the area requirements based on the area, and finally obtains the characteristic regions. These three steps form a closed loop of "repair, connect, screen", jointly ensuring the integrity and accuracy of copper wire segmentation and providing a reliable basis for subsequent magnetic core distance calculation.
[0083] Please refer to Figure 6 , the six embodiments of the defect detection and rating method in the embodiment of the present invention include:
[0084] 601. Use the circle fitting algorithm to perform edge detection on the magnetic core to obtain the first magnetic core center coordinate and the second magnetic core center coordinate.
[0085] In this embodiment, the circle fitting algorithm (such as the Hough circle transform) determines the edge of the magnetic core and calculates its center coordinates by detecting the circular features of the closed contour in the image. First, edge detection (such as Canny edge detection) is performed on the feature region to extract the contour line of the magnetic core; then, the circumcircle of the magnetic core is fitted by the circle fitting algorithm, so as to obtain the center coordinates of the first magnetic core (inner magnetic core) and the second magnetic core (outer magnetic core), that is, the first magnetic core coordinates and the second magnetic core coordinates;
[0086] The first magnetic core coordinates and the second magnetic core coordinates are used to judge the distance between the edge points of the copper wire and the center point of the magnetic core, and the positioning of the magnetic core center and the copper wire edge is completed by mathematical means, so as to solve the problem of large error in the traditional manual positioning method and improve the accuracy of defect judgment.
[0087] 602. Calculate the distance between the edge points of the feature region and the center coordinates of the first magnetic core to obtain the first distance data;
[0088] In this embodiment, based on the center coordinates of the first magnetic core obtained in step 601, all the edge points of the feature region are traversed, the Euclidean distance from each edge point to the center of the first magnetic core is calculated, and all the distance values are stored as the first distance data;
[0089] By quantifying the distance between the edge points of the copper wire and the first magnetic core (inner magnetic core), it provides data support for judging whether the copper wire exceeds the first magnetic core by one wire diameter, solves the problem of strong subjectivity in manual measurement, and improves the objectivity of detection.
[0090] 603. Calculate the distance between the edge points of the feature region and the center coordinates of the second magnetic core to obtain the second distance data;
[0091] In this embodiment, based on the center coordinates of the second magnetic core obtained in step 601, the edge points of the feature region are traversed, the Euclidean distance from each edge point to the center of the second magnetic core is calculated, and all the distance values are stored as the second distance data;
[0092] By quantifying the distance between the edge points and the second magnetic core (outer magnetic core), it provides data support for judging whether the copper wire touches the second magnetic core, solves the problem of fuzzy contact judgment under complex winding postures, and improves the sensitivity of defect detection.
[0093] 604. Integrate the first distance data and the second distance data to obtain the magnetic core distance data;
[0094] In this embodiment, the first distance data and the second distance data are the judgment bases for two situations (the first magnetic core and the second magnetic core); these two data are integrated to form a unified defect judgment basis, which solves the problem of one-sidedness of a single distance index, provides a more comprehensive feature input for the subsequent neural network rating, and improves the reliability of defect level evaluation.
[0095] Please refer to Figure 7 , seven embodiments of the defect detection and rating method in the embodiments of the present invention include:
[0096] 701. Pre - rate the inductor according to a preset scoring threshold to obtain control data;
[0097] In this embodiment, first prepare multiple groups of inductor samples, and then preset the distance thresholds for qualified, unqualified, and limit samples according to wire diameter size, magnetic core parameters, and production standards. Then arrange multiple experimenters to score the obviousness of the defects of the inductor samples under the same lighting and observation conditions (such as 1 - 5 points, 5 points for the most obvious defect and 1 point for the least defect). Finally, select reasonable scoring data through a voting rule (such as taking the median or mode) to form a control data set, which is the control data. The scoring threshold defines the mapping relationship between the defect level and the score, and it provides a true and reliable label for neural network training as the reference data.
[0098] 702. Construct a defect - level quantization neural network;
[0099] In this embodiment, a neural network is constructed using a multi - layer perceptron (MLP). The network structure has 5 layers, including an input layer, 4 hidden layers, and 1 output layer. The activation function selects the ReLU (Rectified Linear Unit) function, the optimizer selects the Adam optimizer, the loss function selects the L1 loss function, and the learning rate is set to 0.001. The input layer is used to receive magnetic core distance data and control data. The hidden layers extract non - linear features through the ReLU activation function, with dimensions of 512, 256, 128, and 64 in sequence. The output layer outputs the probability values of 5 levels.
[0100] 703. Input the magnetic core distance data and control data into the defect - level quantization neural network for defect rating to obtain a rating result;
[0101] In this embodiment, the mapping relationship between the distance (magnetic core distance data) and the manual score (control data) is fitted through a neural network algorithm to realize the automatic quantization of the defect level, solve the problem of relying on manual experience in traditional methods, and improve the rating efficiency and consistency.
[0102] The above describes the defect detection and rating method in the embodiments of the present invention. Next, the defect detection and rating device in the embodiments of the present invention will be described. Please refer to Figure 8 , an embodiment of the defect detection and rating device in the embodiments of the present invention includes:
[0103] An acquisition module 801, configured to perform image acquisition on the inductor to obtain a basic image;
[0104] A segmentation module 802, configured to build a semantic segmentation network and use the semantic segmentation network to extract regions from a base image to obtain a coil contour region;
[0105] An optimization module 803, configured to perform image processing and region screening on the coil contour region to obtain a feature region;
[0106] A calculation module 804, configured to extract the core center coordinates and calculate the distances between the edge points of the feature region and the core center coordinates to obtain core distance data;
[0107] A rating module 805, configured to build a defect level quantization neural network and use the defect level quantization neural network to rate the core distance data to obtain a rating result;
[0108] In this embodiment, the acquisition module 801 first acquires inductance image data, and then the segmentation module 802 accurately extracts the coil contour region to effectively separate the copper wire and the core on the inductor; the optimization module 803 uses a variety of image processing algorithms to deeply optimize the extracted coil contour region and screen out a more accurate feature region; the calculation module 804 accurately calculates the core distance for defect judgment based on the screened feature region; finally, the core distance is input into the rating module 805 to complete defect rating; the present invention comprehensively uses diversified image processing technologies and neural networks to comprehensively optimize the defect detection process and accuracy, and significantly improves the detection accuracy and efficiency.
[0109] Figure 9 FIG. is a schematic structural diagram of a defect detection and rating device provided by an embodiment of the present invention. The defect detection and rating device 900 may vary greatly due to configuration or performance differences, and may include one or more processors (central processing units, CPU) 910 (for example, one or more processors) and a memory 920, and one or more storage media 930 (for example, one or more mass storage devices) storing application programs 933 or data 932. Among them, the memory 920 and the storage media 930 may be transient storage or persistent storage. The program stored in the storage media 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the defect detection and rating device 900. Further, the processor 910 may be configured to communicate with the storage media 930 and execute a series of instruction operations in the storage media 930 on the defect detection and rating device 900 to implement the steps of the defect detection and rating methods provided by the above method embodiments.
[0110] The defect detection and rating device 900 may further include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input / output interfaces 960, and / or one or more operating systems 931, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art can understand that Figure 9 The structure of the defect detection and rating device shown does not constitute a limitation on the defect detection and rating device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0111] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium, and when the instructions are run on a computer, the computer is caused to execute the steps of the defect detection and rating method.
[0112] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described device or device / unit can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0113] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs, etc., which can store program codes.
[0114] Finally, it should be noted that the above are only preferred examples of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A defect detection and rating method, characterized in that, Including: Performing image acquisition on the inductor to obtain a basic image; Constructing a semantic segmentation network and using the semantic segmentation network to perform region extraction on the basic image to obtain a coil contour region; Performing image processing and region screening on the coil contour region to obtain a feature region; Extracting the core center coordinates and calculating the distances between the edge points of the feature region and the core center coordinates to obtain core distance data; Constructing a defect level quantization neural network and using the defect level quantization neural network to rate the core distance data to obtain a rating result; The constructing of the semantic segmentation network and using the semantic segmentation network to perform region extraction on the basic image to obtain a coil contour region includes: performing preliminary classification on the basic image to obtain a non-conforming inductor image; performing connected region annotation on the non-conforming inductor image to obtain an annotated image; constructing a semantic segmentation network; using the semantic segmentation network to perform region of interest extraction on the annotated image to obtain a coil contour region; The performing of image processing and region screening on the coil contour region to obtain a feature region includes: performing morphological processing on the coil contour region, and completing preliminary repair of the coil contour region through morphological processing to obtain a repaired region; performing region growing processing on the repaired region to obtain a connected region; performing region screening processing on the connected region to obtain a feature region.
2. The defect detection and rating method according to claim 1, wherein The performing of image acquisition on the inductor to obtain a basic image includes: Constructing a coaxial adjustable dual-light source vision system; Performing image acquisition on the inductor through the coaxial adjustable dual-light source vision system to obtain an inductor RGB image; Performing data preprocessing on the inductor RGB image to obtain a basic image.
3. The defect detection and rating method according to claim 1, characterized in that, The constructing of the semantic segmentation network includes: Constructing a basic network framework; Embedding a coordinate attention module into the basic network framework to obtain a first improved network; Replacing the standard convolution of the first improved network with a selective convolution kernel to obtain a second improved network; Training the second improved network to obtain a semantic segmentation network.
4. The defect detection and rating method according to claim 1, wherein The extracting of the core center coordinates and calculating the distances between the edge points of the feature region and the core center coordinates to obtain core distance data includes: Using a circle fitting algorithm to perform edge detection on the core to obtain inner core center coordinates and outer core center coordinates; Calculating the distances between the edge points of the feature region and the inner core center coordinates to obtain first distance data; Calculating the distances between the edge points of the feature region and the outer core center coordinates to obtain second distance data; Integrating the first distance data and the second distance data to obtain core distance data.
5. The defect detection and rating method according to claim 1, wherein The constructing of the defect level quantization neural network and using the defect level quantization neural network to rate the core distance data to obtain a rating result includes: Performing a preliminary rating on the inductor according to a preset scoring threshold to obtain comparison data; Constructing a defect level quantization neural network; Inputting the core distance data and the comparison data into the defect level quantization neural network for defect rating to obtain a rating result.
6. A defect detection and rating device, characterized in that, Including: An acquisition module for performing image acquisition on the inductor to obtain a basic image; A segmentation module for constructing a semantic segmentation network and using the semantic segmentation network to extract regions from a base image to obtain a coil contour region; The constructing of the semantic segmentation network and using the semantic segmentation network to extract regions from the base image to obtain a coil contour region includes: preliminarily classifying the base image to obtain a substandard inductor image; performing connected region labeling on the substandard inductor image to obtain a labeled image; constructing a semantic segmentation network; using the semantic segmentation network to extract regions of interest from the labeled image to obtain a coil contour region; An optimization module for performing image processing and region screening on the coil contour region to obtain a feature region; the performing of image processing and region screening on the coil contour region to obtain a feature region includes: performing morphological processing on the coil contour region, and completing preliminary repair of the coil contour region through morphological processing to obtain a repaired region; performing region growing processing on the repaired region to obtain a connected region; performing region screening processing on the connected region to obtain a feature region; A calculation module for extracting the core center coordinates and calculating the distances between the edge points of the feature region and the core center coordinates to obtain core distance data; A rating module for constructing a defect level quantization neural network and using the defect level quantization neural network to rate the core distance data to obtain a rating result.
7. A defect detection and rating device, characterized in that, The defect detection and rating device includes: a memory and at least one processor, and instructions are stored in the memory; At least one of the processors calls the instructions in the memory so that the defect detection and rating device executes each step of the defect detection and rating method described in any one of claims 1-5.
8. A computer-readable storage medium having instructions stored thereon, characterized in that, When the instructions are executed by the processor, each step of the defect detection and rating method described in any one of claims 1-5 is implemented.
Citation Information
Patent Citations
Magnetic core defect detection system and method based on deep learning
CN114549493A