Image recognition-based micro motor shell structure defect detection method and system

CN122948842APending Publication Date: 2026-10-20HUNAN JINMALI MICRO MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611178400.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-05
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0002]目前,微型电机作为消费电子、智能家居、汽车电子等领域的核心驱动部件,其外壳结构完整性直接决定电机防护性能与使用寿命,裂纹、凹陷等细微缺陷易导致水汽、粉尘侵入,引发绕组短路、轴承锈蚀等故障

Benefits of technology

[0014]其有益效果在于,通过多光谱图像采集结合跨模态注意力融合机制,同步捕捉显隐性缺陷特征,搭配改进ResNet与YOLOv8构建的检测模型,检测准确率≥98%,漏检率、误检率均≤1%,可精准识别0.1mm级细微缺陷。检测效率高,全程自动化操作,单台外壳检测时间≤5s,无需人工干预,大幅提升规模化生产检测效率,降低人工成本。通用性强,通过调整夹具、霍夫圆检测参数及模型anchor框尺寸,可适配5-20mm不同型号、尺寸的微型电机外壳,无需单独开发检测方案。四是实用性突出,设置伪缺陷区分机制与综合置信度判定标准,减少误判;自动生成可追溯的PDF检测报告,同步存储数据,便于生产质量追溯与统计分析,提高检测的效率和准确度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This invention discloses a method and system for detecting structural defects in the casing of miniature motors based on image recognition. The method involves acquiring multidimensional image data; fusing multispectral image features using a cross-modal attention fusion mechanism to obtain a fused feature tensor; constructing a multi-task defect detection model based on a deep convolutional neural network; extracting shared feature maps at multiple scales using an improved neural network; generating candidate defect regions on the shared feature maps based on the detection network; distinguishing between real and false structural defects in the candidate regions using a binary classification structure; and outputting the recognition result. Based on the recognition result, the comprehensive confidence score for each defect is calculated. When the comprehensive confidence score is greater than a preset judgment threshold, a structural defect is determined to exist at the corresponding location, and a defect detection report is output. This improves the efficiency and accuracy of detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and in particular to a method and system for detecting structural defects in the housing of a miniature motor based on image recognition. Background Technology

[0002] Currently, micro motors are core driving components in consumer electronics, smart homes, and automotive electronics. The integrity of their casing structure directly determines the motor's protection performance and lifespan. Minor defects such as cracks and dents can easily lead to the intrusion of moisture and dust, causing winding short circuits, bearing corrosion, and other failures. Currently, defect detection in micro motor casings largely relies on manual visual inspection or single-spectrum detection. Manual inspection is heavily influenced by experience, resulting in high rates of missed and false detections, and low efficiency, failing to meet the demands of large-scale production. Single-spectrum detection has dimensional limitations, making it difficult to cover both visible and latent defects, easily missing internal cracks identifiable in the near-infrared band and minute defects detectable in the ultraviolet band. Traditional detection models often employ unoptimized neural networks, which lack sufficient accuracy in identifying minute defects of 0.1-2mm in micro motor casings, resulting in low detection efficiency and accuracy. Furthermore, the lack of a false defect differentiation mechanism makes it difficult to meet industrial-grade inspection requirements. Summary of the Invention

[0003] The purpose of this invention is to solve the above-mentioned problems by designing a method and system for detecting defects in the housing structure of a miniature motor based on image recognition.

[0004] To achieve the above objectives, the technical solution of the present invention further includes the following steps in the above-mentioned image recognition-based method for detecting defects in the structure of a miniature motor housing: The housing of the micro motor to be tested is fixed on a rotating stage that rotates at a constant speed around its axis. Visible light band images, near-infrared band images and ultraviolet band images are acquired using an image acquisition device to obtain multidimensional image data. After preprocessing the multidimensional image data, the Hough circle detection is used to locate the annular region of the shell, extract the annular region of interest, and expand the annular region of interest by transforming it from polar coordinates to rectangular coordinates to obtain a rectangular unfolded image. Multispectral image features of the rectangular unfolded graph are extracted, and a cross-modal attention fusion mechanism is used to fuse the multispectral image features to obtain a fused feature tensor. A multi-task defect detection model based on deep convolutional neural networks is constructed. An improved ResNet neural network is used to extract multi-scale shared feature maps. Based on the YOLOv8 detection network, defect candidate regions are generated on the shared feature maps. A binary classification structure is used to distinguish between real structural defects and pseudo defects in the defect candidate regions, and the recognition results are output. The overall confidence score of each defect is calculated based on the identification results. When the overall confidence score is greater than the preset judgment threshold, it is determined that there is a structural defect at the corresponding location, and a defect detection report is output.

[0005] Furthermore, in the above-mentioned method for detecting structural defects in the casing of a miniature motor based on image recognition, after preprocessing the multidimensional image data, the Hough circle detection is used to locate the annular region of the casing, extracting the annular region of interest, and then performing a polar coordinate to rectangular coordinate transformation on the annular region of interest to obtain a rectangular unfolded image, including: The acquired multidimensional image data is denoised using an adaptive Gaussian filtering algorithm. The SIFT scale-invariant feature transform algorithm is used to extract feature points of each band image. The multi-band images are aligned by feature point matching to obtain aligned multi-band images. The aligned multi-band image is converted into a grayscale image, and the grayscale values ​​are mapped to the [0,255] interval using a linear normalization method to eliminate grayscale differences between different bands and under different acquisition conditions, thus obtaining standard multidimensional image data.

[0006] Furthermore, in the above-mentioned method for detecting structural defects in the casing of a miniature motor based on image recognition, after preprocessing the multidimensional image data, the Hough circle detection is used to locate the annular region of the casing, extracting the annular region of interest, and then performing a polar coordinate to rectangular coordinate transformation on the annular region of interest to obtain a rectangular unfolded image, including: The Hough circle detection algorithm is used to perform edge detection on the preprocessed grayscale image to extract the outer shell edge contour. The radius range of the circle is set by Hough circle transformation, and the circular area that conforms to the outer shell contour is filtered out to obtain the center coordinates and radius parameters of the outer shell annular area. Based on the annular region parameters obtained by Hough circle detection, an annular region of interest is extracted. The extracted annular region of interest is then expanded by transforming polar coordinates to rectangular coordinates to obtain a rectangular unfolded image.

[0007] Furthermore, in the above-mentioned method for detecting defects in the casing structure of a miniature motor based on image recognition, the step of extracting multispectral image features from the rectangular unfolded image and fusing the multispectral image features using a cross-modal attention fusion mechanism to obtain a fused feature tensor includes: Image features of each band are extracted from the rectangular unfolded image. The visible light band extracts the texture features and gray-scale difference features of the shell surface, the near-infrared band extracts the latent defect features inside the shell, and the ultraviolet band extracts the micro-cracks and oil residue features on the shell surface. A cross-modal attention fusion mechanism is used to standardize the features extracted from each band to eliminate feature scale differences. The weights of the features in each band are calculated through the attention mechanism, and the weighted features of each band are spliced ​​and fused to obtain the fused feature tensor.

[0008] Furthermore, in the above-mentioned image recognition-based method for detecting structural defects in the casing of miniature motors, the construction of a multi-task defect detection model based on a deep convolutional neural network involves using an improved ResNet neural network to extract multi-scale shared feature maps, generating defect candidate regions on the shared feature maps using a YOLOv8 detection network, and employing a binary classification structure to distinguish between real structural defects and pseudo-defects in the defect candidate regions. The output of the recognition result includes: The SE attention mechanism is added to the 3rd, 4th and 5th convolutional layers of the original ResNet-50 neural network to enhance attention to defect features and suppress background redundancy features; at the same time, the size of the convolutional kernel is adjusted, and some 3×3 convolutional kernels are replaced with a combination of 1×3 and 3×1 convolutional kernels to obtain the improved ResNet-50 neural network. Shared feature maps of fused feature tensors are extracted using multi-scale pooling operations on an improved ResNet-50 neural network. Based on the improved YOLOv8 detection network, feature fusion is performed on multi-scale shared feature maps, fusing high-level features with low-level features; The anchor frame size of YOLOv8 is adjusted according to the size range of the defects in the micro motor housing; finally, the defect candidate region is generated by the YOLOv8 detection head, which includes at least the defect coordinates and size information.

[0009] Furthermore, in the above-mentioned image recognition-based method for detecting structural defects in the casing of miniature motors, the construction of a multi-task defect detection model based on a deep convolutional neural network involves using an improved ResNet neural network to extract multi-scale shared feature maps, generating defect candidate regions on the shared feature maps using a YOLOv8 detection network, and employing a binary classification structure to distinguish between real structural defects and pseudo-defects in the defect candidate regions. The output of the recognition result includes: The fused feature tensor of the defect candidate region is input into a binary classification network, and the probability that the candidate region is a real defect is output through the sigmoid activation function. Set the probability threshold to 0.5. When the probability is ≥0.5, it is judged as a real defect; otherwise, it is a false defect. Output the specific location of the defect, the defect type, and the preliminary detection confidence level.

[0010] Furthermore, in the above-mentioned image recognition-based method for detecting structural defects in the casing of a miniature motor, the step of calculating the comprehensive confidence score of each defect based on the recognition results, and determining that a structural defect exists at the corresponding location when the comprehensive confidence score is greater than a preset judgment threshold, and outputting a defect detection report, includes: The overall confidence score for each defect is calculated based on the defect identification results. The overall confidence score includes the preliminary detection confidence score generated by YOLOv8, the true defect probability output by the binary classification network, and the multispectral feature matching degree. The calculation formula is: Overall confidence score = 0.6 × Preliminary detection confidence score + 0.3 × True defect probability + 0.1 × Feature matching degree. The overall confidence score range is 0-1.

[0011] Furthermore, in the image recognition-based micro-motor housing structure defect detection system, the micro-motor housing structure defect detection system includes the following modules: The multidimensional image acquisition module is used to fix the housing of the micro motor to be tested onto a rotating stage that rotates at a constant speed around its axis, and to acquire visible light, near-infrared and ultraviolet images using an image acquisition device to obtain multidimensional image data. The image extraction and unfolding module is used to preprocess the multidimensional image data, use Hough circle detection to locate the annular region of the shell, extract the annular region of interest, and perform polar coordinate to rectangular coordinate transformation to unfold the annular region of interest to obtain a rectangular unfolded image. The feature tensor fusion module is used to extract multispectral image features from the rectangular unfolded graph. It uses a cross-modal attention fusion mechanism to fuse the multispectral image features to obtain a fused feature tensor. The detection model building module is used to construct a multi-task defect detection model based on a deep convolutional neural network. It uses an improved ResNet neural network to extract multi-scale shared feature maps, generates defect candidate regions on the shared feature maps based on the YOLOv8 detection network, and uses a binary classification structure to distinguish between real structural defects and pseudo defects in the defect candidate regions, and outputs the recognition results. The structural defect detection module is used to calculate the overall confidence score of each defect based on the identification results. When the overall confidence score is greater than the preset judgment threshold, it is determined that there is a structural defect at the corresponding location and a defect detection report is output.

[0012] Furthermore, in the image recognition-based micro-motor housing structure defect detection system, the detection model establishment module includes the following sub-modules: The input submodule is used to input the fused feature tensor of the defect candidate region into the binary classification network, and output the probability that the candidate region is a real defect through the sigmoid activation function; The judgment submodule is used to set the probability threshold to 0.5. When the probability is ≥0.5, it is judged as a real defect; otherwise, it is a false defect. The module outputs the specific location of the defect, the defect type, and the preliminary detection confidence level.

[0013] Furthermore, in the image recognition-based micro-motor housing structural defect detection system, the structural defect detection module includes the following sub-modules: The confidence submodule is used to calculate the overall confidence of each defect based on the defect identification results. The overall confidence includes the preliminary detection confidence generated by YOLOv8, the true defect probability output by the binary classification network, and the multispectral feature matching degree. The calculation submodule is used to calculate the following formula: Overall confidence score = 0.6 × Preliminary detection confidence score + 0.3 × True defect probability + 0.1 × Feature matching degree. The overall confidence score ranges from 0 to 1.

[0014] Its beneficial effects lie in the fact that by combining multispectral image acquisition with a cross-modal attention fusion mechanism, it simultaneously captures explicit and implicit defect features. Combined with a detection model built using an improved ResNet and YOLOv8, the detection accuracy is ≥98%, with both false negative and false positive rates ≤1%, accurately identifying minute defects as small as 0.1mm. It boasts high detection efficiency, with fully automated operation; the inspection time for a single casing is ≤5s, requiring no manual intervention, significantly improving the efficiency of large-scale production inspection and reducing labor costs. It is highly versatile; by adjusting the fixture, Hough circle detection parameters, and model anchor frame size, it can adapt to micro-motor casings of different models and sizes from 5-20mm, without the need for separately developed inspection solutions. Fourthly, it is highly practical, setting up a false defect differentiation mechanism and a comprehensive confidence level judgment standard to reduce misjudgments; it automatically generates traceable PDF inspection reports, synchronously storing data for easy production quality traceability and statistical analysis, improving the efficiency and accuracy of inspection. Attached Figure Description

[0015] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention.

[0016] Figure 1 This is a schematic diagram of the first embodiment of the image recognition-based method for detecting defects in the casing structure of a miniature motor, as described in this invention. Figure 2 This is a schematic diagram of the second embodiment of the image recognition-based method for detecting defects in the casing structure of a miniature motor according to the present invention. Figure 3 This is a schematic diagram of the first embodiment of the image recognition-based micro motor housing structure defect detection system in this invention. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0018] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms "one," "an," and "this" used herein may also include the plural forms. It should be further understood that the terminology used in this specification includes the presence of features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0019] The present invention will now be described in detail with reference to the accompanying drawings. Figure 1 As shown, a method for detecting structural defects in the housing of a miniature motor based on image recognition is described. This method includes the following steps: Step 101: Fix the housing of the micro motor to be tested onto a rotating platform that rotates at a constant speed around its axis, and use an image acquisition device to acquire visible light band images, near-infrared band images and ultraviolet band images to obtain multidimensional image data. Specifically, in this embodiment, 1.1 Stage Fixing and Adjustment: The housing of the micro motor to be tested is fixed on a precision stage that rotates uniformly around its axis using a special flexible clamp. The clamp must match the size of the housing to ensure a firm fixation without extrusion deformation, thus avoiding false defects caused by clamp pressure. The level of the stage is adjusted to ensure that the rotation axis of the housing is perpendicular to the optical axis of the image acquisition device, and the coaxiality error is controlled within ±0.01mm.

[0020] Based on the diameter of the micro motor housing, which is typically 5-20mm, the stage is set to rotate at a constant speed of 50-100r / min. The speed must be kept stable to avoid image blurring or missed acquisition points due to speed fluctuations. At the same time, a rotation trigger signal is set to achieve synchronous linkage with the image acquisition device.

[0021] The image acquisition device adopts an "industrial camera + multi-band lens + supplementary lighting module". The industrial camera has a resolution of no less than 12 million pixels and a frame rate of ≥30fps to ensure clear and motion-free images. The supplementary lighting module is matched with visible light, near-infrared and ultraviolet bands respectively. The visible light supplementary lighting uses a ring LED light source with adjustable brightness to avoid reflection. The near-infrared band uses 850nm wavelength supplementary lighting and the ultraviolet band uses 365nm wavelength supplementary lighting to detect defects that are difficult to detect by visible light, such as hidden cracks and oil residue on the surface of the shell.

[0022] After the stage starts rotating, the image acquisition device starts synchronously, performing omnidirectional acquisition around the circumference of the outer shell. One frame of image is acquired for every 1° of rotation to ensure that there are no blind spots on the surface of the outer shell. Images are acquired in the visible light band (400-760nm), near-infrared band (760-1100nm), and ultraviolet band (200-400nm). The number of images acquired in each band is determined according to the circumference of the outer shell, usually 360 frames / band. Finally, a multidimensional image dataset containing three bands and multiple frames of images is obtained, which is stored in TIFF format to retain the original pixel information for subsequent preprocessing.

[0023] Step 102: After preprocessing the multidimensional image data, the Hough circle detection is used to locate the annular region of the shell, extract the annular region of interest, and perform polar coordinate to rectangular coordinate transformation on the annular region of interest to obtain a rectangular unfolded image. Specifically, in this embodiment, the acquired multidimensional image data is denoised using an adaptive Gaussian filtering algorithm, and the SIFT scale-invariant feature transform algorithm is used to extract feature points of each band image. The multi-band images are aligned by feature point matching to obtain aligned multi-band images. The aligned multi-band images are converted into grayscale images, and the grayscale values ​​are mapped to the [0,255] interval using a linear normalization method to eliminate grayscale differences between different bands and under different acquisition conditions, thus obtaining standard multidimensional image data.

[0024] The Hough circle detection algorithm is used to perform edge detection on the preprocessed grayscale image to extract the shell edge contour. The radius range of the circle is set by Hough circle transformation, and circular areas that conform to the shell contour are selected to obtain the center coordinates and radius parameters of the shell annular area. Based on the annular area parameters obtained by Hough circle detection, an annular region of interest is extracted. The extracted annular region of interest is expanded by transforming polar coordinates to rectangular coordinates to obtain a rectangular unfolded image.

[0025] To address the Gaussian noise and salt-and-pepper noise that may exist in the acquired multi-band images, caused by equipment interference and changes in ambient light, an adaptive Gaussian filtering algorithm is used for noise reduction. The filter kernel size is set to 3×3, and the filter coefficient is dynamically adjusted according to the image noise intensity. This removes noise interference while preserving the detailed features of the shell surface, such as tiny scratches and fine cracks.

[0026] Since there may be slight positional shifts during multi-band image acquisition due to camera angle and minor stage wobbling, SIFT (Scale Invariant Feature Transform) algorithm is used to extract feature points from each band image. Feature point matching is then used to achieve precise alignment of the multispectral images, with the alignment error controlled within 1 pixel, ensuring the accuracy of subsequent feature fusion.

[0027] The aligned multi-band image is converted into a grayscale image, and the grayscale value is mapped to the [0,255] interval using a linear normalization method. This eliminates the grayscale differences between different bands and under different acquisition conditions, unifies the image grayscale scale, and lays the foundation for subsequent region localization and feature extraction.

[0028] For the annular structure of the micro motor housing, the Hough circle detection algorithm is used to locate the annular region of the housing. First, edge detection is performed on the preprocessed grayscale image using the Canny edge detection algorithm with a threshold set to 50-150 to extract the edge contour of the housing. Then, the Hough circle transform is used to set the radius range of the circle and match the actual radius of the housing to be detected. Circular regions that conform to the housing contour are selected to eliminate background interference, such as the surface of the fixture and the stage, and the center coordinates and radius parameters of the annular region of the housing are obtained.

[0029] Based on the annular region parameters obtained from Hough circle detection, the annular region of interest, i.e. the effective detection area of ​​the shell, is extracted. The central hollow part and the redundant edge region are excluded. The pixel of the annular region is retained by masking operation and the background pixel is removed, which reduces the amount of data for subsequent processing and improves processing efficiency.

[0030] Since the outer shell has a ring-shaped structure, direct detection is prone to defect localization errors. The extracted ring-shaped region of interest is expanded by transforming polar coordinates to rectangular coordinates. The center of the ring region is taken as the pole, the radius direction is taken as the polar diameter, and the circumferential direction is taken as the polar angle. The ring region is expanded into a rectangular image along the polar angle direction. The length of the rectangle corresponds to the circumference of the ring, and the width corresponds to the thickness of the ring. This transforms the ring-shaped defects on the outer shell surface into linear or blocky defects in the rectangular image, which facilitates subsequent feature extraction and defect detection.

[0031] Step 103: Extract the multispectral image features of the rectangular unfolded graph, and use a cross-modal attention fusion mechanism to fuse the multispectral image features to obtain the fused feature tensor; Specifically, in this embodiment, image features of each band are extracted from the rectangular unfolded image. The visible light band extracts the texture features and grayscale difference features of the shell surface, the near-infrared band extracts the latent defect features inside the shell, and the ultraviolet band extracts the micro-cracks and oil residue features on the shell surface. A cross-modal attention fusion mechanism is used to standardize the features extracted from each band to eliminate feature scale differences. The weights of the features of each band are calculated through the attention mechanism, and the weighted features of each band are spliced ​​and fused to obtain the fused feature tensor.

[0032] For the unfolded rectangular multispectral image, image features were extracted for each band: visible light, near-infrared, and ultraviolet. In the visible light band, the focus was on extracting texture features and gray-level differences on the outer shell surface, corresponding to visible defects such as scratches and dents. In the near-infrared band, the focus was on extracting latent defect features inside the shell, such as internal cracks and uneven material density. In the ultraviolet band, the focus was on extracting features such as micro-cracks and oil residue on the shell surface; latent defects will exhibit fluorescence under ultraviolet light, making their features more prominent. Specifically extracted features included: Local Binary Pattern (LBP), LBP texture features, Gray-Level Co-occurrence Matrix (GLCM), and Edge Direction Histogram (EDM). Each band had a feature extraction dimension of 256.

[0033] A cross-modal attention fusion mechanism is employed to fuse multispectral image features from three bands, addressing the issues of incomplete feature information and potential for missed detections in single-band features. First, the features extracted from each band are standardized to eliminate feature scale differences. Then, an attention mechanism is used to calculate the weights of each band's features, assigning weights based on the correlation between features and defects, with higher weights for bands showing more pronounced defect features. Finally, the weighted features from each band are concatenated and fused to obtain a 768-dimensional fused feature tensor, preserving multi-band defect feature information and improving the accuracy of subsequent defect identification.

[0034] Step 104: Construct a multi-task defect detection model based on a deep convolutional neural network. Use an improved ResNet neural network to extract multi-scale shared feature maps. Generate defect candidate regions on the shared feature maps based on the YOLOv8 detection network. Use a binary classification structure to distinguish between real structural defects and pseudo-defects in the defect candidate regions and output the recognition results. Specifically, in this embodiment, an SE attention mechanism is added to the 3rd, 4th, and 5th convolutional layers of the original ResNet-50 neural network to enhance attention to defect features and suppress redundant background features. Simultaneously, the kernel size is adjusted, replacing some 3×3 kernels with combinations of 1×3 and 3×1 kernels to obtain an improved ResNet-50 neural network. A shared feature map of the fused feature tensor is extracted using multi-scale pooling operations in the improved ResNet-50 neural network. Feature fusion is performed on the multi-scale shared feature map based on the improved YOLOv8 detection network, fusing high-level features with low-level features. The anchor box size of YOLOv8 is adjusted according to the size range of the micro-motor housing defect. Finally, a defect candidate region is generated using the YOLOv8 detection head, including at least defect coordinates and size information.

[0035] The fusion feature tensor of the defect candidate region is input into a binary classification network, and the probability of the candidate region being a real defect is output through the sigmoid activation function. The probability threshold is set to 0.5. When the probability is ≥0.5, it is judged as a real defect; otherwise, it is a false defect. The specific location, defect type, and preliminary detection confidence of the defect are output.

[0036] An improved ResNet-50 neural network was used as the shared feature extraction module. To address the subtle and diverse scale characteristics of defects in the casing of micro-motors, the original ResNet-50 was optimized: an attention mechanism (SE attention module) was added to the 3rd, 4th, and 5th convolutional layers to enhance attention to defect features and suppress redundant background features; simultaneously, the kernel size was adjusted, replacing some 3×3 kernels with combinations of 1×3 and 3×1 kernels to reduce computation while improving the feature extraction capability for slender defects such as fine cracks; finally, multi-scale pooling operations were performed, using 2×2, 4×4, and 8×8 pooling kernels respectively, to extract multi-scale shared feature maps with sizes of 64×64, 32×32, and 16×16, covering defect features of different sizes, from tiny scratches to large dents. Based on the improved YOLOv8 detection network, defect candidate regions are generated on the shared feature map: First, feature fusion is performed on the multi-scale shared feature map using a Feature Pyramid Network (FPN) to fuse high-level features rich in semantic information with low-level features rich in detail information, thereby improving the accuracy of candidate region localization; then, according to the size range of micro motor housing defects, typically 0.1-2mm, the YOLOv8 anchor box size is adjusted, and three sets of anchor boxes are set, corresponding to small defects, medium defects, and large defects, respectively; finally, the YOLOv8 detection head generates the coordinates and size information of the defect candidate regions and outputs the preliminary detection confidence of each candidate region, reflecting the probability that the region is a defect. To address potential false defects in the candidate defect regions generated by YOLOv8, such as those caused by reflections, dust, or image noise, a binary classification structure is designed for differentiation. The fused feature tensor corresponding to the candidate region is input into the binary classification network, which consists of two fully connected layers and one sigmoid activation function. The output dimensions of the fully connected layers are 256 and 1, respectively. The sigmoid activation function outputs the probability that the candidate region is a real defect, ranging from 0 to 1. A probability threshold of 0.5 is set; when the probability is ≥0.5, it is determined to be a real defect, otherwise it is a false defect. Finally, the specific location of the defect is output as its coordinates in the rectangular unfolded image, which can be mapped back to the actual location of the outer shell's annular region. The defect type is determined based on feature matching, such as cracks, dents, scratches, etc., and the initial confidence level is checked to complete defect identification.

[0037] A pre-labeled dataset of micro motor housing defects, including multispectral images of normal housings and housings with various defects, was used to train the constructed multi-task defect detection model.

[0038] Step 105: Calculate the overall confidence score of each defect based on the identification results. When the overall confidence score is greater than the preset judgment threshold, it is determined that there is a structural defect at the corresponding location, and a defect detection report is output.

[0039] Specifically, in this embodiment, the comprehensive confidence score of each defect is calculated based on the defect identification results. The comprehensive confidence score includes the preliminary detection confidence score generated by YOLOv8, the true defect probability output by the binary classification network, and the multispectral feature matching degree. The calculation formula is: comprehensive confidence score = 0.6 × preliminary detection confidence score + 0.3 × true defect probability + 0.1 × feature matching degree. The comprehensive confidence score ranges from 0 to 1.

[0040] Based on the defect identification results, the overall confidence score for each defect is calculated. The overall confidence score consists of three parts: the initial detection confidence score generated by YOLOv8 (weight 0.6), the true defect probability output by the binary classification network (weight 0.3), and the multispectral feature matching degree (weight 0.1), which is the degree of matching between the defect features and the standard defect feature library. The calculation formula is: Overall Confidence Score = 0.6 × Initial Detection Confidence Score + 0.3 × True Defect Probability + 0.1 × Feature Matching Degree. The overall confidence score ranges from 0 to 1. Based on the validation set results of the model training, a preset defect judgment threshold is set, usually 0.7, which can be adjusted according to actual detection needs. The comprehensive confidence score of each defect is compared with the preset threshold. When the comprehensive confidence score is >0.7, a structural defect is judged to exist at the corresponding location. When the comprehensive confidence score is between 0.6 and 0.7, it is marked as a suspicious defect and requires manual review. When the comprehensive confidence score is ≤0.6, it is judged as no defect. For casings identified as having structural defects, a defect inspection report is automatically generated. The report includes the following: basic information about the casing of the micro motor to be inspected, including model, batch, inspection time, defect details, defect location, defect type, overall confidence level, defect size, defect image, multispectral image, rectangular unfolded diagram, and annular original diagram with the defect location marked, and the inspection result judgment: qualified / unqualified. Unqualified casings must be marked with the defect level. The report supports export in PDF format and the inspection data is simultaneously stored in the database for subsequent traceability and statistical analysis. Suspicious defects are highlighted in the report to remind manual review.

[0041] Its beneficial effects lie in the fact that by combining multispectral image acquisition with a cross-modal attention fusion mechanism, it simultaneously captures explicit and implicit defect features. Combined with a detection model built using an improved ResNet and YOLOv8, the detection accuracy is ≥98%, with both false negative and false positive rates ≤1%, accurately identifying minute defects as small as 0.1mm. It boasts high detection efficiency, with fully automated operation; the inspection time for a single casing is ≤5s, requiring no manual intervention, significantly improving the efficiency of large-scale production inspection and reducing labor costs. It is highly versatile; by adjusting the fixture, Hough circle detection parameters, and model anchor frame size, it can adapt to micro-motor casings of different models and sizes from 5-20mm, without the need for separately developed inspection solutions. Fourthly, it is highly practical, setting up a false defect differentiation mechanism and a comprehensive confidence level judgment standard to reduce misjudgments; it automatically generates traceable PDF inspection reports, synchronously storing data for easy production quality traceability and statistical analysis, improving the efficiency and accuracy of inspection.

[0042] Please see Figure 2 In the image recognition-based method for detecting structural defects in the casing of miniature motors, a multi-task defect detection model based on a deep convolutional neural network is constructed. An improved ResNet neural network is used to extract multi-scale shared feature maps. A YOLOv8 detection network is used to generate defect candidate regions on the shared feature maps. A binary classification structure is employed to distinguish between real structural defects and pseudo-defects in the defect candidate regions. The output of the recognition result includes the following steps: Step 201: Add SE attention mechanism to the 3rd, 4th and 5th convolutional layers of the original ResNet-50 neural network to enhance attention to defect features and suppress background redundant features; at the same time, adjust the size of the convolution kernels and replace some 3×3 convolution kernels with a combination of 1×3 and 3×1 convolution kernels to obtain the improved ResNet-50 neural network. Step 202: Extract the shared feature map of the fused feature tensor through multi-scale pooling operation of the improved ResNet-50 neural network; Step 203: Based on the improved YOLOv8 detection network, feature fusion is performed on the multi-scale shared feature map to fuse high-level features with low-level features; Step 204: Adjust the anchor frame size of YOLOv8 according to the size range of the micro motor housing defect; finally, generate a defect candidate region through the YOLOv8 detection head, which includes at least the defect coordinates and size information.

[0043] The above describes embodiments of the image recognition-based method for detecting structural defects in the housing of miniature motors according to the present invention. Please refer to [link / reference]. Figure 3 In the image recognition-based micro-motor housing structural defect detection system, the system includes the following modules: The multidimensional image acquisition module is used to fix the housing of the micro motor to be tested onto a rotating stage that rotates at a constant speed around its axis, and to acquire visible light, near-infrared and ultraviolet images using an image acquisition device to obtain multidimensional image data. The image extraction and unfolding module is used to preprocess the multidimensional image data, use Hough circle detection to locate the annular region of the shell, extract the annular region of interest, and unfold the annular region of interest by transforming it from polar coordinates to rectangular coordinates to obtain a rectangular unfolded image. The feature tensor fusion module is used to extract multispectral image features from the rectangular unfolded graph. It uses a cross-modal attention fusion mechanism to fuse the multispectral image features to obtain a fused feature tensor. The detection model building module is used to construct a multi-task defect detection model based on a deep convolutional neural network. It uses an improved ResNet neural network to extract multi-scale shared feature maps, generates defect candidate regions on the shared feature maps based on the YOLOv8 detection network, and uses a binary classification structure to distinguish between real structural defects and pseudo defects in the defect candidate regions, and outputs the recognition results. The structural defect detection module is used to calculate the overall confidence score of each defect based on the identification results. When the overall confidence score is greater than the preset judgment threshold, it is determined that there is a structural defect at the corresponding location and a defect detection report is output.

[0044] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended technical solutions and equivalents.

Claims

1. A method for detecting structural defects in the housing of a miniature motor based on image recognition, characterized in that, The method for detecting defects in the housing structure of the miniature motor includes the following steps: The housing of the micro motor to be tested is fixed on a rotating stage that rotates at a constant speed around its axis. Visible light band images, near-infrared band images and ultraviolet band images are acquired using an image acquisition device to obtain multidimensional image data. After preprocessing the multidimensional image data, the Hough circle detection is used to locate the annular region of the shell, extract the annular region of interest, and expand the annular region of interest by transforming it from polar coordinates to rectangular coordinates to obtain a rectangular unfolded image. Multispectral image features of the rectangular unfolded graph are extracted, and a cross-modal attention fusion mechanism is used to fuse the multispectral image features to obtain a fused feature tensor. A multi-task defect detection model based on deep convolutional neural networks is constructed. An improved ResNet neural network is used to extract multi-scale shared feature maps. Based on the YOLOv8 detection network, defect candidate regions are generated on the shared feature maps. A binary classification structure is used to distinguish between real structural defects and pseudo defects in the defect candidate regions, and the recognition results are output. The overall confidence score of each defect is calculated based on the identification results. When the overall confidence score is greater than the preset judgment threshold, it is determined that there is a structural defect at the corresponding location, and a defect detection report is output.

2. The method for detecting defects in the casing structure of a miniature motor based on image recognition as described in claim 1, characterized in that, After preprocessing the multidimensional image data, the Hough circle detection is used to locate the annular region of the shell, extracting the annular region of interest. The annular region of interest is then expanded by transforming from polar coordinates to rectangular coordinates to obtain a rectangular unfolded image, including: The acquired multidimensional image data is denoised using an adaptive Gaussian filtering algorithm. The SIFT scale-invariant feature transform algorithm is used to extract feature points of each band image. The multi-band images are aligned by feature point matching to obtain aligned multi-band images. The aligned multi-band image is converted into a grayscale image, and the grayscale values ​​are mapped to the [0,255] interval using a linear normalization method to eliminate grayscale differences between different bands and under different acquisition conditions, thus obtaining standard multidimensional image data.

3. The method for detecting defects in the casing structure of a miniature motor based on image recognition as described in claim 1, characterized in that, After preprocessing the multidimensional image data, the Hough circle detection is used to locate the annular region of the shell, extracting the annular region of interest. The annular region of interest is then expanded by transforming from polar coordinates to rectangular coordinates to obtain a rectangular unfolded image, including: The Hough circle detection algorithm is used to perform edge detection on the preprocessed grayscale image to extract the outer shell edge contour. The radius range of the circle is set by Hough circle transformation, and the circular area that conforms to the outer shell contour is filtered out to obtain the center coordinates and radius parameters of the outer shell annular area. Based on the annular region parameters obtained by Hough circle detection, an annular region of interest is extracted. The extracted annular region of interest is then expanded by transforming polar coordinates to rectangular coordinates to obtain a rectangular unfolded image.

4. The method for detecting defects in the casing structure of a miniature motor based on image recognition as described in claim 1, characterized in that, The multispectral image features of the extracted rectangular unfolded image are fused using a cross-modal attention fusion mechanism to obtain a fused feature tensor, including: Image features of each band are extracted from the rectangular unfolded image. The visible light band extracts the texture features and gray-scale difference features of the shell surface, the near-infrared band extracts the latent defect features inside the shell, and the ultraviolet band extracts the micro-cracks and oil residue features on the shell surface. A cross-modal attention fusion mechanism is used to standardize the features extracted from each band to eliminate feature scale differences. The weights of the features in each band are calculated through the attention mechanism, and the weighted features of each band are spliced ​​and fused to obtain the fused feature tensor.

5. The method for detecting defects in the casing structure of a miniature motor based on image recognition as described in claim 1, characterized in that, The multi-task defect detection model based on a deep convolutional neural network is constructed. An improved ResNet neural network is used to extract multi-scale shared feature maps. A YOLOv8 detection network is used to generate defect candidate regions on the shared feature maps. A binary classification structure is employed to distinguish between real structural defects and pseudo-defects in the defect candidate regions. The output is the recognition result, including: The SE attention mechanism is added to the 3rd, 4th and 5th convolutional layers of the original ResNet-50 neural network to enhance attention to defect features and suppress background redundancy features; at the same time, the size of the convolutional kernel is adjusted, and some 3×3 convolutional kernels are replaced with a combination of 1×3 and 3×1 convolutional kernels to obtain the improved ResNet-50 neural network. Shared feature maps of fused feature tensors are extracted using multi-scale pooling operations on an improved ResNet-50 neural network. Based on the improved YOLOv8 detection network, feature fusion is performed on multi-scale shared feature maps, fusing high-level features with low-level features; The anchor frame size of YOLOv8 is adjusted according to the size range of the defects in the micro motor housing; finally, the defect candidate region is generated by the YOLOv8 detection head, which includes at least the defect coordinates and size information.

6. The method for detecting defects in the casing structure of a miniature motor based on image recognition as described in claim 1, characterized in that, The multi-task defect detection model based on a deep convolutional neural network is constructed. An improved ResNet neural network is used to extract multi-scale shared feature maps. A YOLOv8 detection network is used to generate defect candidate regions on the shared feature maps. A binary classification structure is employed to distinguish between real structural defects and pseudo-defects in the defect candidate regions. The output is the recognition result, including: The fused feature tensor of the defect candidate region is input into a binary classification network, and the probability that the candidate region is a real defect is output through the sigmoid activation function. Set the probability threshold to 0.

5. When the probability is ≥0.5, it is judged as a real defect; otherwise, it is a false defect. Output the specific location of the defect, the defect type, and the preliminary detection confidence level.

7. The method for detecting defects in the casing structure of a miniature motor based on image recognition as described in claim 1, characterized in that, The process involves calculating the overall confidence score for each defect based on the identification results. When the overall confidence score exceeds a preset threshold, a structural defect is determined to exist at the corresponding location, and a defect detection report is output, including: The overall confidence score for each defect is calculated based on the defect identification results. The overall confidence score includes the preliminary detection confidence score generated by YOLOv8, the true defect probability output by the binary classification network, and the multispectral feature matching degree. The calculation formula is: Overall confidence score = 0.6 × Preliminary detection confidence score + 0.3 × True defect probability + 0.1 × Feature matching degree. The overall confidence score range is 0-1.

8. A micro-motor housing structure defect detection system based on image recognition, characterized in that, The micro motor housing structure defect detection system includes the following modules: The multidimensional image acquisition module is used to fix the housing of the micro motor to be tested onto a rotating stage that rotates at a constant speed around its axis, and to acquire visible light, near-infrared and ultraviolet images using an image acquisition device to obtain multidimensional image data. The image extraction and unfolding module is used to preprocess the multidimensional image data, use Hough circle detection to locate the annular region of the shell, extract the annular region of interest, and perform polar coordinate to rectangular coordinate transformation to unfold the annular region of interest to obtain a rectangular unfolded image. The feature tensor fusion module is used to extract multispectral image features from the rectangular unfolded graph. It uses a cross-modal attention fusion mechanism to fuse the multispectral image features to obtain a fused feature tensor. The detection model building module is used to construct a multi-task defect detection model based on a deep convolutional neural network. It uses an improved ResNet neural network to extract multi-scale shared feature maps, generates defect candidate regions on the shared feature maps based on the YOLOv8 detection network, and uses a binary classification structure to distinguish between real structural defects and pseudo defects in the defect candidate regions, and outputs the recognition results. The structural defect detection module is used to calculate the overall confidence score of each defect based on the identification results. When the overall confidence score is greater than the preset judgment threshold, it is determined that there is a structural defect at the corresponding location and a defect detection report is output.

9. The image recognition-based micro-motor housing structure defect detection system as described in claim 8, characterized in that, The detection model establishment module includes the following sub-modules: The input submodule is used to input the fused feature tensor of the defect candidate region into the binary classification network, and output the probability that the candidate region is a real defect through the sigmoid activation function; The judgment submodule is used to set the probability threshold to 0.

5. When the probability is ≥0.5, it is judged as a real defect; otherwise, it is a false defect. The module outputs the specific location of the defect, the defect type, and the preliminary detection confidence level.

10. The image recognition-based micro-motor housing structure defect detection system as described in claim 8, characterized in that, The structural defect detection module includes the following sub-modules: The confidence submodule is used to calculate the overall confidence of each defect based on the defect identification results. The overall confidence includes the preliminary detection confidence generated by YOLOv8, the true defect probability output by the binary classification network, and the multispectral feature matching degree. The calculation submodule is used to calculate the following formula: Overall confidence score = 0.6 × Preliminary detection confidence score + 0.3 × True defect probability + 0.1 × Feature matching degree. The overall confidence score ranges from 0 to 1.