An intelligent control method for magnet pasting
Through the combined intelligent control method of the robot arm, the artificial dependence and error problems in the magnetic steel pasting process are solved, and the precise and automated positioning of magnetic steel pasting is achieved, thereby reducing the uneven pasting and misalignment.
Patent Information
- Application Number
- CN202411694982.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-11-25
AI Technical Summary
The existing magnetic steel adhesion methods rely on manual operations, resulting in errors in the position, angle, adhesion force and adhesive dosage of magnetic steel, making it difficult to achieve precise control, and magnetic steel is easily misaligned due to magnetic adsorption.
Vision sensors are used to capture the images of magnetic steel and iron cores, use multiple light sources to reduce reflection and shadows, and position them in combination with image processing algorithms, accurately paste them through robotic arms, and use visual sensors to scan and check the paste parameters, and establish a defect inspection model for quality verification.
It improves the accuracy and consistency of magnetic steel pasting, reduces the problems of uneven pasting and position offset, and realizes automatic control.
Smart Images

Figure CN119722585B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of magnet pasting, and more specifically, the present invention is an intelligent control method for magnet pasting. Background Art
[0002] The motor rotor consists of an iron core and magnets pasted outside the iron core. The current magnet pasting method is as follows: apply an adhesive on the surface of the magnet and an activator on the surface of the iron core, and then paste the magnet onto the surface position of the iron core. However, due to the strong magnetic force between the magnet and the iron core, the magnet will be quickly adsorbed onto the iron core when approaching it, and it may not be possible to precisely control the position of magnet pasting. The magnet pasting process is usually completed manually. To avoid the influence of excessive magnetic force on magnet pasting, the operator usually adsorbs the edge of the iron core first and then pushes the magnet for pasting. The manual magnet pasting overly relies on the personal experience of the operator, which may lead to errors in the pasting position, pasting angle, pasting force, and the amount of adhesive used, and thus problems such as uneven pasting or offset of the pasting position may occur.
[0003] To solve the above defects, a technical solution is proposed. Summary of the Invention
[0004] The purpose of the present invention is to provide an intelligent control method for magnet pasting to solve the deficiencies in the background art.
[0005] To achieve the above purpose, the present invention provides the following technical solution: an intelligent control method for magnet pasting, the specific steps include capturing images of the magnet and the iron core through a vision sensor, using a multi-source light source to reduce the reflection and shadow of the images, using an image processing algorithm to locate the position of the magnet on the iron core, and verifying the positioning accuracy through dual positioning;
[0006] Controlling the coating amount and coating area of the adhesive according to the position information, and pasting the magnet to the specified position through a robotic arm;
[0007] After pasting, use the vision sensor to scan and check the pasting parameters of the magnet, and verify the pasting quality by establishing a defect inspection model;
[0008] Evaluate the positioning deviation, and generate a diagnostic report and send it to the operator in combination with the defect detection results.
[0009] Preferably, the method for positioning using an image processing algorithm is as follows:
[0010] Preprocess the acquired image, extract the edge features in the image through an edge detection algorithm and extract the contours of the magnet and the iron core, and judge the positions of the magnet and the iron core by analyzing the geometric features of the contours;
[0011] The dual positioning includes the first-stage positioning of the permanent magnet by using a known permanent magnet shape template to find the area in the image that matches the template shape through a template matching algorithm, and the second-stage positioning of the permanent magnet by using a shape description method to match the extracted contour with the known permanent magnet shape.
[0012] Preferably, the specific process of preprocessing the acquired image is as follows:
[0013] Convert the acquired color image into a grayscale image;
[0014] Use a filtering method to remove the noise in the image;
[0015] Enhance the contrast of the image to highlight the edges of the permanent magnet and the iron core;
[0016] The method of converting the color original image into a grayscale image is to combine the red, green, and blue color components of each pixel point in the image, namely the R, G, and B components, into a grayscale value, and use the weighted average method for conversion. The conversion method is G r (i,j) = αR(i,j) + βG(i,j) + γB(i,j), where (i,j) is the coordinate of the pixel point in the image, G r (i,j) is the grayscale value of the pixel point with coordinates (i,j), R(i,j) is the red component of the pixel point with coordinates (i,j), G(i,j) is the green component of the pixel point with coordinates (i,j), B(i,j) is the blue component of the pixel point with coordinates (i,j), and α, β, and γ are the weight coefficients of R(i,j), G(i,j), and B(i,j) respectively, and α, β, and γ are all positive integers;
[0017] The specific method of using a filtering method to filter the noise in the image is as follows:
[0018] After determining the filtering window, traverse all the pixel points in the image. For each pixel point, take it as the center and determine a neighborhood range according to the size of the filtering window;
[0019] Within the determined neighborhood range, sort the grayscale values of all pixel points, and use the median value obtained after sorting as the new value of the pixel point after median filtering, and replace the value of the original pixel point with the calculated median value;
[0020] The specific method of enhancing the contrast of the image is as follows:
[0021] Divide the image into multiple windows. For each window in the image, calculate its histogram and perform histogram equalization processing;
[0022] Use the bilinear interpolation method to smooth the boundaries of each window, and calculate the new values of the boundary pixels according to the equalization results of adjacent windows;
[0023] After local histogram equalization and interpolation processing, the results of each window are combined into a complete image.
[0024] Preferably, the method for extracting edge features in the image through an edge detection algorithm is as follows:
[0025] Apply a gradient operator to the image to calculate the gradient intensity and direction of each pixel point in the image. The gradient intensity is where G is the gradient intensity, Gx is the component of the gradient intensity in the horizontal direction, Gy is the component of the gradient intensity in the vertical direction, and the gradient direction is
[0026] Perform non-maximum suppression according to the gradient intensity and direction. Check the gradient intensity of the pixel point and its neighborhood along the gradient direction. When the gradient intensity of the pixel point is not the maximum in that direction, set it to 0;
[0027] Set high and low thresholds to test the edges. The high threshold is greater than the low threshold. When the gradient intensity of a pixel is higher than the high threshold, it is marked as a strong edge. When the gradient intensity of a pixel is lower than the low threshold, it is marked as a non-edge. When the gradient intensity of a pixel is higher than the low threshold and lower than the high threshold, it is marked as a weak edge;
[0028] Retain all weak edges connected to the strong edges as valid edges, suppress all weak edges not connected to the strong edges, and output a binary image with the edges represented by white pixels and the non-edges represented by black pixels as the edge feature image.
[0029] Preferably, the specific method for extracting the contours of the magnetic steel and the iron core according to the edge feature image is as follows:
[0030] Use the connected component labeling method to traverse each pixel in the edge feature image and label the mutually connected edge pixels as a pixel set;
[0031] Use the contour tracing algorithm to start from any edge pixel and travel along the continuous path of the edge until it returns to the starting point to form a closed contour, or until the path is blocked by non-edge pixels to extract an open contour;
[0032] Merge and output the continuous contours and the discontinuous contours.
[0033] Preferably, the method for the first-stage positioning of the magnetic steel through the template matching algorithm is as follows:
[0034] Crop a template image from the existing magnetic steel images. The template image contains the shape of a single magnetic steel and excludes the background content. After preprocessing the template image, a binary image is formed;
[0035] Calculate the average value of all pixels of the template image based on the binary image, and the calculation expression is In the formula,[[]]END]] is the average value of all pixels of the template image, T(x, y) is the pixel value at the coordinate (x, y), and m and n are the width and height of the template image respectively;
[0036] For the target image, use the template image as a sliding window to calculate the average value for each pixel, and the calculation method is In the formula,[[]]END]] is the average value of the pixel values at the coordinate (i, j) in the target image;
[0037] For each position (i, j) in the target image, calculate the normalized cross-correlation coefficient between the template image and the local area of the target image, and the calculation expression is In the formula, NCC(i, j) is the normalized cross-correlation coefficient at the coordinate (i, j);
[0038] Slide the template image on the target image, move one pixel each time, calculate the NCC value for each pixel, traverse all positions of the target image and record the NCC value at each position;
[0039] Find the position of the maximum value among all the calculated NCC values, use the position of the maximum value as the best matching position between the template image and the target image, and output the best matching position as the result of the first-stage positioning.
[0040] Preferably, the method for performing the second-stage positioning of the permanent magnet by using the shape description method to match the extracted contour with the known shape of the permanent magnet is as follows:
[0041] Calculate the Hu moments of all the extracted contours, and compare the Hu moments of each contour in the target image with the Hu moments of the known template image. The comparison method is In the formula, d is the Euclidean distance, H i is the i-th Hu moment value of the template, is the i-th Hu moment value of the contour in the target image;
[0042] Take the contour with the minimum distance as the contour that matches the template shape, and output the position of the matching contour as the result of the second-stage positioning.
[0043] Preferably, the method for establishing a defect inspection model to verify the pasting quality is as follows:
[0044] Collect the images of the pasted permanent magnets, label the defect types and integrate them into a data set;
[0045] Build a convolutional neural network model and divide the dataset into a training set and a validation set. Use the training set to train the convolutional neural network model, and use the validation set to adjust the parameters of the convolutional neural network model to improve accuracy and generalization ability;
[0046] Use the trained convolutional neural network model to detect the pasted magnet image, identify the defect type in the image, and output the detection result.
[0047] Preferably, the logic for generating a diagnostic report by combining the positioning deviation and defect detection and sending it to the operator is as follows:
[0048] Calculate the deviation between the first-stage positioning and the second-stage positioning. The calculation method is In the formula, P d is the stage positioning deviation, Lo is the image length, Wi is the image width, Δx is the stage horizontal deviation, and Δy is the stage vertical deviation. Among them, Δx = |c1 - c2| and Δy = |v1 - v2|, where (c1, v1) is the centroid coordinates of the image output by the first-stage positioning, and (c2, v2) is the centroid coordinates of the image output by the second-stage positioning;
[0049] Preset the positioning deviation threshold P t , when the calculated stage positioning deviation P d is greater than or equal to the positioning deviation threshold P t , and the defect inspection model identifies a pasting defect, then output a pasting defect warning, and notify the operator to clean and reposition the abnormally pasted magnet;
[0050] When the calculated stage positioning deviation P d is greater than or equal to the positioning deviation threshold P t , and the defect inspection model does not identify a pasting defect, then output a positioning abnormality warning, and notify the operator to re-inspect the magnet with positioning abnormality;
[0051] When the calculated stage positioning deviation P d is less than the positioning deviation threshold P t , and the defect inspection model identifies a pasting defect, then output an adhesion abnormality warning, and notify the operator to perform potting treatment on the magnet with abnormal positioning and adhesion;
[0052] When the calculated stage positioning deviation P d is less than the positioning deviation threshold P t , and the defect inspection model does not identify a pasting defect, then output a pasting normal notice and do not notify the operator.
[0053] In the above technical solution, the technical effects and advantages provided by the present invention are:
[0054] This application uses computer vision methods and image processing techniques to locate and analyze the permanent magnet and iron core. The methods based on contour recognition and template matching are respectively used to locate the permanent magnet. The method of gray conversion is used to reduce the calculation cost and shorten the algorithm processing time. The deviation of the two-stage positioning is analyzed to improve the accuracy of permanent magnet pasting. Combined with the pasting effect of the adhesive, the defect state of permanent magnet pasting is analyzed. The permanent magnet pasting control is carried out by integrating visual positioning and defect analysis, effectively solving the problem of adhesive extrusion caused by pushing and pasting to avoid the direct misalignment of the permanent magnet and adsorption of the iron core during pasting. Description of the Drawings
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments recorded in the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0056] Figure 1 It is the flowchart of the method of the present invention. Detailed Embodiments
[0057] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the scope of protection of the present invention.
[0058] Embodiment 1: Please refer to Figure 1 As shown, the present invention is an intelligent control method for permanent magnet pasting. The specific steps include capturing images of the permanent magnet and the iron core through a vision sensor, using a multi-source light source to reduce the reflection and shadow of the image, using an image processing algorithm to locate the position of the permanent magnet on the iron core, and verifying the positioning accuracy through dual positioning;
[0059] Controlling the coating amount and coating area of the adhesive according to the position information, and pasting the permanent magnet to the specified position through a robotic arm;
[0060] After pasting, use a vision sensor to scan and check the pasting parameters of the permanent magnet, and verify the pasting quality by establishing a defect inspection model;
[0061] Evaluate the positioning deviation, and generate a diagnostic report in combination with the defect detection results and send it to the operator.
[0062] Capture images of the magnetic steel and iron core through a vision sensor, and use a multi-source light source to reduce the reflection and shadow in the images. The multi-source light source is a light source setting that includes multiple light source types and uses a combined light source layout. The light source types include ring light sources, coaxial light sources, diffused light sources, etc. The ring light source evenly surrounds the camera lens to provide illumination, which can effectively reduce shadows and is especially suitable for processing the surfaces of magnetic steel and iron core with smooth or highly reflective surfaces; the coaxial light source irradiates the object surface with parallel light rays, reduces the interference caused by specular reflection and highlights the surface details; the diffused light source makes the light evenly distributed through a light diffuser plate or diffused cover, reducing the strong light spots and shadows on the surfaces of the magnetic steel and iron core.
[0063] In terms of the light source angle, it includes a low-angle light source and a high-angle light source. The low-angle light source irradiates the magnetic steel and iron core from a low angle close to the horizontal plane, enhancing the texture and edge features on the surfaces of the magnetic steel and iron core, and is suitable for detecting pasting defects. The high-angle light source irradiates the object from a vertical or nearly vertical angle, reducing shadows and evenly illuminating the entire surface.
[0064] In terms of controlling the light source brightness, use a light shield or filter to reduce the overexposure of the reflected light or highlight areas, and install a polarization filter on the vision sensor lens and the light source to reduce the specular reflected light and enhance the contrast of the surface details.
[0065] In terms of the light source layout, use multiple light sources to irradiate simultaneously from different angles to eliminate the shadow and reflection problems caused by a single light source. For example, based on the ring light source, add side light and backlight to compensate for the shadows in specific areas. Place the light source behind the magnetic steel and iron core, then the outlines of the magnetic steel and iron core appear as black silhouettes in the camera's field of view, which is used to detect the shape and edge features.
[0066] Use an image processing algorithm to locate the position of the magnetic steel on the iron core, and verify the positioning accuracy through double positioning.
[0067] The method of using an image processing algorithm for positioning is as follows:
[0068] Preprocess the acquired image, extract the edge features in the image through an edge detection algorithm and extract the outlines of the magnetic steel and iron core, and judge the positions of the magnetic steel and iron core by analyzing the geometric features of the outlines.
[0069] Double positioning includes the first-stage positioning of the magnetic steel by using a known magnetic steel shape template and searching for the area in the image that matches the template shape through a template matching algorithm, and the second-stage positioning of the magnetic steel by using a shape description method to match the extracted outline with the known magnetic steel shape.
[0070] The geometric features include area, perimeter, shape, etc. The template matching algorithm is such as the normalized cross-correlation coefficient.
[0071] The specific process of preprocessing the acquired image is as follows:
[0072] Convert the acquired color image into a grayscale image;
[0073] Use a filtering method to remove the noise in the image;
[0074] Enhance the contrast of the image to highlight the edges of the magnetic steel and the iron core.
[0075] During the image acquisition process, the image will be interfered by various noises, such as electronic noise, optical noise, etc. Through preprocessing techniques such as filtering, these noises can be effectively removed, making the image clearer and facilitating subsequent image analysis and processing;
[0076] The contrast of the image directly affects the difficulty and effect of subsequent processing. By adjusting the brightness and contrast of the image, the boundaries of the magnetic steel and the iron core can be made clearer, improving the accuracy of recognition;
[0077] In image processing, a large amount of data calculation is inevitable. Through preprocessing, such as grayscale conversion, image scaling, etc., the dimension and calculation amount of data can be reduced, thereby accelerating the processing speed and improving the processing efficiency;
[0078] Edges are important features in the image and are particularly important for the recognition of magnetic steel and iron cores. Through edge detection preprocessing, the edge information of the magnetic steel and the iron core can be highlighted, providing strong support for subsequent positioning and recognition;
[0079] Preprocessing can help extract useful features in the image, such as shape, texture, color, etc. These features are crucial for subsequent image recognition and analysis;
[0080] Preprocessing tolerates some small errors or defects in the image to a certain extent, such as slight blurring, deformation, etc., making the system's requirements for image quality more lenient and improving the fault tolerance of recognition.
[0081] The method of converting the original color image into a grayscale image is to combine the red, green, and blue color components of each pixel point in the image, namely the R, G, and B components, into a grayscale value and use the weighted average method for conversion. The conversion method is: G r (i,j) = αR(i,j) + βG(i,j) + γB(i,j), where (i,j) is the coordinate of the pixel point in the image, G r(i, j) is the grayscale value of the pixel at coordinates (i, j), R(i, j) is the red component of the pixel at coordinates (i, j), G(i, j) is the green component of the pixel at coordinates (i, j), B(i, j) is the blue component of the pixel at coordinates (i, j), α, β, and γ are the weight coefficients of R(i, j), G(i, j), and B(i, j) respectively, and α, β, and γ are all positive integers.
[0082] The specific method for filtering out noise in the image using the filtering method is as follows:
[0083] After determining the filtering window, traverse all the pixels in the image. For each pixel, use it as the center and determine a neighborhood range according to the size of the filtering window;
[0084] Within the determined neighborhood range, sort the grayscale values of all the pixels, and use the median value obtained after sorting as the new value of the pixel after median filtering, and replace the value of the original pixel with the calculated median value.
[0085] After filtering, the salt-and-pepper noise in the image can be reduced. Salt-and-pepper noise usually appears as isolated black and white dots. By calculating the median value, the isolated noise points will be replaced by the median values of adjacent pixels.
[0086] The specific method for enhancing the contrast of the image is as follows:
[0087] Divide the image into multiple windows. For each window in the image, calculate its histogram and perform histogram equalization processing;
[0088] Use the bilinear interpolation method to smooth the boundaries of each window, and calculate the new values of the boundary pixels according to the equalization results of adjacent windows;
[0089] After local histogram equalization and interpolation processing, merge the results of each window into a complete image.
[0090] Extract the edge features in the image and the contours of the magnetic steel and iron core through the edge detection algorithm, and judge the positions of the magnetic steel and iron core by analyzing the geometric features of the contours;
[0091] Apply the gradient operator to the image to calculate the gradient intensity and direction of each pixel in the image. The gradient intensity is In the formula, G is the gradient intensity, Gx is the component of the gradient intensity in the horizontal direction, Gy is the component of the gradient intensity in the vertical direction, and the gradient direction is
[0092] Perform non-maximum suppression according to the gradient intensity and direction. Check the gradient intensity of the pixel and its neighborhood along the gradient direction. When the gradient intensity of the pixel is not the maximum value in that direction, set it to 0;
[0093] Set high and low thresholds to test the edges. The high threshold is greater than the low threshold. When the gradient intensity of a pixel is higher than the high threshold, it is marked as a strong edge. When the gradient intensity of a pixel is lower than the low threshold, it is marked as a non-edge. When the gradient intensity of a pixel is higher than the low threshold and lower than the high threshold, it is marked as a weak edge;
[0094] Retain all weak edges connected to strong edges as valid edges, suppress all weak edges not connected to strong edges, and output a binary image with edges represented by white pixels and non-edges represented by black pixels as the edge feature image.
[0095] Extract the contours of the permanent magnet and the iron core according to the edge feature image. The specific method is as follows:
[0096] Use the connected component labeling method to traverse each pixel in the edge feature image and label the connected edge pixels as a pixel set;
[0097] Use the contour tracing algorithm to start from any edge pixel and travel along the continuous path of the edge until it returns to the starting point to form a closed contour, or until the path is blocked by non-edge pixels to extract an open contour;
[0098] Merge and output the continuous and discontinuous contours.
[0099] The method for the first-stage positioning of the permanent magnet by the template matching algorithm is as follows:
[0100] Crop a template image from the existing permanent magnet image. The template image contains the shape of a single permanent magnet and excludes the background content. After preprocessing the template image, a binary image is formed;
[0101] Calculate the average value of all pixels in the template image according to the binary image. The calculation expression is In the formula, is the average value of all pixels in the template image, T(x, y) is the pixel value at the coordinate (x, y), and m and n are the width and height of the template image respectively;
[0102] For the target image, use the template image as a sliding window to calculate the average value for each pixel. The calculation method is In the formula, is the average value of the pixel values at the coordinate (i, j) in the target image;
[0103] For each position (i, j) in the target image, calculate the normalized cross-correlation coefficient between the template image and the local area of the target image. The calculation expression is In the formula, NCC(i, j) is the normalized cross-correlation coefficient at the coordinate (i, j);
[0104] Slide the template image over the target image, moving one pixel at a time, calculate the NCC value for each pixel, traverse all positions of the target image and record the NCC value at each position;
[0105] Find the position of the maximum value among all the calculated NCC values. Take the position of the maximum value as the best matching position of the template image and the target image, and output the best matching position as the result of the first-stage positioning.
[0106] It should be noted that the template image is an image containing a single magnetic steel, the target image is the complete image collected for matching the position of the template, and the sliding window is a process of moving the template image on the target image. Place the template image as a sliding window at a certain position on the target image and gradually move the window on the target image until the entire target image is covered.
[0107] Judge the positions of the magnetic steel and the iron core by analyzing the geometric features of the contours. The magnetic steel and the iron core have different sizes, and distinguish the magnetic steel and the iron core by comparing the areas of the contours. The contour shapes include perimeter, circularity, and rectangularity, all of which have different recognizability. The perimeter of the contour provides additional information about its size and shape. Evaluate the circularity of the contour by comparing the relationship between the perimeter of the contour and its area. The magnetic steel and the iron core have different circularities. Usually, the magnetic steel is rectangular, while the shape of the iron core is more complex, so it is identified by calculating the rectangularity of the contour;
[0108] The magnetic steel and the iron core usually have a fixed relative position in the image. Assist in identifying the magnetic steel and the iron core by analyzing the spatial relationship between the contours, such as distance and angle;
[0109] When the magnetic steel is attached to the iron core, there is a nested relationship between the magnetic steel and the iron core, so it is identified by analyzing the nested relationship between the contours.
[0110] The method for performing the second-stage positioning of the magnetic steel by using the shape description method to match the extracted contour with the known shape of the magnetic steel is as follows:
[0111] Calculate the Hu moments of all the extracted contours, and compare the Hu moments of each contour in the target image with the Hu moments of the known template image. The comparison method is where d is the Euclidean distance, H i is the i-th Hu moment value of the template, is the i-th Hu moment value of the contour in the target image;
[0112] Take the contour with the minimum distance as the contour that matches the template shape, and output the position of the matching contour as the result of the second-stage positioning.
[0113] Control the coating amount and coating area of the adhesive according to the position information, and paste the magnetic steel to the specified position by the robotic arm;
[0114] After obtaining the contours and positions of the magnetic steel and the iron core, determine the area where the magnetic steel is to be pasted, apply the adhesive within the area, and plan the coating path of the adhesive according to the shape and size of the magnetic steel;
[0115] Adjust the coating amount of the adhesive according to the positions, surface characteristics of the magnetic steel and the iron core, and the characteristics of the adhesive, and monitor the adhesive flow rate during the coating process using a pressure sensor and a flow sensor;
[0116] The robotic arm pastes the magnetic steel to the specified position.
[0117] The specified position is the position where the magnetic steel is pasted to the iron core. The coating path includes linear, spiral, or other paths that conform to the shape of the magnetic steel to ensure coverage of the entire pasting area.
[0118] After pasting, use a vision sensor to scan and check the pasting parameters of the magnetic steel, and verify the pasting quality by establishing a defect inspection model;
[0119] Judge whether the magnetic steel is pasted at the preset position through contour matching and shape template matching;
[0120] Use edge detection combined with region growing algorithm to identify and measure whether there is an overflow glue area, use morphological operations or segmentation algorithms to detect whether there are voids or bubbles in the contact area between the magnetic steel and the iron core, and use the angle and depth information of the image to evaluate the tilt angle and height of the magnetic steel;
[0121] Collect the images of the magnetic steel after pasting, label the defect types and integrate them into a data set;
[0122] Establish a convolutional neural network model and divide the data set into a training set and a validation set. Use the training set to train the convolutional neural network model, and use the validation set to adjust the parameters of the convolutional neural network model to improve the accuracy and generalization ability;
[0123] Use the trained convolutional neural network model to detect the images of the pasted magnetic steel, identify the defect types in the images and output the detection results.
[0124] The defect types include overflow glue, leakage glue, position deviation, angle deviation, etc.
[0125] Evaluate the positioning deviation, and generate a diagnostic report and send it to the operator in combination with the defect detection results;
[0126] Calculate the deviation between the first-stage positioning and the second-stage positioning. The calculation method is In the formula, P dThe deviation is the stage positioning deviation, Lo is the image length, Wi is the image width, Δx is the stage horizontal deviation, and Δy is the stage vertical deviation. Among them, Δx = |c1 - c2| and Δy = |v1 - v2|, where (c1, v1) are the centroid coordinates of the image output by the first stage positioning, and (c2, v2) are the centroid coordinates of the image output by the second stage positioning;
[0127] The preset positioning deviation threshold P t , when the calculated stage positioning deviation P d is greater than or equal to the positioning deviation threshold P t , and the defect inspection model identifies a paste defect, then a paste defect warning is output to notify the operator to clean and reposition the abnormally pasted magnet;
[0128] When the calculated stage positioning deviation P d is greater than or equal to the positioning deviation threshold P t , and the defect inspection model does not identify a paste defect, then a positioning abnormality warning is output to notify the operator to re-inspect the magnet with abnormal positioning;
[0129] When the calculated stage positioning deviation P d is less than the positioning deviation threshold P t , and the defect inspection model identifies a paste defect, then an adhesion abnormality warning is output to notify the operator to perform potting treatment on the magnet with abnormal positioning and adhesion;
[0130] When the calculated stage positioning deviation P d is less than the positioning deviation threshold P t , and the defect inspection model does not identify a paste defect, then a normal paste notification is output without notifying the operator.
[0131] This application uses computer vision methods, applies image processing technology to perform positioning analysis on magnets and iron cores, uses methods based on contour recognition and template matching to position the magnets respectively, uses the method of grayscale conversion to reduce the calculation cost and shorten the algorithm processing time, analyzes the deviation of the two-stage positioning, improves the accuracy of magnet pasting, and analyzes the defect state of magnet pasting in combination with the pasting effect of the adhesive. It controls magnet pasting by integrating visual positioning and defect analysis, effectively solving the problem of adhesive extrusion caused by pushing and pasting to avoid direct misalignment adsorption of the magnet on the iron core during pasting.
[0132] The above formulas are all dimensionless and take their numerical values for calculation. The formulas are obtained by collecting a large amount of data for software simulation to get a formula closest to the real situation. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0133] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that contains one or more collections of available media. The available media can be magnetic media (such as floppy disks, hard disks, magnetic tapes), optical media (such as DVDs), or semiconductor media. The semiconductor media can be a solid-state drive.
[0134] It should be understood that in various embodiments of the present application, the order numbers of the above processes do not imply the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0135] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0136] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0137] When the above-mentioned function 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 this application, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing 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 various embodiments of this application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs.
[0138] As described above, the above are only specific embodiments of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A method for intelligent control of magnet paste, characterized in that, The specific steps include capturing images of the permanent magnet and the iron core through a vision sensor, using a multi-source light source to reduce the reflection and shadow of the image, using an image processing algorithm to locate the position of the permanent magnet on the iron core, and verifying the positioning accuracy through double positioning; Controlling the coating amount and coating area of the adhesive according to the position information, and pasting the permanent magnet to the specified position by a robotic arm; After pasting, use a vision sensor to scan and check the pasting parameters of the permanent magnet, and verify the pasting quality by establishing a defect inspection model; Evaluate the positioning deviation, and generate a diagnostic report and send it to the operator in combination with the defect detection results; The logic of generating a diagnostic report and sending it to the operator by combining the positioning deviation and defect detection is as follows: Calculate the deviation between the first-stage positioning and the second-stage positioning. The calculation method is , where is the stage positioning deviation, is the image length, is the image width, is the stage horizontal deviation, is the stage vertical deviation. Among them, and , is the centroid coordinate of the image output by the first-stage positioning, is the centroid coordinate of the image output by the second-stage positioning; Preset positioning deviation threshold , when the calculated stage positioning deviation is greater than or equal to the positioning deviation threshold , and the defect inspection model identifies a paste defect, a paste defect warning is output to notify the operator to clean and reposition the abnormally pasted magnet steel; When the calculated stage positioning deviation is greater than or equal to the positioning deviation threshold , and the defect inspection model does not identify a pasting defect, an abnormal positioning warning is output, and the operator is notified to re-inspect the abnormally positioned magnets; When the calculated stage positioning deviation is less than the positioning deviation threshold , and the defect inspection model identifies a paste defect, an adhesion abnormality warning is output, and the operator is notified to pot the magnet steel with abnormal positioning adhesion; When the calculated stage positioning deviation is less than the positioning deviation threshold , and the defect inspection model does not identify a pasting defect, then a normal pasting notice is output without notifying the operator.
2. The intelligent control method for magnet pasting according to claim 1, characterized in that, The method of using an image processing algorithm for positioning is as follows: Preprocess the acquired image, extract the edge features in the image through an edge detection algorithm and extract the contours of the permanent magnet and the iron core, and judge the positions of the permanent magnet and the iron core by analyzing the geometric features of the contours; Double positioning includes the first-stage positioning of the permanent magnet by using a known permanent magnet shape template and searching for the area in the image that matches the template shape through a template matching algorithm, and the second-stage positioning of the permanent magnet by using a shape description method to match the extracted contour with the known permanent magnet shape.
3. A method for intelligent control of magnet pasting according to claim 2, characterized in that The specific process of preprocessing the acquired image is as follows: Convert the acquired color image into a grayscale image; Use a filtering method to remove the noise in the image; Enhance the contrast of the image to highlight the edges of the permanent magnet and the iron core; The method of converting a color original image into a grayscale image is to combine the red, green, and blue color components of each pixel in the image into a grayscale value and use the weighted average method for conversion. The conversion method is , where is the coordinate of the pixel in the image, is the grayscale value of the pixel with the coordinate , is the red component of the pixel with the coordinate , is the green component of the pixel with the coordinate , is the blue component of the pixel with the coordinate , are the weight coefficients of respectively, and are all positive integers; The specific method of using a filtering method to filter the noise in the image is as follows: After determining the filtering window, traverse all the pixel points in the image. For each pixel point, take it as the center and determine a neighborhood range according to the filtering window size; Within the determined neighborhood range, sort the grayscale values of all pixel points, and use the median value obtained after sorting as the new value of the pixel point after median filtering, and replace the original pixel point value with the calculated median value; The specific method of enhancing the contrast of the image is as follows: Divide the image into multiple windows. For each window in the image, calculate its histogram and perform histogram equalization processing; Use the bilinear interpolation method to smooth the boundaries of each window, and calculate the new values of the boundary pixels according to the equalization results of adjacent windows; After local histogram equalization and interpolation processing, merge the results of each window into a complete image.
4. The intelligent control method for magnet pasting according to claim 3, characterized in that, The method of extracting the edge features in the image through an edge detection algorithm is as follows: Apply a gradient operator to the image to calculate the gradient intensity and direction of each pixel in the image. The gradient intensity is , where G is the gradient intensity, is the component of the gradient intensity in the horizontal direction, is the component of the gradient intensity in the vertical direction, and the gradient direction is ; Perform non-maximum suppression according to the gradient intensity and direction, check the gradient intensity of the pixel point and its neighborhood along the gradient direction. When the gradient intensity of the pixel point is not the maximum value in this direction, set it to 0; Set a high threshold and a low threshold to check the edges. The high threshold is greater than the low threshold. When the gradient intensity of a pixel is higher than the high threshold, it is marked as a strong edge. When the gradient intensity of a pixel is lower than the low threshold, it is marked as a non-edge. When the gradient intensity of a pixel is higher than the low threshold and lower than the high threshold, it is marked as a weak edge; All weak edges connected to strong edges are retained as valid edges, all weak edges not connected to strong edges are suppressed, and a binary image with edges represented by white pixels and non - edges represented by black pixels is output as the edge feature image.
5. A method for intelligent control of magnet paste according to claim 4, characterized in that, The specific method for extracting the contours of the permanent magnet and the iron core from the edge feature image is as follows: The connected - component labeling method is used to traverse each pixel in the edge feature image, and the connected edge pixels are marked as a pixel set. The contour - tracing algorithm is used to start from any edge pixel and travel along the continuous path of the edge until it returns to the starting point to form a closed contour, or until the path is blocked by non - edge pixels to extract an unclosed contour. The continuous and discontinuous contours are merged and output.
6. The intelligent control method for magnet pasting according to claim 5, wherein The method for the first - stage positioning of the permanent magnet through the template - matching algorithm is as follows: A template image is intercepted from the existing permanent - magnet images. The template image contains the shape of a single permanent magnet and excludes background content. After pre - processing the template image, a binary image is formed. Calculate the average value of all pixels of the template image based on the binary image, and the calculation expression is , where is the average value of all pixels of the template image,[[]] is the pixel value at the coordinate , are the width and height of the template image respectively; For the target image, use the template image as a sliding window to calculate the average value for each pixel. The calculation method is , where is the mean value of the pixel values at the coordinate in the target image; For each position in the target image , calculate the normalized cross-correlation coefficient between the template image and the local region of the target image. The calculation expression is , where is the coordinate and the normalized cross-correlation coefficient at this position; The template image is slid on the target image, moving one pixel each time. The NCC value is calculated for each pixel. All positions of the target image are traversed and the NCC value at each position is recorded. The position of the maximum value is found among all the calculated NCC values. The position of the maximum value is taken as the best - matching position of the template image and the target image, and the best - matching position is output as the result of the first - stage positioning.
7. A method for intelligent control of magnet paste according to claim 5, characterized in that The method for the second - stage positioning of the permanent magnet by matching the extracted contour with the known shape of the permanent magnet using the shape - description method is as follows: Calculate the Hu moments of all the extracted contours, and compare the Hu moments of each contour in the target image with those of the known template image. The comparison method is , where is the Euclidean distance,[[]] is the th Hu moment value of the template,[[]] is the th Hu moment value of the contour in the target image; The contour with the minimum distance is taken as the contour matching the template shape, and the position of the matching contour is output as the result of the second - stage positioning.
8. A method for intelligent control of magnet pasting according to claim 1, characterized in that The method for establishing a defect - inspection model to verify the pasting quality is as follows: Images of the pasted permanent magnets are collected, the defect types are labeled and integrated into a data set. A convolutional neural network model is established and the data set is divided into a training set and a validation set. The convolutional neural network model is trained using the training set, and the parameters of the convolutional neural network model are adjusted using the validation set to improve the accuracy and generalization ability. The trained convolutional neural network model is used to detect the images of the pasted permanent magnets, identify the defect types in the images and output the detection results.
Citation Information
Patent Citations
Visual detection method for VCM magnetic steel
CN101696876A
Vision-based annular magnetic steel appearance defect detection method
CN111815600A