A motor assembly defect detection system based on image recognition

By using an image recognition-based motor assembly defect detection system, which utilizes the HSV color space and multi-scale pyramid technology, the system accurately segments and repairs highlight areas to generate an intrinsic reflectivity map. This solves the problem of defect detection caused by highlight reflection interference and achieves efficient potting defect identification.

CN121120629BActive Publication Date: 2026-03-13AOYINSHEN INTELLIGENT EQUIP (SUZHOU) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

During motor manufacturing, the high-gloss reflection of the potting compound surface makes it difficult to accurately identify defects. Existing technologies are unable to effectively separate low-contrast defects, leading to missed or false detections.

Method used

An image recognition-based motor assembly defect detection system is adopted. Through a highlight region segmentation module, a multi-scale highlight repair module, and a reflectance decomposition module, the system utilizes the HSV color space and multi-scale pyramid technology to accurately segment highlight regions and perform layered repair, eliminate illumination interference, and generate an intrinsic reflectance map for defect detection.

Benefits of technology

It improves the accuracy and robustness of defect detection, enabling the identification of various potting defects under highly reflective conditions, thus ensuring the quality control of motor assembly products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121120629B_ABST
    Figure CN121120629B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of image processing technology, specifically relating to a motor assembly defect detection system based on image recognition. The system includes: a highlight region segmentation module, a multi-scale highlight restoration module, a reflectivity decomposition module, and a defect detection module. The system acquires a stator magnet encapsulation image and segments the highlight region to obtain a highlight mask. A multi-scale pyramid is constructed based on the luminance and saturation components of the stator magnet encapsulation image. A hybrid weight map is generated based on the highlight intensity and detail saliency at each scale. The luminance component is layer-wise restored using the multi-scale pyramid, the hybrid weight map, and the highlight mask to obtain a synthetic base image. Guided filtering and reflectivity decomposition are performed on the synthetic base image to obtain an intrinsic reflectivity map. Encapsulation defect detection is performed based on the intrinsic reflectivity map. This invention eliminates the interference of highlight reflection on encapsulation defect detection, improving the accuracy and robustness of encapsulation defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to a motor assembly defect detection system based on image recognition. Background Technology

[0002] In motor manufacturing, the potting quality of the stator magnets directly affects the motor's performance and long-term reliability. The potting compound should form a smooth, flawless surface after curing. However, in actual production, due to factors such as process control and material properties, minor defects such as bubbles, cracks, and scratches often occur on the potting compound surface. If these defects are not effectively detected, they may pose a potential threat to the motor's insulation performance, heat dissipation efficiency, and structural stability.

[0003] With the improvement of industrial automation, machine vision-based defect detection technology has become an important means of defect detection in motor assembly due to its advantages of non-contact and high efficiency. However, the surface of potting compound usually has a certain gloss, which is very easy to produce high light reflection under the lighting conditions of industrial production environment. Highlights appear as areas of extremely high brightness in the image. Their brightness, edge sharpness and other visual characteristics are similar to the characteristics of real surface defects. They may even completely cover up the tiny defects located inside or at the edge of the high-light area, making it difficult for detection algorithms to distinguish them.

[0004] Traditional image processing algorithms, such as global or local thresholding, struggle to effectively separate low-contrast defects in bright backgrounds. Some methods attempt to suppress highlights by adjusting the light source layout or using hardware techniques such as polarization imaging, but this not only increases the complexity and hardware cost of the system but also makes it difficult to fully adapt to different batches of products and lighting changes at different detection angles, thus limiting its versatility.

[0005] Therefore, there is an urgent need for a motor assembly defect detection system based on image recognition to eliminate the interference of highlights on defects during stator magnet potting defect detection and to accurately identify potting defects in the motor assembly process. Summary of the Invention

[0006] To address the technical problem of missed or false detections of potting defects during motor assembly due to high light reflection interference, thus affecting detection accuracy, this invention provides a motor assembly defect detection system based on image recognition. The system includes the following modules:

[0007] The module includes a specular highlight segmentation module, which acquires stator magnet potting images and converts them to the HSV color space to obtain luminance and saturation components; it then segments the specular highlight region based on the luminance and saturation components to obtain a specular highlight mask; a multi-scale specular highlight repair module, which constructs a multi-scale pyramid based on the luminance and saturation components and generates a hybrid weight map based on the specular intensity and detail saliency at each scale; and it performs layered repair on the luminance components based on the multi-scale pyramid, the hybrid weight map, and the specular highlight mask to obtain a composite base image; a reflectance decomposition module, which performs guided filtering and reflectance decomposition on the filtered image of the luminance components based on the composite base image to obtain an intrinsic reflectance map; and a defect detection module, which detects potting defects based on the intrinsic reflectance map.

[0008] This invention accurately identifies highlight regions caused by specular reflection from the potting compound surface in stator magnet potting images through a highlight region segmentation module. It utilizes the unique high brightness and low saturation characteristics of highlight regions in the HSV color space for precise segmentation, avoiding the problem of traditional methods misjudging highlight edges as defects. The multi-scale highlight restoration module in this invention constructs a multi-scale pyramid, analyzes highlight intensity and detail saliency at each scale to generate an adaptive hybrid weight map, and achieves layered guided restoration from coarse to fine. This suppresses highlight interference while preserving the detailed features of minor potting defects, solving the problem of defect information loss caused by traditional hard-switching restoration. The challenge lies in the reflectivity decomposition module, which uses the repaired synthetic substrate image as a guide map for precise guided filtering and reflectivity decomposition. This effectively separates the illumination component from the surface reflectivity of the object, eliminating interference from uneven illumination and high-reflectivity, resulting in a more uniform background on the normal potting compound surface, creating a clear contrast with defective areas. The defect detection module performs potting defect detection on the inherent reflectivity map, improving the accuracy and robustness of detection. It can simultaneously identify multiple types of potting defects, including bubbles, cracks, and missing glue, and maintains a high detection rate even under high-reflectivity conditions, providing a reliable guarantee for the quality control of motor assembly products.

[0009] Preferably, the step of segmenting the highlight region according to the luminance component and saturation component to obtain the highlight mask includes: for Any pixel in the image is marked as a highlight if and only if its brightness value is greater than a preset brightness threshold and its saturation value is less than a preset saturation threshold; otherwise, it is marked as a non-highlight pixel. All highlight pixels are marked as 1, and non-highlight pixels are marked as 0 to obtain a highlight mask.

[0010] Preferably, the construction of a multi-scale pyramid based on the luminance component and the saturation component includes: constructing a Gaussian pyramid and a Laplacian pyramid for the luminance component to obtain luminance smoothed images at different levels, luminance detail layer images at different levels, and a residual layer image; and constructing a Gaussian pyramid for the saturation component to obtain saturation smoothed images at different levels.

[0011] This invention decomposes the luminance and saturation components into a multi-scale pyramid at different frequency levels, enabling differentiated processing of information at different scales. This transforms the complex spatial domain restoration problem into a more manageable multi-scale domain problem, laying the foundation for accurately removing highlights while preserving minute defect features.

[0012] Preferably, the high light intensity satisfies the expression: In the formula, For the first Layer pixels High light intensity; For the first The brightness of the layer smooths the image at the pixel level. Brightness at that location; For the first Saturation smoothing of the layer image at pixel points Saturation at that point; For the first Pixels in a layer of brightness smoothing image The brightness threshold of the sub-block; This is the saturation threshold. It is a minimum value function; It is a function for maximizing the value.

[0013] Preferably, the saliency of the details satisfies the expression: In the formula, For the first The brightness detail layer image of the layer at the pixel level The salience of details; For the first The brightness detail layer image of the layer at the pixel level Detail layer coefficients at the location; It is a natural exponential function.

[0014] Preferably, the hybrid weight graph satisfies the expression: In the formula, For the first Layer pixels Mixed weights; For the first The brightness detail layer image of the layer at the pixel level The salience of details; For the first Layer pixels High light intensity.

[0015] This invention calculates the highlight intensity and detail saliency of pixels at various scales and generates a hybrid weight map accordingly, thereby achieving dynamic adaptive adjustment of the repair intensity. Compared with the traditional hard-switching repair method, it can smoothly transition between repairing strong highlight areas and preserving the original details of weak highlight areas, avoiding the loss of weak defect information in highlight areas due to over-repair.

[0016] Preferably, the step of performing layered inpainting of the luminance component based on the multi-scale pyramid, the mixed weight map, and the specular mask to obtain a synthetic base image includes: applying an image inpainting algorithm based on fast marching to the residual layer image of the Laplacian pyramid using the specular mask to obtain the repaired top layer image; and iteratively performing the operation from top to bottom, starting from the second-to-last layer of the Laplacian pyramid, to generate the repaired image of each layer. In the formula, For the first Image after layer repair; It is the first Layer hybrid weight graph; This represents an upsampling and smoothing operation; It is the first Image after layer repair; It is the first The brightness detail layer image of the layer.

[0017] This invention employs a top-down, layered guided restoration strategy, which ensures the consistency and naturalness of the restored image at different scales. The resulting synthetic base image can smoothly fill in the highlight areas without introducing new visual artifacts.

[0018] Preferably, the step of performing guided filtering on the filtered image of the luminance component based on the synthetic base image includes: performing mean filtering on the luminance component to obtain an initial illumination map; using the initial illumination map as the input image and the synthetic base image as the guide image, applying the guided filtering algorithm to the input image to obtain an illumination component map.

[0019] Preferably, the reflectance decomposition includes: obtaining an intrinsic reflectance map by performing pixel-by-pixel division operations on the luminance component and illumination component maps.

[0020] The inherent reflectance map obtained by this invention can truly reflect the material properties of the object surface and effectively eliminate the influence of uneven lighting and high light reflection. In the inherent reflectance map, the normal potting compound surface presents a relatively uniform background, while potting defects show a more significant gray-scale change, thereby enhancing the contrast of defect features and providing ideal input for subsequent potting defect detection.

[0021] Preferably, the step of detecting potting defects based on the intrinsic reflectance map includes: inputting the intrinsic reflectance map into a trained neural network and outputting the potting defect region and defect category.

[0022] The beneficial effects of this invention are as follows: This invention accurately identifies the highlight areas caused by specular reflection from the surface of the potting compound in the stator magnet potting image through a highlight area segmentation module. It utilizes the unique high brightness and low saturation characteristics of highlight areas in the HSV color space for precise segmentation, avoiding the problem of traditional methods misjudging highlight edges as defects. Furthermore, the multi-scale highlight repair module in this invention constructs a multi-scale pyramid, analyzes the highlight intensity and detail saliency at each scale to generate an adaptive hybrid weight map, and achieves layered guided repair from coarse to fine. This suppresses highlight interference while preserving the detailed features of minor potting defects, solving the problem of defects caused by traditional hard-switching repair. The module addresses the challenge of information loss by using the repaired synthetic substrate image as a guide map for precise guided filtering and reflectivity decomposition. This effectively separates the illumination component from the surface reflectivity, eliminating interference from uneven illumination and high-reflectivity, resulting in a more uniform background on the normal potting compound surface, creating a clear contrast with defective areas. The defect detection module performs potting defect detection on the inherent reflectivity map, improving detection accuracy and robustness. It can simultaneously identify multiple types of potting defects, including bubbles, cracks, and missing glue, maintaining a high detection rate even under high-reflectivity conditions, providing reliable assurance for the quality control of motor assembly products. Attached Figure Description

[0023] Figure 1 This is a schematic diagram illustrating a system block diagram of a motor assembly defect detection system based on image recognition according to the present invention;

[0024] Figure 2 This is an RGB image schematically showing the stator magnet encapsulation.

[0025] Figure 3 This is a schematic representation of the specular mask;

[0026] Figure 4 This is a schematic diagram illustrating the system block diagram of the multi-scale highlight restoration module;

[0027] Figure 5 This is a schematic illustration of the synthetic substrate image;

[0028] Figure 6 This is a schematic diagram illustrating the inherent reflectivity of the present invention;

[0029] Figure 7 This is a schematic diagram illustrating the intrinsic reflectance obtained using existing methods;

[0030] Figure 8 This is a schematic diagram illustrating the results of potting defect detection. Detailed Implementation

[0031] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0032] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0033] This invention provides a motor assembly defect detection system based on image recognition. For example... Figure 1 As shown, a motor assembly defect detection system based on image recognition includes a highlight region segmentation module 100, a multi-scale highlight repair module 200, a reflectivity decomposition module 300, and a defect detection module 400, which are described in detail below.

[0034] The highlight region segmentation module 100 is used to acquire the stator magnet potting image and convert the stator magnet potting image to the HSV color space to obtain the luminance component and saturation component. The highlight region is segmented according to the luminance component and saturation component to obtain the highlight mask.

[0035] It should be noted that during the motor assembly process, the highlights on the surface of the stator magnet after potting are mainly caused by the specular reflection of the potting compound, which has a large brightness. However, the brightness of the defects on the surface of the potting compound is lower than that of the highlights. Therefore, in order to identify the highlight areas, this invention obtains the highlight area image based on the physical characteristics of the color space.

[0036] Specifically, images are acquired by using an industrial camera perpendicular to the surface of the stator magnet potting product to obtain the original... Images, exemplarily, Figure 2 RGB image of the stator magnet potting.

[0037] Furthermore, the original Image conversion to Color space, obtaining hue components saturation component and brightness component .

[0038] It should be noted that, Color spaces better align with how humans perceive color, where the luminance component is separated from the chromatic information. Highlight reflections typically exhibit extremely high luminance values ​​and extremely low saturation values, thus allowing for more robust differentiation of highlight areas from other areas within this color space.

[0039] Furthermore, based on the luminance component and saturation component The highlight region is segmented using a local adaptive double thresholding method to obtain the highlight mask. Specifically:

[0040] for Any pixel in the image is considered a brightness point if and only if its brightness value is greater than a preset brightness threshold. And its saturation value is less than the preset saturation threshold. When a pixel is highlighted, it is marked as a highlight; otherwise, it is marked as a non-highlight pixel. All highlight pixels are marked as 1, and non-highlight pixels are marked as 0, thus obtaining a highlight mask. For example, Figure 3 For highlight mask.

[0041] Among them, the brightness threshold and saturation threshold The setup method is as follows: In In a color space, the luminance component ranges from 0 to 255, and the saturation component ranges from 0 to 1. Image segmentation In this embodiment, for several non-overlapping blocks of varying sizes, the brightness value corresponding to the cumulative distribution of the brightness histogram reaching 95% is calculated independently for each block, and this value is used as the brightness threshold for that block. The present invention obtains the brightness threshold for each block separately to avoid the sensitivity of the global threshold to local illumination fluctuations; the saturation threshold is used to filter out approximately colorless pixels in the bright areas. In this embodiment, In other embodiments, the implementer may adjust the brightness threshold according to the actual lighting conditions and the color of the colloid. Cumulative distribution percentage and saturation threshold The specific values. Among them, In this embodiment, the preset block size is used. In other embodiments, implementers may set the appropriate parameters according to the actual implementation situation. .

[0042] The multi-scale specular restoration module 200 is used to construct a multi-scale pyramid based on the luminance and saturation components, and generate a hybrid weight map based on the specular intensity and detail saliency at each scale. Based on the multi-scale pyramid, the hybrid weight map, and the specular mask, the luminance component is repaired in layers to obtain a synthetic base image.

[0043] like Figure 4 As shown, the multi-scale highlight restoration module 200 includes a multi-scale pyramid construction unit 201, a hybrid weight map generation unit 202, and a layered restoration unit 203, which are described in detail below:

[0044] Multi-scale pyramid building unit 201 is used to construct a multi-scale pyramid based on the luminance component and the saturation component.

[0045] It should be noted that during motor assembly, the highlight areas and defect areas on the surface of the stator magnet potting compound have different frequency characteristics. Highlight areas typically exhibit sharp edges at mid-to-high frequencies, while minute defects on the potting compound surface may exist in details at higher frequencies. If processed only at a single scale, it is difficult to simultaneously and effectively remove highlight interference and preserve the features of minute defects. Therefore, this invention transforms the spatial domain repair problem into a multi-scale domain, performing differentiated processing on information at different scales to remove highlight interference while preserving the detailed information of defects on the potting compound surface to the maximum extent.

[0046] Specifically, for the luminance component of an HSV image Construct a Laplacian pyramid to obtain a series of luminance detail layer images representing details at different scales and a luminance residual layer image representing the macroscopic structure, including: for the luminance components Construct a Gaussian pyramid to divide the brightness components The image corresponding to each level of the Gaussian pyramid is used as a brightness smoothing image, and the brightness component is calculated. The Laplacian pyramid is obtained by taking the difference between the brightness-smoothed image of each layer of the Gaussian pyramid and the upsampled and smoothed image of the next layer.

[0047] For the luminance component For each layer of the Gaussian pyramid's brightness smoothing image, the brightness threshold of each sub-block in each brightness smoothing image is obtained using the same method as the brightness threshold acquisition in the highlight region segmentation module.

[0048] Furthermore, the saturation component of the HSV image Construct a Gaussian pyramid to divide the saturation components Each layer of the Gaussian pyramid corresponds to an image that is saturated and smoothed.

[0049] It should be noted that the luminance component Gauss Pyramid Brightness smoothing image corresponding to the layer It is by using the original luminance component conduct The size is obtained by sub-Gaussian blurring and downsampling, and is the same as the original size. ; Luminance component The Pyramid of Laplace The corresponding brightness detail layer image of the layer It is by using the luminance component Gauss Pyramid Brightness smoothing image corresponding to the layer Subtract the first The image obtained after upsampling and smoothing the layer has the same size as the original image. ; Saturation component Gauss Pyramid Saturation smoothing image corresponding to the layer It is by using the original saturation component conduct The size is obtained by sub-Gaussian blurring and downsampling, and is the same as the original size. Therefore, the brightness component Gauss Pyramid Brightness smoothing image corresponding to the layer Luminance component The Pyramid of Laplace The corresponding brightness detail layer image of the layer and saturation component Gauss Pyramid Saturation smoothing image corresponding to the layer They have the same spatial resolution. This correspondence ensures that the highlight regions at each scale can be accurately identified and processed, avoiding potential positioning errors during cross-scale processing, and providing accurate multi-scale highlight region information for the subsequent construction of a highlight intensity-guided hybrid weight map.

[0050] The hybrid weight map generation unit 202 is used to generate a hybrid weight map based on the highlight intensity and detail saliency at each scale.

[0051] It should be noted that the highlight areas on the stator magnet potting compound surface can severely interfere with the detection of surface defects. Highlight areas typically have extremely high brightness and extremely low saturation values, with sharp edges that are visually difficult to distinguish from actual defect edges. Completely removing these highlight areas will also eliminate subtle surface defects (such as microcracks and microbubbles) located within or at the edges of these highlight areas, leading to missed detections. Traditional repair methods use a hard-switching approach, completely replacing the highlight areas with smooth areas. While this method effectively removes highlights, it loses information about subtle surface defects located at the edges or within the highlight areas. In motor assembly scenarios, because surface defects are often small and have low contrast, this hard-switching method significantly increases the missed detection rate.

[0052] It should be further explained that the intensity of the highlight reflects the confidence that a pixel belongs to the highlight. Therefore, this invention introduces a highlight intensity guidance mechanism, which dynamically adjusts the repair intensity according to the highlight intensity of the pixel. When the highlight intensity is high, it tends to perform stronger repair on the highlight area to ensure that the highlight interference is effectively suppressed. When the highlight intensity is low, it tends to preserve the original details and avoid over-processing of potential defect areas, so as to achieve accurate identification and differentiated processing of highlight areas, solve the problem of loss of weak defect information caused by traditional hard switching methods, and improve the detection rate of surface defects of potting compound.

[0053] Specifically, the highlight intensity of this layer is calculated based on the brightness detail layer image and the saturation detail layer image of the same layer:

[0054]

[0055] In the formula, For the first Layer pixels High light intensity; For the first The brightness of the layer smooths the image at the pixel level. Brightness at that location; For the first Saturation smoothing of the layer image at pixel points Saturation at that point; For the first Pixels in a layer of brightness smoothing image The brightness threshold of the sub-block is used to eliminate the absolute dimension of brightness and adjust the brightness value under different lighting conditions to relative brightness, so that the calculation of specular intensity is not affected by local lighting fluctuations. The saturation threshold is used to eliminate the absolute dimension of saturation values, adjust the saturation values ​​to a comparable range, and ensure that the screening of highlight areas is not affected by the color characteristics of the potting compound itself. This is a minimum value function used to ensure... To avoid misjudgment caused by excessive highlight intensity; This is a maximum value function used to ensure... To avoid exceeding the saturation threshold This results in negative interference.

[0056] It should be noted that highlight intensity reflects the confidence level that a pixel belongs to the highlight area. When the brightness... Larger and more saturated The smaller the size, the higher the light intensity. The larger the brightness, the more pronounced the highlight features; conversely, the smaller the brightness, the more pronounced the highlight features. Smaller or less saturation When it is larger, the intensity of the high light is The smaller the size, the weaker the highlight features.

[0057] Furthermore, the detail saliency of each pixel in each brightness detail layer image is determined:

[0058]

[0059] In the formula, For the first The brightness detail layer image of the layer at the pixel level The salience of details; For the first The brightness detail layer image of the layer at the pixel level Detail layer coefficients at the location; It is a natural exponential function.

[0060] It should be noted that the absolute value of the detail layer coefficients... Reflects the intensity of detail. The larger the value, the stronger the edge or texture detail at that location. This invention utilizes... The form of By performing mapping, the detail intensity can be smoothly converted to a value between... The significance value of details between and 1; when When it is larger, The closer the value is to 1, the more significant the detail; when The smaller, The value approaches This indicates that details are not significant; the detail layer factor in highlight areas is usually small, while the detail layer factor in defect areas on the potting compound surface is large, therefore the detail layer factor in defect areas on the potting compound surface is significant. Higher, highlight areas Lower.

[0061] Furthermore, by combining the mask image of each layer, the highlight intensity of each pixel, and the detail saliency, the blending weights of each pixel are determined:

[0062]

[0063] In the formula, For the first Layer pixels Mixed weights; For the first The brightness detail layer image of the layer at the pixel level The salience of details; For the first Layer pixels The intensity of the highlight. It should be noted that the pixel blending weight reflects the level of confidence in the original detail; when the highlight intensity... When the intensity is high, the blending weight value is small, and during the highlight removal restoration process, it tends to completely replace the area; when the highlight intensity is high... When the blending weight is low, the blending weight is high, and during the highlight removal process, it tends to preserve the original details; when the detail is significant... A high blending weight indicates that the area may contain surface defects of the potting compound and texture details. In this case, a large blending weight tends to preserve the original details during the highlight removal process; when the detail salience is high... A low blending weight indicates that the area may be a highlight area. In this case, the blending weight is small, and the area is more likely to be replaced during the highlight removal process. This invention combines the detail saliency of pixels with highlight intensity to obtain the blending weight, thereby suppressing highlights while providing some opportunity to preserve details of potential potting compound surface defects.

[0064] Furthermore, the mixed weights of all pixels in each layer are used to construct the mixed weight map of that layer.

[0065] The layered repair unit 203 is used to perform layered repair on the luminance component based on the multi-scale pyramid, the mixed weight map, and the specular mask to obtain a synthetic base image.

[0066] Specifically, using a specular mask, an image inpainting algorithm based on the fast marching method is applied to the residual layer image of the Laplacian pyramid to obtain the repaired top layer image.

[0067] Furthermore, starting from the second-to-last level of the Laplacian pyramid, the operation is performed iteratively from top to bottom to generate the repaired image for each level:

[0068]

[0069] In the formula, For the first Image after layer repair; It is the first Layer hybrid weight graph; This represents an upsampling and smoothing operation; It is the first Image after layer repair; It is the first The brightness detail layer image of the layer.

[0070] It should be noted that when the blending weight is close to 1, the pixel is more likely to be in a non-highlight area. Mainly composed of The decision is to primarily retain the original details; when the mixed weights are close to... At that time, pixels are more likely to be in the highlight area. Mainly composed of The decision primarily utilizes repair information from higher layers; when the weights are mixed... When it is between 1 and 2, It is a weighted average of the two to achieve a smooth transition, suppressing highlights while preserving the details of surface defects in the potting compound.

[0071] Furthermore, the image of the lowest level of the Laplacian pyramid, repaired after multiple iterations, is used as the synthetic base image. For example, Figure 5 This is a synthetic base image.

[0072] The reflectance decomposition module 300 is used to perform guided filtering and reflectance decomposition on the filtered image of the luminance component based on the synthesized substrate image to obtain the intrinsic reflectance map.

[0073] It should be noted that during motor assembly, the high-brightness reflection from the potting compound surface can mask or distort the features of surface defects in the original image. Traditional guided filtering methods, due to the presence of high-brightness edges in the guide image, will also include these edges in the illumination component, resulting in ring artifacts in the intrinsic reflectance map, which severely interferes with subsequent defect identification. Therefore, this invention utilizes a synthetic substrate image with high-brightness reflection removed as the guide image for guided filtering, eliminating interference from uneven illumination and high-brightness reflection, resulting in a uniform grayscale background for the normal potting compound surface, enhancing the features of surface defects, and providing high-quality input for subsequent defect detection.

[0074] Specifically, for the luminance channel of an HSV image A mean filter is performed to obtain an initial illumination map. The radius of the mean filter is set to be significantly larger than the size of the expected maximum highlight region in the image to ensure that the output only contains extremely low-frequency illumination information. For example, if the diameter of the maximum highlight region in the image is approximately 50 pixels, the radius of the mean filter can be set to 60 pixels. In other embodiments, the implementer can adaptively adjust this radius based on the highlight size in the actual captured image. The maximum highlight region can be obtained by performing connected component analysis on the highlight mask.

[0075] Furthermore, the initial illumination map is used as the input image, and the synthesized base image is used as the guide image. The guide filtering algorithm is applied to the input image, and the output of the guide filtering is the final optimized illumination component map.

[0076] Furthermore, through the luminance channel of the HSV image A pixel-by-pixel division operation is performed with the illumination component map to obtain the final intrinsic reflectance map. For example, Figure 6 This is the intrinsic reflectance diagram.

[0077] It should be noted that the brightness of an image is the product of the surface reflectivity of the object and the intensity of the incident light; therefore, this invention uses a brightness channel. Dividing by the light component as the divisor can effectively eliminate the influence of brightness changes caused by uneven lighting and high light reflection. The resulting intrinsic reflectance map is the intrinsic reflectance that is only related to the material and micro-geometry of the object's surface. Its value should remain uniform on a normal potting compound surface, but will change abruptly at defects on the potting compound surface, thus achieving a significant enhancement of the defects on the potting compound surface.

[0078] It should be further explained that the existing method for removing highlights from an image is as follows: using the initial illumination map as the input image, and then processing the brightness channel of the HSV image... Directly used as a guide image, a guided filtering algorithm is applied to the input image to optimize the brightness channel of the HSV image. A pixel-by-pixel division operation is performed with the result of the guided filter output to obtain the intrinsic reflectivity map. For comparison, Figure 7 An intrinsic reflectance map obtained using existing methods is presented, showing that... Figure 7 The highlights in the mid-highlight areas were not completely removed, and some bright spots remain, making... Figure 7 The cracks and defects in the sample are not obvious. However, the sample obtained using the method of this invention... Figure 6 The highlight areas in the corresponding intrinsic reflectance map are removed, making the crack defects stand out in a high-contrast form.

[0079] The defect detection module 400 is used to detect potting defects based on the inherent reflectivity map.

[0080] Specifically, the intrinsic reflectivity map is input into the trained neural network, which outputs the potting defect area and defect category.

[0081] The specific details of the neural network are as follows: This embodiment uses a YOLOv5 network. The input is the intrinsic reflectivity map, and the output is the bounding box coordinates of the potting defects and the defect category. The neural network dataset consists of intrinsic reflectivity maps corresponding to stator magnet potting images containing different potting defects. In other embodiments, implementers may use other neural networks depending on the actual implementation situation.

[0082] For example, Figure 8 This is a schematic diagram of the results of the potting defect detection.

Claims

1. A motor assembly defect detection system based on image recognition, characterized in that, include: The highlight region segmentation module is used to acquire the stator magnet potting image and convert the stator magnet potting image to the HSV color space to obtain the luminance component and saturation component; The specular region is segmented based on the luminance and saturation components to obtain the specular mask; The multi-scale highlight restoration module is used to construct a multi-scale pyramid based on the luminance and saturation components, and generate a hybrid weighted map based on the highlight intensity and detail saliency at each scale. Based on the multi-scale pyramid, the mixed weight map, and the specular mask, the luminance component is layered for inpainting to obtain a synthetic base image. This includes: applying a fast-marginal-step image inpainting algorithm to the residual layer image of the Laplacian pyramid using the specular mask to obtain the inpainted top layer image; and iteratively performing the operation from top to bottom, starting from the second-to-last layer of the Laplacian pyramid, to generate the inpainted image for each layer. In the formula, For the first Image after layer repair; It is the first Layer hybrid weight graph; This represents an upsampling and smoothing operation; It is the first Image after layer repair; It is the first The brightness detail layer image of the layer; The reflectance decomposition module is used to perform guided filtering and reflectance decomposition on the filtered image of the luminance component based on the synthesized substrate image to obtain the intrinsic reflectance map. The defect detection module is used to detect potting defects based on the inherent reflectivity map.

2. The motor assembly defect detection system based on image recognition according to claim 1, characterized in that, The step of segmenting the highlight region according to the luminance component and saturation component to obtain the highlight mask includes: for Any pixel in the image is marked as a highlight if and only if its brightness value is greater than a preset brightness threshold and its saturation value is less than a preset saturation threshold; otherwise, it is marked as a non-highlight pixel. All highlight pixels are marked as 1, and non-highlight pixels are marked as 0 to obtain a highlight mask.

3. The motor assembly defect detection system based on image recognition according to claim 1, characterized in that, The construction of a multi-scale pyramid based on luminance and saturation components includes: Gaussian pyramids and Laplacian pyramids are constructed for the luminance components to obtain luminance smoothing images at different levels, luminance detail layer images at different levels, and a residual layer image. Gaussian pyramids are constructed for the saturation components to obtain saturation smoothing images at different levels.

4. The motor assembly defect detection system based on image recognition according to claim 3, characterized in that, The intensity of the high light satisfies the expression: ; In the formula, For the first Layer pixels High light intensity; For the first The brightness of the layer smooths the image at the pixel level. Brightness at that location; For the first Saturation smoothing of the layer image at pixel points Saturation at that point; For the first Pixels in a layer of brightness smoothing image The brightness threshold of the sub-block; This is the saturation threshold. It is a minimum value function; It is a function for maximizing the value.

5. The motor assembly defect detection system based on image recognition according to claim 3, characterized in that, The significance of the details satisfies the expression: ; In the formula, For the first The brightness detail layer image of the layer at the pixel level The salience of details; For the first The brightness detail layer image of the layer at the pixel level Detail layer coefficients at the location; It is a natural exponential function.

6. The motor assembly defect detection system based on image recognition according to claim 5, characterized in that, The hybrid weight graph satisfies the expression: ; In the formula, For the first Layer pixels Mixed weights; For the first The brightness detail layer image of the layer at the pixel level The salience of details; For the first Layer pixels High light intensity.

7. The motor assembly defect detection system based on image recognition according to claim 1, characterized in that, The guided filtering of the luminance component of the filtered image based on the synthesized base image includes: The luminance component is mean filtered to obtain the initial illumination map; Using the initial illumination map as the input image and the synthetic base image as the guide image, a guided filtering algorithm is applied to the input image to obtain the illumination component map.

8. The motor assembly defect detection system based on image recognition according to claim 7, characterized in that, The reflectivity decomposition includes: The intrinsic reflectivity map is obtained by performing pixel-by-pixel division operations on the luminance component and illumination component maps.

9. The motor assembly defect detection system based on image recognition according to claim 1, characterized in that, The method of detecting potting defects based on the inherent reflectivity map includes: The intrinsic reflectivity map is input into the trained neural network, which outputs the potting defect area and the defect category.

Citation Information

Patent Citations

  • Method and system for automatically detecting defects of semiconductor chip based on hyperspectral imaging

    CN119417838A

  • Endoscope image processing method and system for improving image quality

    CN120278934A