A motor detection method and system based on machine vision

By combining two-dimensional images and three-dimensional point clouds, a motor inspection method has been developed that solves the problem of the difficulty in detecting minute defects in existing motor inspection methods. This method achieves efficient and accurate motor inspection, reduces costs and labor intensity, and meets the needs of large-scale production.

CN120543504BActive Publication Date: 2026-01-23GUANGZHOU SONGRUI INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510627606.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-15
Publication Date
2026-01-23
Estimated Expiration
2045-05-15

AI Technical Summary

Technical Problem

Existing motor testing methods are insufficient for efficiently detecting minute defects in complex structures. High-precision testing equipment is expensive and has high maintenance costs. Manual testing is inefficient, and the adoption rate of automated equipment is low, making it difficult to meet the needs of large-scale production.

Method used

A machine vision-based motor inspection method is adopted, which combines two-dimensional image and three-dimensional point cloud detection. Local images of the stator are acquired by a camera and preprocessed and identified. Point cloud data is acquired by a 3D structured light camera, feature parameters are extracted and matched, and defect identification is performed by combining convolutional neural network and support vector machine models.

Benefits of technology

It improves the accuracy and efficiency of motor testing, reduces misjudgments and omissions, lowers labor intensity, achieves standardized testing, and meets the needs of large-scale production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120543504B_ABST
    Figure CN120543504B_ABST
Patent Text Reader

Abstract

The embodiment of the present application relates to the motor detection technical field, disclose a kind of motor detection method based on machine vision, comprising: obtaining stator local image;The stator local image after pre-processing operation is identified to determine whether the current stator local image exists defect;If yes, then through 3D structured light camera to obtain the stator point cloud data of stator detection tooling stator to be detected, stator point cloud data is extracted to obtain the feature parameter group related to stator point cloud;The feature parameter group is matched with set point cloud feature to determine the stator welding defect type and position existing under current detection condition.The embodiment of the present application based on machine vision motor detection method is combined by two-dimensional image and three-dimensional point cloud to improve the accuracy and efficiency of detection result, and in the process of two-dimensional image detection, multi-level image matching is used to realize the balance of accuracy and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of motor detection, and in particular to a motor detection method and system based on machine vision. BACKGROUND

[0002] At present, new energy vehicles are becoming more and more popular, and as motors in new energy vehicles, they have also received more extensive attention. The current motor detection of new energy vehicles has the following problems: the existing method is difficult to simultaneously and efficiently detect defects, and small defects in complex structures are easily missed; high-precision detection equipment is expensive, has high maintenance costs, and has a slow detection speed, which is difficult to meet the needs of large-scale production. Many enterprises still rely on manual detection, and the popularization rate of automatic equipment is not high, which affects efficiency and consistency. Therefore, designing a scheme capable of efficiently detecting motors has become a technical problem to be solved by those skilled in the art. SUMMARY

[0003] In view of the defects, the motor detection method based on machine vision disclosed in the embodiments of the present application can realize efficient and accurate detection of the motor stator.

[0004] The first aspect of the embodiments of the present application discloses a motor detection method based on machine vision, comprising:

[0005] The stator local image of the stator to be detected at the stator detection tool is obtained by the camera module, and the stator to be detected is installed at the stator detection tool;

[0006] The obtained stator local image is preprocessed, and the preprocessed stator local image is identified to determine whether the current stator local image has defects; if not, the stator detection tool device is controlled to rotate according to the set conditions for the next stage of stator local detection;

[0007] If yes, the stator point cloud data of the stator to be detected at the stator detection tool is obtained by the 3D structured light camera, the stator point cloud data is feature extracted to obtain a feature parameter group related to the stator point cloud;

[0008] The feature parameter group is matched with the set point cloud feature to determine the type and position of the stator welding defect existing under the current detection condition.

[0009] As an optional implementation, in the first aspect of the embodiments of the present application, the identification of the preprocessed stator local image to determine whether the current stator local image has defects comprises:

[0010] The stator partial image subjected to the preprocessing operation is input into a stator detection model constructed in advance to perform recognition to determine whether the current stator partial image has defects.

[0011] As an optional implementation, in the first aspect of the embodiment of the present application, the recognition processing of the stator partial image subjected to the preprocessing operation to determine whether the current stator partial image has defects comprises:

[0012] matching the stator partial image subjected to the preprocessing operation with a standard image template, and if the stator partial image and the standard image template are in a first similarity interval, it is determined that the current stator partial image has no defects;

[0013] if the stator partial image and the standard image template are in a second similarity interval, it is determined that the current stator partial image is suspected to have defects;

[0014] if the stator partial image and the standard image template are in a third similarity interval, it is determined that the current stator partial image has defects.

[0015] As an optional implementation, in the first aspect of the embodiment of the present application, after the determination that the current stator partial image is suspected to have defects, the method further comprises:

[0016] template matching the stator partial image with a pre-constructed solder joint template image to determine a first solder joint image in the current stator partial image, and determine first position information associated with the first solder joint image;

[0017] determining position information of the remaining solder joints according to the first position information and a distribution state of the solder joints of the stator, and determining second solder joint images of the remaining solder joints according to the position information of the remaining solder joints;

[0018] feature extraction of the first solder joint image and the second solder joint images to obtain solder joint feature information, the solder joint feature information comprising grayscale statistical features and shape features;

[0019] inputting the solder joint feature information into a support vector machine model to perform classification operation on each solder joint image to determine a defect type of each solder joint;

[0020] when it is determined that the corresponding solder joint has defects, marking the position and the defect type of the corresponding solder joint on the stator partial image.

[0021] As an optional implementation, in the first aspect of the embodiment of the present application, after the determination that the current stator partial image is suspected to have defects, the method further comprises:

[0022] Extract key points from the current stator local image and the standard image template, calculate the transformation matrix between them, and align the current stator local image with the standard image template according to the transformation matrix to obtain the stator transformed image;

[0023] The stator transformation image is preprocessed, and a differential pixel image is obtained by calculating the difference between the preprocessed stator transformation image and the standard image template.

[0024] The differential pixel image is binarized and morphologically processed to obtain an enhanced differential pixel image; wherein, the morphological processing includes using a 3×3 structure kernel to remove noise and using a 5×5 structure kernel to connect broken edges;

[0025] Connectivity analysis was performed on the enhanced difference graph to filter out anomalous regions that met the criteria;

[0026] Extract the feature parameters of the abnormal area, and determine the type of weld defect based on the feature parameters.

[0027] As an optional implementation, in a first aspect of the present invention, the step of extracting features from the stator point cloud data to obtain a set of feature parameters related to the stator point cloud includes:

[0028] Clustering algorithms are used to segment the stator point cloud data into weld point point cloud data for each weld point, and principal component analysis is used to determine the principal axis of each weld point.

[0029] For each solder joint, a minimum volume bounding box is generated along the main axis. The extreme values ​​of the point cloud of each solder joint are taken along the XYZ axes, and the calculated difference of each axis is used as the size information of the bounding box. The size information includes length information, width information and height information.

[0030] The point cloud within the height range of the centroid of the solder joint Z0±ΔZ is extracted, and the point cloud within the height range of the centroid of the solder joint Z0±ΔZ is projected onto the XY plane to generate a two-dimensional contour. The contour boundary is extracted using the Alpha Shape algorithm to determine the first set of parameters associated with the contour boundary. The first set of parameters includes area, perimeter, roundness, and major axis / minor axis ratio.

[0031] The XZ plane point cloud is intercepted along the center of the long axis or wide axis of the weld point, and the cross-sectional point cloud is sorted to generate a height change curve. The second parameter set of the vertical cross-section is determined based on the height change curve. The second parameter set includes the maximum height difference, average curvature, and local depression depth.

[0032] Based on the size information, the first parameter group, and the second parameter group, a set of feature parameters related to the stator point cloud is constructed.

[0033] As an optional implementation, in the first aspect of the embodiment of the present application, the feature extraction on the stator point cloud data to obtain the feature parameter set related to the stator point cloud further comprises:

[0034] Obtaining the centroid coordinates of all the welding points;

[0035] Determining the coordinate system of the stator, and converting the centroid coordinates of all the welding points into polar coordinates;

[0036] Calculating the arc length or chord length between adjacent welding points;

[0037] Calculating the radial distance between adjacent welding points, the radial distance being the radial difference

[0038] As an optional implementation, in the first aspect of the embodiment of the present application, the motor detection method further comprises:

[0039] When the defect type is detected as missing welding, the stator point cloud data is segmented to obtain the point cloud information of two wire heads;

[0040] Calculating the centroid positions of the respective wire heads, and determining the height difference between the two wire heads in the corresponding direction according to the centroid positions;

[0041] Obtaining the main direction of each wire head by principal component analysis, determining the main direction as a direction vector, and determining the included angle information between the two wire heads according to the direction vector.

[0042] The second aspect of the embodiment of the present application discloses a motor detection system based on machine vision, characterized in that it comprises:

[0043] An image acquisition module: used for acquiring a stator local image of a stator to be detected at a stator detection tool through a camera module, wherein the stator to be detected is installed at the stator detection tool;

[0044] A preprocessing module: used for performing a preprocessing operation on the acquired stator local image, and performing an identification processing on the stator local image after the preprocessing operation to determine whether there is a defect in the current stator local image; if not, controlling the stator detection tool device to rotate according to a set condition to perform a next-stage stator local detection;

[0045] A point cloud acquisition module: used for acquiring stator point cloud data of the stator to be detected at the stator detection tool through a 3D structured light camera if there is a defect, and performing feature extraction on the stator point cloud data to obtain a feature parameter set related to the stator point cloud;

[0046] A feature comparison module: used for matching the feature parameter set with a set point cloud feature to determine the stator welding defect type and position existing under the current detection condition.

[0047] The third aspect of the embodiment of the present application discloses an electronic device, comprising: a memory storing executable program codes; a processor coupled with the memory; the processor invokes the executable program codes stored in the memory, and is used for executing the motor detection method based on machine vision disclosed in the first aspect of the embodiment of the present application.

[0048] The fourth aspect of the embodiment of the present application discloses a computer readable storage medium storing a computer program, wherein the computer program causes a computer to execute the motor detection method based on machine vision disclosed in the first aspect of the embodiment of the present application.

[0049] Compared with the prior art, the embodiment of the present application has the following beneficial effects:

[0050] The motor detection method based on machine vision in the embodiment of the present application improves the accuracy and efficiency of the detection result by adopting the combination detection mode of two-dimensional images and three-dimensional point clouds, and adopts the multi-level image matching mode to realize the balance between accuracy and efficiency in the process of two-dimensional image detection. BRIEF DESCRIPTION OF DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0052] Figure 1 is a flowchart of the motor detection method based on machine vision disclosed in the embodiment of the present application;

[0053] Figure 2 is a flowchart of the template matching disclosed in the embodiment of the present application;

[0054] Figure 3 is a specific flowchart of the defect identification disclosed in the embodiment of the present application;

[0055] Figure 4 is a diagram of the size information determination disclosed in the embodiment of the present application;

[0056] Figure 5 is a diagram of the cross-section information determination disclosed in the embodiment of the present application;

[0057] Figure 6 is a diagram of the missing welding information determination disclosed in the embodiment of the present application;

[0058] Figure 7 is a diagram of the adjacent welding point spacing determination disclosed in the embodiment of the present application;

[0059] Figure 8 is a structural schematic diagram of a motor detection system based on machine vision provided by an embodiment of the present application.

[0060] Figure 9 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0061] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0062] It should be noted that the terms "first", "second", "third", "fourth" and the like in the specification and claims of the present application are used to distinguish different objects, and are not used to describe a specific order. The terms "include" and "have" and any variations thereof in the embodiments of the present application are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to the process, method, product or device.

[0063] The current motor detection of new energy vehicles has the following problems: the existing method is difficult to simultaneously and efficiently detect defects, and small defects in complex structures are easy to be missed; high-precision detection equipment is expensive, has high maintenance cost, and has slow detection speed, which is difficult to meet the demand of large-scale production. Many enterprises still rely on manual detection, and the popularization rate of automatic equipment is not high, which affects the efficiency and consistency. Based on this, the embodiments of the present application disclose a motor detection method and system based on machine vision, an electronic device and a storage medium, which improve the accuracy and efficiency of the detection result by adopting a combination detection method of two-dimensional image and three-dimensional point cloud, and adopts a multi-level image matching method to balance the accuracy and efficiency during two-dimensional image detection.

[0064] Embodiment one

[0065] Please refer to Figure 1 , Figure 1is a flowchart of a motor detection method based on machine vision disclosed by the embodiments of the present application. Among them, the execution subject of the method described in the embodiments of the present application is an execution subject composed of software or / and hardware, which can receive relevant information through wired or / and wireless means and can send certain instructions. Of course, it can also have certain processing function and storage function. The execution subject can control multiple devices, such as remote physical servers or cloud servers and related software, or it can be a local host or server and related software that performs related operations on a device placed somewhere. In some scenarios, it can also control multiple storage devices, which can be placed in the same place or different places. As shown in Figures 1 to 7 The motor detection method based on machine vision includes the following steps:

[0066] S101: Obtain the stator local image of the stator to be detected at the stator detection tool through the camera module, and install the stator to be detected at the stator detection tool;

[0067] S102: Perform preprocessing operation on the obtained stator local image, and perform recognition processing on the stator local image after preprocessing operation to determine whether the current stator local image has defects; if not, control the stator detection tool device to rotate according to the set condition to perform the next stage of stator local detection;

[0068] S103: If yes, obtain the stator point cloud data of the stator to be detected at the stator detection tool through the 3D structured light camera, and perform feature extraction on the stator point cloud data to obtain a feature parameter group related to the stator point cloud;

[0069] S104: Match the feature parameter group with the set point cloud feature to determine the type and position of the stator welding defect existing under the current detection condition.

[0070] The embodiments of the present application quickly obtain the stator local image through the camera module, which can quickly detect the stator. Compared with manual detection, the detection time is greatly shortened, the detection efficiency is improved, and the demand for rapid detection of motor stator in large-scale production is met. For example, in the batch production line of the motor, multiple stators can be quickly detected to find problems in time. Preprocessing and recognition processing of the obtained stator local image can effectively remove noise, interference and other factors in the image, improve the image quality, and more accurately judge whether the stator local image has defects. At the same time, the 3D structured light camera is used to obtain the stator point cloud data and extract the feature parameter group, which can more accurately analyze the structural features of the stator from the three-dimensional angle, further improve the accuracy of detection, and reduce the misjudgment and omission. For example, some subtle welding defects can be more clearly identified.

[0071] The embodiment of the present application matches the extracted feature parameter set with the set point cloud feature, which can accurately determine the type of welding defects (such as virtual welding, missing welding, etc.) and the specific position of the defects of the stator under the current detection condition. This provides accurate information for subsequent repair and processing of the stator, facilitates targeted operation by technicians, and improves the efficiency and quality of motor maintenance. The method can control the stator detection tool device to rotate according to the set conditions, realize automatic detection of different parts of the stator, reduce manual operation, reduce labor intensity, and avoid subjective errors that may occur in the manual detection process, making the detection process more standardized and standardized, which is beneficial to improve the overall quality and reliability of motor production. The stator point cloud data and feature parameter set obtained during the detection process can provide a data basis for optimizing the production process of the motor. By analyzing these data, problems existing in the production process can be found, and the production process can be adjusted and improved to improve the production quality and efficiency of the motor. For example, the welding process parameters are optimized according to the detection results to reduce the occurrence of welding defects.

[0072] More preferably, the identification processing of the stator local image subjected to the preprocessing operation to determine whether the current stator local image has defects comprises:

[0073] The stator local image subjected to the preprocessing operation is input into the stator detection model constructed in advance to perform identification to determine whether the current stator local image has defects; the stator detection model is an identification model constructed based on a convolutional neural network.

[0074] The convolutional neural network (CNN) has strong feature extraction capability, can automatically learn the key features in the stator image, including subtle defect features that are difficult for humans to detect. Compared with traditional image processing algorithms, the CNN model captures the texture, shape and spatial relationship of the image more accurately, thereby significantly improving the accuracy of defect recognition and reducing the false detection rate and the missed detection rate. For example, the CNN model can more reliably detect defects such as small cracks on the surface of the stator or incomplete welds. The deep learning model has good generalization ability and can adapt to changes caused by different lighting conditions, shooting angles and stator surface states. Through training of a large number of diverse samples, the model can learn the essential features of the defects and reduce the interference of environmental factors on the recognition results. This improves the stability and reliability of the detection system in the actual production environment, and the detection performance can be maintained at a high level without frequent parameter adjustment.

[0075] More preferably, as shown in Figure 2 The identification processing of the stator local image subjected to the preprocessing operation to determine whether the current stator local image has defects comprises:

[0076] S1021: match the stator local image after the preprocessing operation with a standard image template, if the stator local image and the standard image template are in a first similarity interval, it is determined that the current stator local image does not exist defects;

[0077] S1022: if the stator local image and the standard image template are in a second similarity interval, it is determined that the current stator local image is suspected to exist defects;

[0078] S1023: if the stator local image and the standard image template are in a third similarity interval, it is determined that the current stator local image exists defects.

[0079] In the specific implementation, the three-level similarity recognition mode is adopted, the first level similarity is that the similarity is relatively high, and the welding point defect basically does not exist; for example, in the specific setting, the similarity can be 99%; the second level similarity is between 90% and 99%, at this time, the fuzzy zone appears, that is, the defect may exist or may not exist; because there are many factors that affect the matching result in the specific detection process, the case in the interval needs to be further analyzed; the third level similarity is less than 90%, in this case, it is indicated that the defect probably exists, and therefore the subsequent feature analysis can be directly performed to determine the final defect type and defect condition.

[0080] In the embodiment of the application, the similarity is divided into three intervals (first, second and third similarity intervals), and the system can make a hierarchical decision according to the image matching degree. For example, when the similarity is very high (first interval), it is directly determined to be qualified, avoiding unnecessary deep analysis; when the similarity is in the middle range (second interval), it is marked as a suspected defect, triggering a further verification process; when the similarity is very low (third interval), it is immediately determined to be a defect, realizing the fine classification of detection results. The traditional binary decision (qualified / unqualified) is easily affected by image noise, light changes and other factors, and the hierarchical mechanism provides a buffer space for uncertain situations by setting the "suspected defect" intermediate state, reducing the misjudgment rate.

[0081] The scheme of the embodiment of the application does not need to start a complex deep analysis module for high similarity images (first interval), directly obtains a qualified conclusion through template matching, significantly improves the detection speed, and immediately triggers an alarm or a repair process for low similarity images (third interval), avoiding resource waste. Only the images in the middle interval are verified additionally (such as 3D point cloud analysis), realizing the optimized allocation of computing resources. In the industrial production line scene, qualified samples and obvious defect samples are processed quickly, the computing resources are concentrated on difficult cases, the detection quantity in unit time can be greatly improved, and the large-scale production demand can be met.

[0082] In actual production, even qualified products can have slight appearance differences (such as surface texture, slight deviation of assembly position). By setting reasonable similarity interval thresholds, the system can tolerate these normal fluctuations and avoid misjudging qualified products as defects. By collecting detection data and actual defect verification results for a long time, the system can dynamically adjust the threshold range of the three similarity intervals, so that the detection standard is more in line with the actual production situation. For example, when it is found that the false positive rate in the "suspected defect" category is too high, the threshold range of the second interval can be appropriately relaxed. For suspected defect samples in the second interval, the system can automatically classify them into the queue for manual review or further analysis, forming a closed-loop management of the detection process, and ensuring that all potential problems are properly handled.

[0083] In the specific implementation, in addition to being used as a basis for defect determination, the image similarity value itself can also be used as a quantitative indicator of product quality. For example, the average similarity of all products in a production batch to the standard template can be used to evaluate the overall quality stability of the batch; analyzing the distribution curve of the similarity value can timely discover abnormal fluctuations in the production process.

[0084] More preferably, as shown in Figure 3 After determining that the current stator local image is suspected to have defects, the method further includes:

[0085] S1022a: performing template matching on the stator local image and a pre-constructed welding point template image to determine a first welding point image in the current stator local image, and determining first position information associated with the first welding point image;

[0086] S1022b: determining position information of the remaining welding points according to the first position information and the distribution state of the stator welding points, and determining second welding point images of the remaining welding points according to the position information of the remaining welding points;

[0087] S1022c: performing feature extraction on the first welding point image and the second welding point images to obtain welding point feature information, the welding point feature information including gray scale statistical features and shape features;

[0088] S1022d: inputting the welding point feature information into a support vector machine model to perform classification operation on each welding point image to determine the defect type of each welding point;

[0089] S1022e: when it is determined that the corresponding welding point has defects, marking the position and defect type of the corresponding welding point on the stator local image.

[0090] The embodiment of the present application can accurately identify the position of the first solder joint by matching the suspected defect image with the solder joint template. This template-based positioning method has strong robustness to light changes and slight deformation, ensuring accurate positioning of the core solder joint. By utilizing the distribution rule of the stator solder joint (such as uniform circumferential distribution) and combining the position information of the first solder joint, the system can accurately infer the positions of other solder joints through geometric calculation. This method avoids individual template matching for each solder joint, improving positioning efficiency.

[0091] The embodiment of the present application extracts statistical quantities such as the mean and variance of the gray scale of the solder joint area, which can reflect the brightness uniformity and glossiness of the solder joint surface, and has good discrimination ability for defects such as false welding and oxidation of the solder joint. Analyzing the geometric parameters such as the area, perimeter, circularity, and aspect ratio of the solder joint can effectively identify the shape deformation of the solder joint (such as too small solder joint caused by insufficient solder, or irregular shape caused by solder overflow). The combination of gray scale features and shape features describes the solder joint state from multiple dimensions, significantly improving the discrimination ability for different types of defects.

[0092] By training the support vector machine model, the system can accurately distinguish different types of solder joint defects, such as false welding, missing welding, excessive / insufficient solder, and residual welding slag. This provides clear guidance for subsequent repair work.

[0093] In specific implementation, a new template can also be automatically generated every 1000 detections using the last 50 good product images (moving average), thereby realizing a more refined and actual demand-compliant detection method.

[0094] More preferably, after determining that the current stator local image is suspected to have defects, the method further comprises:

[0095] Extracting key points of the current stator local image and the standard image template, calculating a transformation matrix between the two, and aligning the current stator local image with the standard image template according to the transformation matrix to obtain a stator transformed image;

[0096] Preprocessing the stator transformed image, and calculating the preprocessed stator transformed image and the standard image template to obtain a differential pixel image;

[0097] Performing binaryzation processing and morphological processing on the differential pixel image to obtain an enhanced differential pixel image; wherein the morphological processing includes using a 3x3 structure kernel to remove noise and using a 5x5 structure kernel to connect broken edges;

[0098] Performing connected component analysis on the enhanced differential image to screen out abnormal regions that meet the conditions;

[0099] Extract a feature parameter of an abnormal region, and determine a welding point defect type according to the feature parameter.

[0100] The embodiment of the application realizes sub-pixel level alignment of the stator image and the standard template by extracting key points such as ORB / SIFT and calculating a transformation matrix. Even if the stator exists slight rotation or displacement, the accuracy of subsequent differential analysis can be ensured. In the industrial production line, slight deviation of the stator position is a common problem. The method adaptively compensates for these deviations by calculating the transformation matrix in real time, and avoids false detection caused by position deviation.

[0101] By calculating the differential pixels of the aligned stator image and the standard template, any area with defects can be highlighted. This detection method based on pixel-level difference has extremely high sensitivity to slight defects (such as welding point cracks and stains). 3*3 structure kernel denoising: effectively removes salt and pepper noise and isolated pixels in the differential image, and retains the true defect features. 5*5 structure kernel edge connection: repairs the defect edge breakage caused by uneven illumination or image noise, and ensures the integrity of subsequent connected component analysis.

[0102] The embodiment of the application can quickly locate the suspected defect position by marking and analyzing the connected components in the differential image, and filter out false defects (such as dust particles) according to parameters such as area and perimeter. Extract the geometric features (area, aspect ratio) of the abnormal region, the gray features (mean, variance) and the texture features (contrast, entropy), combine the machine learning algorithm (such as SVM or decision tree) to realize the automatic classification of the defect type, and accurately distinguish different defects such as false welding, missing welding and excessive welding. In the embodiment of the application, differential comparison is introduced to improve the accuracy of detection (pixel-level difference between the current image and the template, highlighting the abnormal welding point).

[0103] More preferably, the feature extraction on the stator point cloud data to obtain a feature parameter group related to the stator point cloud comprises:

[0104] The clustering algorithm is used on the stator point cloud data to segment the welding point point cloud data of each welding point, and the principal component analysis is used to determine the principal axis of each welding point.

[0105] The minimum volume bounding box is generated along the principal axis for each welding point, the point cloud extreme value of each welding point is taken along the XYZ axis, and the calculated difference value of each axis is used as the size information of the bounding box, and the size information includes length information, width information and height information.

[0106] projecting the point cloud in the height Z0±ΔZ range of the solder joint centroid to the XY plane to generate a two-dimensional contour, extracting the contour boundary using an Alpha Shape algorithm to determine a first parameter set associated with the contour boundary, the first parameter set including area, perimeter, circularity, and long axis / short axis ratio;

[0107] taking an XZ plane point cloud along the center of the long axis or the wide axis of the solder joint, sorting the cross-sectional point cloud to generate a height variation curve, and determining a second parameter set of the vertical section according to the height variation curve, the second parameter set including maximum height difference, average curvature, and local depression depth;

[0108] constructing a feature parameter set related to the stator point cloud according to the size information, the first parameter set, and the second parameter set.

[0109] Specifically, by using a clustering algorithm such as DBSCAN, points belonging to the same solder joint in the point cloud data are clustered into independent regions, achieving accurate segmentation of the solder joint. Even in the case of dense distribution of solder joints, adjacent solder joints can be effectively distinguished; the principal axis direction of the solder joint is calculated using principal component analysis, providing a coordinate system reference for subsequent bounding box generation and feature extraction, ensuring that the directionality of feature extraction is consistent with the actual shape of the solder joint.

[0110] The length, width, and height information of the solder joint is obtained by the minimum volume bounding box to quantify the overall geometric size of the solder joint. These parameters can directly reflect whether the solder amount is sufficient, and have good discrimination ability for insufficient or excessive solder defects. The point cloud in a specific height range of the solder joint is projected onto the XY plane to extract parameters such as area, perimeter, and circularity of the contour. For example, the circularity parameter can detect whether the solder joint is irregularly shaped due to poor welding. The height variation curve of the XZ plane of the solder joint is analyzed to obtain parameters such as maximum height difference, average curvature, and local depression depth. These parameters have high sensitivity to defects such as depressions on the surface of the solder joint caused by virtual welding.

[0111] More specifically, the local depression depth parameter can accurately identify small depressions on the surface of the solder joint, which is a typical feature of virtual welding defects. The maximum height difference parameter can detect problems such as excessive or insufficient solder accumulation. The long axis / short axis ratio and circularity parameters can quantify the degree of shape distortion of the solder joint, effectively identifying solder joint deformation caused by unstable welding process. The average curvature parameter reflects the smoothness of the solder joint surface, and abnormal curvature changes may indicate cracks or unevenness on the solder joint surface.

[0112] In the specific implementation, the size information, the two-dimensional contour parameters and the section parameters describe the characteristics of the welding points from different dimensions to form complementary characteristic groups. For example, the two-dimensional contour parameters cannot detect defects in the height direction, but the section parameters can effectively supplement this information. By extracting key geometric characteristics, the original point cloud data is compressed into a low-dimensional feature vector, which significantly reduces the computational complexity of subsequent matching and classification while retaining sufficient defect information.

[0113] Specifically, the parameter combination diagnosis: different types of welding defects show different patterns in the characteristic parameter group. For example: false welding: usually shows local concave depth increase, roundness decrease, and average curvature anomaly. Insufficient solder: shows that the bounding box size is too small and the contour area is reduced. Excessive solder: shows that the bounding box height increases and the maximum height difference increases. Quantitative diagnostic criteria: by establishing the mapping relationship between the characteristic parameters and the defect types (such as threshold judgment or machine learning classifier), the automatic identification and classification of the defect types are realized.

[0114] More preferably, the feature extraction on the stator point cloud data to obtain the characteristic parameter group related to the stator point cloud further comprises:

[0115] Obtaining the centroid coordinates of all welding points;

[0116] Determining the coordinate system of the stator and converting the centroid coordinates of all welding points into polar coordinates;

[0117] Calculating the arc length or chord length between adjacent welding points;

[0118] Calculating the radial distance between adjacent welding points, the radial distance being the radial difference

[0119] The embodiment of the present application converts the centroid of the welding point from Cartesian coordinates to polar coordinates (radius r, angle θ), which more intuitively reflects the distribution law of the welding point on the circumference of the stator. The polar coordinate system is naturally adapted to the ring structure of the motor stator, which is convenient for analyzing the circumferential and radial distribution characteristics of the welding point. By calculating the arc length or chord length between adjacent welding points, the uniformity of the spacing of the welding points in the circumferential direction is quantified. These parameters directly reflect the positioning accuracy of the welding robot or tooling, and are of great significance for detecting the position offset defects of the welding points.

[0120] Specifically, the radial difference (Δr) of adjacent welding points can reveal the concentricity problem in the assembly process of the stator. For example, if the radial difference of a pair of adjacent welding points is significantly larger than that of other welding points, it may indicate that the stator core is eccentric or the positioning of the tooling fixture is inaccurate. Combined with the arc length / chord length and the radial difference parameters, the welding point with abnormal position can be accurately positioned. For example, the circumferential spacing of a certain welding point is abnormal but the radial distance is normal, which may be an angle offset in the welding process; while the radial difference is abnormal, which may be related to the assembly error of the stator.

[0121] More preferably, the motor detection method further comprises:

[0122] When the defect type is detected as a missing weld, the stator point cloud data is segmented to obtain point cloud information of two wire heads;

[0123] The centroid positions of the respective wire heads are calculated, and the height difference between the two wire heads in the corresponding direction is determined according to the centroid positions.

[0124] The main direction of each wire head is obtained by principal component analysis, the main direction is determined as a direction vector, and the included angle information between the two wire heads is determined according to the direction vector.

[0125] Generally, during the implementation of the detection process, the design parameters of the stator are considered to be fixed, so once a missing weld occurs, only the position of the missing weld needs to be identified, and further measurement of the step difference and the included angle is not required. However, in fact, even if the design is fixed, various factors in production can cause the actual product parameters to deviate from the design values. For example, during the welding process, the wire heads may be displaced or have angle changes due to thermal deformation or mechanical stress. These changes can cause problems such as reduced electrical performance, insufficient mechanical strength, or increased noise. Therefore, when the scheme of the present application is implemented,

[0126] Specifically, the point cloud segmentation technology is used to accurately separate the two wire heads to be welded in the embodiments of the present application, so as to ensure that the subsequent analysis focuses on the key area. Even in a complex stator structure, the clustering algorithm or the segmentation model based on deep learning can be used to accurately extract the wire heads. Simple two-dimensional image analysis may misjudge the missing weld (such as a surface stain being mistaken for a missing weld). By calculating the three-dimensional height difference and the direction included angle of the wire heads, it can be verified from the spatial structure whether there is a missing weld. For example, normally welded wire heads should be connected by solder and have a small height difference, while missing wire heads are usually separated and have a large height difference.

[0127] More specifically, when the height difference between the two wire heads exceeds a threshold value, it may indicate that there is a positioning deviation or insufficient solder during the welding process. For example, if the height difference is too large, it may be that the two wire heads were not correctly aligned before welding, resulting in the inability to form an effective weld point. The included angle of the wire head direction vector reflects the relative pose of the two wire heads. An abnormal included angle (such as close to 180°) may indicate that the wire head has been twisted or displaced during the welding process, which is usually related to the stability of the tooling fixture or the welding process parameters.

[0128] By collecting the height difference and the included angle data of the leakage welding wire head for a long time, a correlation model between the process parameters and the defect characteristics can be established. For example, if statistics find that the included angles of most leakage welding wire heads are concentrated in a certain interval, the motion trajectory of the welding robot or the clamping force of the clamp can be adjusted accordingly. Abnormal height difference or included angle distribution may reveal defects in the tool design. For example, if the height difference of the wire head at a certain position frequently exceeds the standard, the support structure or positioning device in that area may need to be improved.

[0129] Traditional solder joint detection usually adopts a single-point detection method (i.e., positioning, shooting, and analyzing each solder joint individually). However, the present scheme innovatively proposes a multi-solder joint overall matching detection, that is, a global image containing multiple solder joints (such as 9) is shot at one time, and the overall quality is quickly judged through template matching or feature comparison. Only when the matching fails, the single-point fine detection is started, forming a "overall to local" layered detection logic. The key of the scheme lies in utilizing the regularity of solder joint arrangement (fixed number, fixed angle, and fixed spacing) to transform the detection task of multiple solder joints into a pattern recognition problem, rather than the traditional individual analysis.

[0130] In the embodiment of the present application, the overall image of 9 solder joints is directly matched (or the sub-region is matched), avoiding the calculation overhead of individual solder joint detection, and greatly shortening the processing time. It is suitable for high-speed production lines (such as detecting 30+ stators per minute)

[0131] When specific matching is performed, the following methods can be used: pyramid layer matching: first, the image is down-sampled (1 / 4 resolution) for fast coarse matching, and then full-resolution fine matching is performed, which can improve the speed by 3 times. Hardware acceleration: using GPU (such as NVIDIA Jetson) to run the CUDA module of OpenCV, or using the hardware optimization algorithm of Halcon.

[0132] The general traditional method is to perform 2D and 3D detection independently, resulting in fragmented data. The innovation point of the present scheme is: 2D matching quickly locates suspicious solder joints → 3D point cloud accurately measures defects. For example: 2D finds that the brightness of a certain solder joint area is abnormal → 3D focuses on measuring the height / volume of that area. 2D matching quickly locates suspicious solder joints → 3D point cloud accurately measures defects. For example: 2D finds that the brightness of a certain solder joint area is abnormal → 3D focuses on measuring the height / volume of that area.

[0133] The motor detection method based on machine vision in the embodiment of the present application improves the accuracy and efficiency of the detection result by using the combination of two-dimensional images and three-dimensional point clouds for detection, and uses a multi-level image matching method to balance accuracy and efficiency during two-dimensional image detection.

[0134] Embodiment two

[0135] Please refer to Figure 8, Figure 8 is a structural schematic diagram of a motor detection system based on machine vision disclosed by the embodiment of the present application. As shown in Figure 8 , the motor detection system based on machine vision can include:

[0136] An image acquisition module 21 is configured to acquire a stator partial image of a stator to be detected at a stator detection tooling where the stator to be detected is installed through a camera module.

[0137] A preprocessing module 22 is configured to perform a preprocessing operation on the acquired stator partial image, and perform an identification processing on the stator partial image after the preprocessing operation to determine whether the current stator partial image has a defect; if not, control the stator detection tooling device to rotate according to the set condition to perform the next stage of stator partial detection.

[0138] A point cloud acquisition module 23 is configured to acquire stator point cloud data of the stator to be detected at the stator detection tooling through a 3D structured light camera if yes, and perform feature extraction on the stator point cloud data to obtain a feature parameter group related to the stator point cloud.

[0139] A feature comparison module 24 is configured to match the feature parameter group with a set point cloud feature to determine the type and position of the stator welding defect existing under the current detection condition.

[0140] The motor detection method based on machine vision in the embodiment of the present application improves the accuracy and efficiency of the detection result by adopting a combined detection mode of two-dimensional image and three-dimensional point cloud, and adopts a multi-level image matching mode to realize the balance between accuracy and efficiency during two-dimensional image detection.

[0141] Embodiment three

[0142] Please refer to Figure 9 , Figure 9 is a structural schematic diagram of an electronic device disclosed by the embodiment of the present application. The electronic device can be a computer, a server, etc., and of course, under certain circumstances, it can also be a mobile phone, a tablet computer, a smart monitoring terminal, etc., and an image acquisition device with processing function. As shown in Figure 9 , the electronic device can include:

[0143] A memory 510 storing executable program codes;

[0144] A processor 520 coupled with the memory 510;

[0145] The processor 520 calls the executable program codes stored in the memory 510 to execute part or all of the steps of the motor detection method based on machine vision in the embodiment one.

[0146] The embodiment of the present application discloses a computer readable storage medium which stores a computer program, wherein the computer program causes a computer to execute part or all steps of the motor detection method based on machine vision in the embodiment one.

[0147] The embodiment of the present application also discloses a computer program product, wherein when the computer program product is run on a computer, the computer program product causes the computer to execute part or all steps of the motor detection method based on machine vision in the embodiment one.

[0148] The embodiment of the present application also discloses an application publishing platform, wherein the application publishing platform is used for publishing a computer program product, wherein when the computer program product is run on a computer, the computer program product causes the computer to execute part or all steps of the motor detection method based on machine vision in the embodiment one.

[0149] In various embodiments of the present application, it should be understood that the size of the serial number of the processes does not mean the inevitable sequence of execution, and the execution sequence of the processes should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.

[0150] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. they may be located in one place, or they may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment of the present application.

[0151] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0152] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer accessible memory. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, which is stored in a memory and includes a number of steps for causing a computer device (which can be a personal computer, a server or a network device, and specifically can be a processor in the computer device) to execute the methods described in each embodiment of the present application.

[0153] In the embodiments provided in the present application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that the determination of B according to A does not mean that B is determined only according to A, but B can also be determined according to A and / or other information.

[0154] A person of ordinary skill in the art can understand that part or all of the steps in the various methods of the embodiments can be completed by instructing the relevant hardware by a program, and the program can be stored in a computer readable storage medium, including Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM) or other optical disk memories, magnetic disk memories, magnetic tape memories, or any other computer readable medium capable of carrying or storing data.

[0155] The machine vision-based motor detection method and system, the electronic device and the storage medium disclosed in the embodiments of the present application are described in detail above, and the principles and implementation manners of the present application are described by applying specific examples in this paper. The above description of the embodiments is only used to help understand the method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range will be changed, and the above description should not be understood as a limitation of the present application.

Claims

1. A machine vision-based motor detection method, characterized in that, include: A partial image of the stator to be inspected is acquired using a camera module at the stator inspection fixture, where the stator to be inspected is installed; the partial image of the stator includes multiple weld point images; The acquired stator partial image is preprocessed, and the preprocessed stator partial image is then identified to determine whether there are defects in the current stator partial image; if not, the stator inspection fixture is controlled to rotate according to the set conditions to perform the next stage of stator partial inspection. The step of identifying defects in the pre-processed stator local image to determine whether there are defects in the current stator local image includes: The preprocessed stator local image is matched with a standard image template. If the stator local image and the standard image template are in the first similarity interval, it is determined that the current stator local image does not have defects. If the stator local image and the standard image template are within the second similarity interval, then it is determined that the current stator local image is suspected of having a defect; after determining that the current stator local image is suspected of having a defect, the method further includes: The stator local image is matched with a pre-constructed solder joint template image to determine the first solder joint image in the current stator local image, and the first position information associated with the first solder joint image is determined. The position information of each of the remaining solder joints is determined based on the first position information and the distribution state of the stator solder joints, and the second solder joint image of each of the remaining solder joints is determined based on the position information of each of the remaining solder joints. Feature extraction is performed on the first solder joint image and the second solder joint image to obtain solder joint feature information, which includes grayscale statistical features and shape features. The solder joint feature information is input into a support vector machine model to classify each solder joint image to determine the defect type of each solder joint. When a defect is identified in a corresponding solder joint, the location of the solder joint and the type of defect are marked on the local image of the stator. If the stator local image and the standard image template are in the third similarity interval, then it is determined that the current stator local image has a defect; If so, the stator point cloud data of the stator to be inspected at the stator inspection fixture is obtained by using a 3D structured light camera, and feature extraction is performed on the stator point cloud data to obtain a set of feature parameters related to the stator point cloud. The set of feature parameters is matched with the set point cloud features to determine the type and location of stator welding defects existing under the current detection conditions.

2. The machine vision-based motor detection method as described in claim 1, characterized in that, The step of identifying defects in the pre-processed stator local image to determine whether there are defects in the current stator local image includes: The preprocessed stator local image is input into a pre-built stator detection model for identification to determine whether there are defects in the current stator local image; the stator detection model is an identification model built based on a convolutional neural network.

3. The machine vision-based motor detection method as described in claim 1, characterized in that, After determining that the current stator local image is suspected of having a defect, the method further includes: Extract key points from the current stator local image and the standard image template, calculate the transformation matrix between them, and align the current stator local image with the standard image template according to the transformation matrix to obtain the stator transformed image; The stator transformation image is preprocessed, and a differential pixel image is obtained by calculating the difference between the preprocessed stator transformation image and the standard image template. The differential pixel image is binarized and morphologically processed to obtain an enhanced differential pixel image; wherein, the morphological processing includes using a 3×3 structure kernel to remove noise and using a 5×5 structure kernel to connect broken edges; Connectivity analysis was performed on the enhanced difference graph to filter out anomalous regions that met the criteria; Extract the feature parameters of the abnormal area, and determine the type of weld defect based on the feature parameters.

4. The machine vision-based motor detection method as described in claim 1, characterized in that, The step of extracting features from the stator point cloud data to obtain a set of feature parameters related to the stator point cloud includes: Clustering algorithms are used to segment the stator point cloud data into weld point point cloud data for each weld point, and principal component analysis is used to determine the principal axis of each weld point. For each solder joint, a minimum volume bounding box is generated along the main axis. The extreme values ​​of the point cloud of each solder joint are taken along the XYZ axes, and the calculated difference of each axis is used as the size information of the bounding box. The size information includes length information, width information and height information. The point cloud within the height range of the centroid of the solder joint Z0±ΔZ is extracted, and the point cloud within the height range of the centroid of the solder joint Z0±ΔZ is projected onto the XY plane to generate a two-dimensional contour. The contour boundary is extracted using the Alpha Shape algorithm to determine the first set of parameters associated with the contour boundary. The first set of parameters includes area, perimeter, roundness, and major axis / minor axis ratio. The XZ plane point cloud is intercepted along the center of the long axis or wide axis of the weld point, and the cross-sectional point cloud is sorted to generate a height change curve. The second parameter set of the vertical cross-section is determined based on the height change curve. The second parameter set includes the maximum height difference, average curvature, and local depression depth. Based on the size information, the first parameter group, and the second parameter group, a set of feature parameters related to the stator point cloud is constructed.

5. The machine vision-based motor detection method as described in claim 4, characterized in that, The step of extracting features from the stator point cloud data to obtain a set of feature parameters related to the stator point cloud further includes: Obtain the centroid coordinates of all solder joints; Determine the coordinate system of the stator and convert the centroid coordinates of all weld points to polar coordinates; Calculate the arc length or chord length between adjacent weld points; Calculate the radial distance between adjacent solder joints, where the radial distance is the radial difference.

6. The machine vision-based motor detection method as described in claim 5, characterized in that, The motor testing method further includes: When a defect type of missing solder is detected, the stator point cloud data is segmented to extract point cloud information of two wire ends; The centroid positions of each line end are calculated, and the height difference between them in the corresponding direction is determined based on the centroid positions. Principal component analysis is used to obtain the main direction of each line end, the main direction is determined as a direction vector, and the angle information between the two is determined based on the direction vector.

7. A machine vision-based motor inspection system, characterized in that, include: Image acquisition module: used to acquire a partial image of the stator to be inspected at the stator inspection fixture via a camera module, wherein the stator to be inspected is installed at the stator inspection fixture; the partial image of the stator includes multiple weld point images; Preprocessing module: used to preprocess the acquired stator partial image, and to identify the preprocessed stator partial image to determine whether there is a defect in the current stator partial image; if not, control the stator inspection fixture to rotate according to the set conditions to perform the next stage of stator partial inspection. The step of identifying defects in the pre-processed stator local image to determine whether there are defects in the current stator local image includes: The preprocessed stator local image is matched with a standard image template. If the stator local image and the standard image template are in the first similarity interval, it is determined that the current stator local image does not have defects. If the stator local image and the standard image template are within the second similarity interval, then it is determined that the current stator local image is suspected of having a defect; after determining that the current stator local image is suspected of having a defect, the method further includes: The stator local image is matched with a pre-constructed solder joint template image to determine the first solder joint image in the current stator local image, and the first position information associated with the first solder joint image is determined. The position information of each of the remaining solder joints is determined based on the first position information and the distribution state of the stator solder joints, and the second solder joint image of each of the remaining solder joints is determined based on the position information of each of the remaining solder joints. Feature extraction is performed on the first solder joint image and the second solder joint image to obtain solder joint feature information, which includes grayscale statistical features and shape features. The solder joint feature information is input into a support vector machine model to classify each solder joint image to determine the defect type of each solder joint. When a defect is identified in a corresponding solder joint, the location of the solder joint and the type of defect are marked on the local image of the stator. If the stator local image and the standard image template are in the third similarity interval, then it is determined that the current stator local image has a defect; Point cloud acquisition module: If so, it is used to acquire the stator point cloud data of the stator to be inspected at the stator inspection fixture through a 3D structured light camera, and to extract features from the stator point cloud data to obtain a set of feature parameters related to the stator point cloud. Feature comparison module: used to match the feature parameter group with the set point cloud features to determine the type and location of stator welding defects existing under the current detection conditions.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program causes a computer to perform the machine vision-based motor detection method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Carpet defect detection method and system based on visual detection

    CN116818664A

  • Tin soldering height and defect detection method based on machine vision

    CN117670887A

  • Motor stator defect detection method based on three-dimensional point cloud

    CN119151859A