A posture normalization-based piezoresistive surface defect detection method
Patent Information
- Application Number
- CN202610915871.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-10-13
AI Technical Summary
[0003]目前,现有基于深度学习的目标检测或缺陷分类方法虽然能够获得较高的准确率,但其模型体积大、计算量大,难以在工业边缘端实时部署
本发明通过多个触手将不处于对应灰度区间的点云进行标记,得到多个标记点,通过在标记时,将各点云所对应的变化信息及灰度值进行一并绑定关联,即得到点云激活标记集合,从而触手能够将整张归一化图像转化为仅包含激活点云的轻量级集合,进而,能够便于归一化图像的轻量化传输。
Smart Images

Figure CN122905944A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of varistor defect detection technology, and specifically to a method for detecting surface defects in varistors based on attitude normalization. Background Technology
[0002] A varistor is a sensitive element with nonlinear current-voltage characteristics, playing a crucial "safety valve" role in a circuit system. During the manufacturing process of varistors, due to the influence of multiple processes such as material mixing, pressing, sintering, and electrode coating, its surface is highly susceptible to microscopic defects such as pits, impurities, scratches, pores, and edge chipping. These defects not only affect the product's appearance but also alter the local electric field distribution and thermal characteristics of the varistor, leading to localized breakdown, burn-out, or even explosion during surge impacts, seriously threatening the normal operation of the circuit. Therefore, efficient and accurate detection of surface defects in varistors is a critical step in ensuring their quality before shipment.
[0003] Currently, while existing deep learning-based object detection or defect classification methods can achieve high accuracy, their models are large and computationally intensive, making them difficult to deploy in real-time at industrial edge environments. Furthermore, transmitting all raw images of varistor resistors to the cloud for processing places significant demands on data transmission, making it inconvenient to perform lightweight transmission of the raw images for high-speed, low-latency online detection scenarios.
[0004] In view of this, the present invention proposes a surface defect detection method for varistor based on attitude normalization to solve the above problems. Summary of the Invention
[0005] The purpose of this invention is to provide a method for detecting surface defects of varistors based on attitude normalization, so as to solve the problems mentioned in the background art.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting surface defects of a varistor based on attitude normalization, comprising the following steps: Acquire images of varistors, extract the varistor region from the images, and perform attitude normalization processing on the extracted varistor region to obtain a normalized image. The normalized image is matched with a preset fixed point cloud template, wherein the fixed point cloud template is composed of multiple two-dimensional point clouds uniformly distributed on a standard attitude varistor. A set of point cloud activation markers is obtained by activating a fixed point cloud template based on a normalized image. The set of point cloud activation markers is transmitted to the pre-trained defect detection model. The defect detection model outputs the corresponding defect type. Point cloud activation marker sets with fewer than the preset number of activations are not transmitted, and the varistor image is determined to be defect-free.
[0007] In a preferred embodiment, the steps of acquiring a varistor image, extracting the varistor region from the image, and performing attitude normalization processing on the extracted varistor region to obtain a normalized image include: The image of the varistor is obtained by acquiring the image of the varistor using the acquisition terminal; The color space of the varistor image is converted, an appropriate channel is selected and the varistor body and the image background are separated by adaptive threshold or fixed threshold. Morphological operations are used to remove small noise to fill holes, connected components are extracted, and ROI regions are selected according to the geometric features of the varistor to obtain the varistor region. The contour edge of the varistor is monitored within the varistor region. The varistor region is detected using Huffman transform, and the principal axis direction of the varistor region is calculated to determine the rotation angle and scaling ratio of the varistor region. By applying affine transformation, the varistor region is adjusted to a preset standard orientation and scaled to a uniform size, and a normalized image is output.
[0008] In a preferred embodiment, the step of matching the normalized image with a preset fixed point cloud template, wherein the fixed point cloud template is composed of multiple two-dimensional point clouds uniformly distributed on a standard attitude varistor, includes: A preset fixed point cloud template is provided, wherein the fixed point cloud template is based on a normalized image. Based on the normalized image, the grayscale range and position of each point cloud in the fixed point cloud template are set, and the grayscale range and position are bound to the corresponding point cloud code. Each point cloud corresponds to a unique code. The normalized image is matched with a fixed point cloud template.
[0009] In a preferred embodiment, the step of setting the preset fixed point cloud template based on a normalized image includes: Based on the specifications of the normalized image, set the template specifications, and set multiple templates based on the template specifications; Point clouds with different density distributions are set for multiple templates. The multiple templates include low-level, mid-level and high-level layers, and the point cloud of each template corresponds to a different range. Multiple templates are matched vertically in a preset order to obtain a fixed point cloud template. The preset order includes templates with point cloud density distributed from low to high in the upper, middle and lower layers.
[0010] In a preferred embodiment, the step of matching the normalized image with a fixed point cloud template includes: For each point cloud in the fixed point cloud template, a corresponding grayscale range is preset, and each point cloud is bound to the grayscale range of the corresponding point cloud. Multiple matching tentacles are set up. Based on the matching tentacles, the normalized image is matched with a fixed point cloud template to obtain multiple marker points. Each matching tentacle includes multiple tentacles, and each tentacle includes multiple touch points. The multiple touch points are connected sequentially by touch lines. The touch lines are established based on the vertical correspondence between point clouds in the low, middle and high layers.
[0011] In a preferred embodiment, the step of matching the normalized image with the fixed point cloud template based on the matching tentacles includes: Multiple matching tentacles are evenly distributed in the middle layer of a fixed point cloud template. Each matching tentacle is vertically inserted through the lower, middle and upper layers of the template. The contact points on each tentacle correspond one-to-one with the point cloud to which it is attached. During the matching process, if the gray level of the corresponding pixel block in the normalized image is within the gray level range of the middle-layer template point cloud, no mark is added to the point cloud of the middle-layer template. If the gray level of the corresponding pixel block in the normalized image is not within the gray level range of the higher-layer template point cloud, a mark is added to the point cloud of the middle-layer template. If the gray level of the corresponding pixel block in the normalized image is not within the gray level range of the lower-layer template point cloud, a mark is added to the point cloud of the middle-layer template. If the gray level of the pixel block is simultaneously within the gray level ranges corresponding to the point clouds of multiple templates, no mark is added to the point cloud on the tentacle. The gray level of the corresponding pixel block and the upper or lower range of the gray level range of the corresponding point cloud are respectively assigned + or -. + or - are collectively referred to as the change information of the point cloud. The point cloud corresponding to the contact points on multiple tentacles is marked to obtain multiple marked points, and the change information corresponding to the marked points is bound.
[0012] In a preferred embodiment, the step of activating a fixed point cloud template based on a normalized image to obtain a set of point cloud activation markers includes: Determine multiple marker points obtained from normalized image matching and their corresponding change information; The point cloud in the fixed point cloud template is activated based on multiple marker points and their corresponding change information to obtain a point cloud activation marker set. The point cloud activation marker set includes the activated point cloud and its corresponding tentacle code, point cloud code and its change information.
[0013] In a preferred embodiment, the step of transmitting the point cloud activation marker set to a pre-trained defect detection model, and the defect detection model outputting the corresponding defect type, wherein point cloud activation marker sets smaller than a preset number are not transmitted, and the step of determining that the varistor image is defect-free includes: Build and train a defect detection model to obtain a trained defect detection model, and deploy the defect detection model in the cloud; The same fixed point cloud template is set at the input end of the defect detection model on both the acquisition end and the cloud end; The number of active point clouds in the point cloud activation marker set is determined, and it is determined whether the point cloud activation marker set needs to be transmitted based on the number of active point clouds. If it is less than the preset number of activations, it is determined that there are no defects on the surface of the varistor and no transmission is made. If it is greater than or equal to the preset number of activations, the point cloud activation marker set is transmitted. The cloud merges and restores the received point cloud activation marker set with the preset fixed point cloud template at the defect detection model input end. The restored point cloud activation marker set is input into the trained defect detection model, and the defect detection model outputs the defect type corresponding to the varistor image.
[0014] The technical effects and advantages provided by the present invention in the above technical solution are as follows: This invention uses multiple tentacles to mark point clouds that are not in the corresponding grayscale range, resulting in multiple marked points. By binding and associating the change information and grayscale value corresponding to each point cloud during the marking process, a set of active point cloud markers is obtained. Thus, the tentacles can transform the entire normalized image into a lightweight set containing only active point clouds, thereby facilitating the lightweight transmission of normalized images. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0016] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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 embodiments of the present invention, not all embodiments. 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.
[0018] Example 1, please refer to Figure 1 As shown in this embodiment, a surface defect detection method for varistor based on attitude normalization includes the following steps: S1. Acquire an image of the varistor, extract the varistor region from the image, and perform attitude normalization processing on the extracted varistor region to obtain a normalized image. S2. Match the normalized image with a preset fixed point cloud template, wherein the fixed point cloud template is composed of multiple two-dimensional point clouds uniformly distributed on a standard attitude varistor. S3. Activate a fixed point cloud template based on a normalized image to obtain a set of point cloud activation markers; S4. Transmit the set of point cloud activation markers to the pre-trained defect detection model. The defect detection model outputs the corresponding defect type. Point cloud activation marker sets with fewer than the preset number of activations are not transmitted, and the varistor image is determined to be defect-free.
[0019] In one embodiment, the steps of acquiring a varistor image, extracting the varistor region from the image, and performing attitude normalization processing on the extracted varistor region to obtain a normalized image include: The image of the varistor is obtained by acquiring the image of the varistor using the acquisition terminal; The color space of the varistor image is converted, an appropriate channel is selected and the varistor body and the image background are separated by adaptive threshold or fixed threshold. Morphological operations are used to remove small noise to fill holes, connected components are extracted, and ROI regions are selected according to the geometric features of the varistor to obtain the varistor region. The contour edge of the varistor is monitored within the varistor region. The varistor region is detected using Huffman transform, and the principal axis direction of the varistor region is calculated to determine the rotation angle and scaling ratio of the varistor region. By applying affine transformation, the varistor region is adjusted to a preset standard orientation and scaled to a uniform size, and a normalized image is output.
[0020] It should be noted that the industrial acquisition equipment (acquisition end) acquires the original RGB image (original image, i.e., varistor image) of the varistor surface in real time. First, color space conversion is performed, converting the original RGB image to HSV and Lab color spaces (subsequently, the varistor image is converted to grayscale based on the HSV and Lab color spaces). Relying on multi-channel independent feature differences, combined with an adaptive threshold and Otsu dual-threshold linkage selection mechanism, the target resistor area is distinguished from the conveyor belt, tooling, and environmental background areas, completing preliminary background separation. Then, sequential morphological processing of erosion, dilation, opening, and closing operations is performed to remove dust noise and isolated specks from the image surface, while simultaneously enhancing the resistor edge contour and surface fine texture, generating a high signal-to-noise ratio target mask and edge feature map. Connected component detection is performed on the segmented image region, combined with multiple geometric constraints (i.e., area, contour roundness, aspect ratio, etc.) Geometric features are used to filter and remove minute impurities, debris, and stains that interfere with connected components, accurately locking onto the effective target to obtain the piezoresistive region (i.e., the Region of Interest). Within the obtained piezoresistive region (i.e., the ROI region), the contour edge is monitored, and the piezoresistive region is detected using Huffman transform. Its principal axis direction is calculated to determine the rotation angle and scaling ratio. Finally, affine transformation is applied to adjust the piezoresistive region to a preset standard orientation and scale it to a uniform size, outputting a normalized image (i.e., a pose-normalized image). Thus, pose normalization processing can improve the robustness of piezoresistive detection, eliminate pose differences, and enhance recognition consistency.
[0021] In one embodiment, the step of matching the normalized image with a preset fixed point cloud template, wherein the fixed point cloud template is composed of multiple two-dimensional point clouds uniformly distributed on a standard attitude varistor, includes: A preset fixed point cloud template is provided, wherein the fixed point cloud template is based on a normalized image. Based on the normalized image, the grayscale range and position of each point cloud in the fixed point cloud template are set, and the grayscale range and position are bound to the corresponding point cloud code. Each point cloud corresponds to a unique code. The normalized image is matched with a fixed point cloud template.
[0022] In one embodiment, the preset fixed point cloud template, wherein the step of setting the fixed point cloud template based on a normalized image includes: Based on the specifications of the normalized image, set the template specifications, and set multiple templates based on the template specifications; Point clouds with different density distributions are set for multiple templates. The multiple templates include low-level, mid-level and high-level layers, and the point cloud of each template corresponds to a different range. Multiple templates are matched vertically in a preset order to obtain a fixed point cloud template. The preset order includes templates with point cloud density distributed from low to high in the upper, middle and lower layers.
[0023] In one embodiment, the step of matching the normalized image with a fixed point cloud template includes: For each point cloud in the fixed point cloud template, a corresponding grayscale range is preset, and each point cloud is bound to the grayscale range of the corresponding point cloud. Multiple matching tentacles are set up. Based on the matching tentacles, the normalized image is matched with a fixed point cloud template to obtain multiple marker points. Each matching tentacle includes multiple tentacles, and each tentacle includes multiple touch points. The multiple touch points are connected sequentially by touch lines. The touch lines are established based on the vertical correspondence between point clouds in the low, middle and high layers.
[0024] It should be noted that a defect-free, properly oriented, normalized image of a varistor is obtained. Using the size and coordinate system of this image as a reference, the specifications of a fixed point cloud template are defined. The template is logically divided into three layers: a low layer, a middle layer, and a high layer. Each layer corresponds to a different range of grayscale space. Point clouds with different density distributions are set for multiple templates: specifically: low layer: dense point cloud (e.g., 200 points); middle layer: moderately dense point cloud (e.g., 100 points); high layer: sparse point cloud (e.g., 50 points). The high, middle, and low layers are superimposed according to a "top-middle-bottom" spatial logic to establish a vertical (top-bottom) correspondence. Finally, a two-dimensional representation template with a three-dimensional logical structure is formed, i.e., the fixed point cloud template: the coordinate position of each pixel block (x, Under condition y), three point cloud nodes (low, medium, and high) exist simultaneously, each bound to a different grayscale range. The distribution of point cloud quantity is: high layer < medium layer < low layer. Thus, the distribution of point cloud quantity can meet the defect sensitivity of defect detection. For each point cloud in the fixed point cloud template, a unique code is assigned and bound to the corresponding grayscale range. The grayscale range of the point cloud is obtained by the minimum and maximum grayscale values of the normalized image under defect-free conditions. Furthermore, each point cloud's range (corresponding to the same size and corresponding position of pixel blocks on the normalized image) has its corresponding grayscale range. By using the grayscale range of each point cloud under defect-free conditions, it is determined whether the point cloud at each level is within the defect-free grayscale range. This allows for the pre-determination of whether there are any abnormalities in the grayscale values of each pixel block in the normalized image (the pixel block is set based on the range corresponding to the point cloud, and the size of the pixel block is the same as the range corresponding to the point cloud).
[0025] In one embodiment, the step of matching the normalized image with a fixed point cloud template based on matching tentacles includes: Multiple matching tentacles are evenly distributed in the middle layer of a fixed point cloud template. Each matching tentacle is vertically inserted through the lower, middle and upper layers of the template. The contact points on each tentacle correspond one-to-one with the point cloud to which it is attached. During the matching process, if the gray level of the corresponding pixel block in the normalized image is within the gray level range of the middle-layer template point cloud, no mark is added to the point cloud of the middle-layer template. If the gray level of the corresponding pixel block in the normalized image is not within the gray level range of the higher-layer template point cloud, a mark is added to the point cloud of the middle-layer template. If the gray level of the corresponding pixel block in the normalized image is not within the gray level range of the lower-layer template point cloud, a mark is added to the point cloud of the middle-layer template. If the gray level of the pixel block is simultaneously within the gray level ranges corresponding to the point clouds of multiple templates, no mark is added to the point cloud on the tentacle. The gray level of the corresponding pixel block and the upper or lower range of the gray level range of the corresponding point cloud are respectively assigned + or -. + or - are collectively referred to as the change information of the point cloud. The point cloud corresponding to the contact points on multiple tentacles is marked to obtain multiple marked points, and the change information corresponding to the marked points is bound.
[0026] In one embodiment, the step of activating a fixed point cloud template based on a normalized image to obtain a set of point cloud activation markers includes: Determine multiple marker points obtained from normalized image matching and their corresponding change information; The point cloud in the fixed point cloud template is activated based on multiple marker points and their corresponding change information to obtain a point cloud activation marker set. The point cloud activation marker set includes the activated point cloud and its corresponding tentacle code, point cloud code and its change information.
[0027] It should be noted that by setting multiple tentacles on a fixed point cloud model, during the matching process, if the average gray level of pixel blocks in the normalized image is within the gray level range of the corresponding point cloud of the middle-layer template, then no label is applied. If the average gray level of pixel blocks in the normalized image is not within the gray level range of the corresponding point cloud of the middle-layer template, but is above the gray level range, then a "+" is added to the point cloud corresponding to the middle-layer template; if it is below the gray level range, then a "-" is added. If the pixel gray level in the normalized image is not within the gray level range of the corresponding point cloud of the lower-layer template, but is above the gray level range, then the corresponding point cloud of the middle-layer template is labeled. Add a "+" to the point cloud; if it's below the grayscale range, add a "-". Here, "+" and "-" represent the grayscale change trend of the point cloud corresponding to the middle layer template, respectively. "+" and "-" are collectively referred to as the change information of the point cloud corresponding to the middle layer template, the high layer template, and the low layer template. Furthermore, it can establish the correlation between the low layer, middle layer, and high layer. By checking whether the grayscale (i.e., average grayscale value) of a pixel block in the normalized image is within the grayscale range of the corresponding point in the middle layer, it can pre-determine whether the pixel block has defects. The line determines whether the grayscale of a pixel block in the normalized image is within the grayscale range of the high layer / high layer. Within the grayscale range of the corresponding points on the lower layer, and based on whether they are within the corresponding grayscale range, corresponding change information (+ or -, or 0 or 1) is added. This allows us to determine the grayscale change trend of the point cloud on the corresponding middle layer template for that pixel block. By adding change information to the corresponding points, these points can reflect whether each pixel block on the normalized image is within its corresponding grayscale range, thus allowing us to anticipate whether there are defects in each pixel block on the normalized image. Specifically, for example, the higher layer has A, the middle layer has A1 and A2, and the lower layer has A1-1, A1-2, and A2. -1, A2-2; A, A1, A1-1 form a tentacle, A, A1, A1-2 form a tentacle, A, A2, A2-1, A, A2, A2-2 each form a tentacle, these tentacles form a total matching tentacle. During matching, if A1 is marked (only when the pixel block is in the grayscale range can it be marked), A1-1 is marked, and A1-2 is not marked, then the tentacle carries the information corresponding to A, A1, A1-1 (that is, point cloud A1 is marked, forming a marker point, and this marker point is bound to the change information of the corresponding point cloud), while A1-2 is not marked; Furthermore, multiple tentacles are used to mark point clouds that are not in the corresponding grayscale range, resulting in multiple marked points. By binding and associating the change information corresponding to each point cloud during the marking process, a set of point cloud activation marks is obtained. Thus, the tentacles can transform the entire normalized image into a lightweight set containing only the active point cloud (i.e., the set of point cloud activation marks is usually dozens to hundreds of points), thereby facilitating the lightweight transmission of the normalized image.
[0028] In one embodiment, the step of transmitting the point cloud activation marker set to a pre-trained defect detection model, and the defect detection model outputting the corresponding defect type, wherein the step of not transmitting point cloud activation marker sets smaller than a preset number and determining that the varistor image is defect-free includes: Build and train a defect detection model to obtain a trained defect detection model, and deploy the defect detection model in the cloud; The same fixed point cloud template is set at the input end of the defect detection model on both the acquisition end and the cloud end; The number of active point clouds in the point cloud activation marker set is determined, and it is determined whether the point cloud activation marker set needs to be transmitted based on the number of active point clouds. If it is less than the preset number of activations, it is determined that there are no defects on the surface of the varistor and no transmission is made. If it is greater than or equal to the preset number of activations, the point cloud activation marker set is transmitted. The cloud merges and restores the received point cloud activation marker set with the preset fixed point cloud template at the defect detection model input end. The restored point cloud activation marker set is input into the trained defect detection model, and the defect detection model outputs the defect type corresponding to the varistor image.
[0029] It should be noted that in the process of building the defect detection model, a lightweight graph neural network (GNN) or point cloud classification network (such as a variant of PointNet) is used. The input data is the set of point cloud activation labels merged with a fixed point cloud template, and the output is the defect type (e.g., no defect, scratch, dent, bulge, edge damage, stain, etc.). The training process is as follows: a large number of varistor samples are collected, and the corresponding set of point cloud activation labels merged with the fixed point cloud template is generated through the aforementioned steps S1 to S3 as training samples (the training samples include varistor images of each defect type obtained by steps S1 to S3 above), and the real defect type is labeled for each training sample. During training, the set of point cloud activation labels merged with the fixed point cloud template is directly used as input, and the model learns the mapping from sparse activation patterns to defect categories. The original images are not used to ensure that the model is lightweight and focuses on abnormal patterns. After training, the trained defect detection model is obtained. The trained model is deployed on a cloud server and a REST API interface is provided to receive the set of point cloud activation labels and return the defect type and confidence score. Between the acquisition end (industrial camera + industrial control computer) and the cloud, the same fixed point cloud template structure (including the coordinates, encoding, and grayscale range of each point cloud) is synchronized; there is no need to transmit the template itself, only the set of activation markers is transmitted; the input interface of the cloud defect detection model is designed as a fixed point cloud template + a set of point cloud activation markers.In short: A fixed point cloud template is always stored in the cloud for merging with the received point cloud activation marker set to form a complete input feature with defect indication; at the acquisition end (image acquisition equipment such as industrial control cameras), the number of activated marker points in the point cloud activation marker set is determined, with a preset activation number (e.g., 5 or 10, which can be set according to the minimum activation number corresponding to the defect type). If the number of activated marker points in the point cloud activation marker set is lower than the preset activation number, it is not transmitted, and the varistor surface is determined to be defect-free. If the number of activated marker points in the point cloud activation marker set is greater than or equal to the preset activation number, it is determined to be a suspected defective varistor, and the point cloud activation marker set is transmitted to the input end of the defect detection model in the cloud. After receiving the point cloud activation marker set, the input end will... It is merged with a fixed point cloud template and then input into the defect detection model, which outputs the defect type. The cloud returns the results to the acquisition end or central control system for subsequent sorting, alarm, or data recording. Furthermore, only the active point cloud (usually <1% of the original data) is transmitted, and normal products (images of normal varistors, images of varistors without defects) are not transmitted at all. The cloud defect detection model only needs to process the fixed point cloud template of the sparse point cloud, and the inference time can be controlled in milliseconds. The original image is not uploaded, only the abstract activation marker is uploaded. Even if it is intercepted, it is impossible to reverse reconstruct the appearance of the resistor, which is suitable for industrial scenarios that are sensitive to images. Furthermore, since the input of the defect detection model is the set of cloud activation markers merged with the fixed point cloud template, the defect detection model can be relatively lightweight when performing defect detection.
[0030] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for detecting surface defects of a varistor based on attitude normalization, characterized in that, Includes the following steps: Acquire images of varistors, extract the varistor region from the images, and perform attitude normalization processing on the extracted varistor region to obtain a normalized image. The normalized image is matched with a preset fixed point cloud template, wherein the fixed point cloud template is composed of multiple two-dimensional point clouds uniformly distributed on a standard attitude varistor. A set of point cloud activation markers is obtained by activating a fixed point cloud template based on a normalized image. The set of point cloud activation markers is transmitted to the pre-trained defect detection model. The defect detection model outputs the corresponding defect type. Point cloud activation marker sets with fewer than the preset number of activations are not transmitted, and the varistor image is determined to be defect-free.
2. The method for detecting surface defects of a varistor based on attitude normalization according to claim 1, characterized in that, The steps of acquiring a varistor image, extracting the varistor region from the image, and performing attitude normalization processing on the extracted varistor region to obtain a normalized image include: The image of the varistor is obtained by acquiring the image of the varistor using the acquisition terminal; The color space of the varistor image is converted, an appropriate channel is selected and the varistor body and the image background are separated by adaptive threshold or fixed threshold. Morphological operations are used to remove small noise to fill holes, connected components are extracted, and ROI regions are selected according to the geometric features of the varistor to obtain the varistor region. The contour edge of the varistor is monitored within the varistor region. The varistor region is detected using Huffman transform, and the principal axis direction of the varistor region is calculated to determine the rotation angle and scaling ratio of the varistor region. By applying affine transformation, the varistor region is adjusted to a preset standard orientation and scaled to a uniform size, and a normalized image is output.
3. The method for detecting surface defects of a varistor based on attitude normalization according to claim 1, characterized in that, The step of matching the normalized image with a preset fixed point cloud template, wherein the fixed point cloud template is composed of multiple two-dimensional point clouds uniformly distributed on a standard attitude varistor, includes: A preset fixed point cloud template is provided, wherein the fixed point cloud template is based on a normalized image. Based on the normalized image, the grayscale range and position of each point cloud in the fixed point cloud template are set, and the grayscale range and position are bound to the corresponding point cloud code. Each point cloud corresponds to a unique code. The normalized image is matched with a fixed point cloud template.
4. The method for detecting surface defects of a varistor based on attitude normalization according to claim 3, characterized in that, The preset fixed point cloud template, wherein the step of setting the fixed point cloud template based on a normalized image includes: Based on the specifications of the normalized image, set the template specifications, and set multiple templates based on the template specifications; Point clouds with different density distributions are set for multiple templates. The multiple templates include low-level, mid-level and high-level layers, and the point cloud of each template corresponds to a different range. Multiple templates are matched vertically in a preset order to obtain a fixed point cloud template. The preset order includes templates with point cloud density distributed from low to high in the upper, middle and lower layers.
5. The method for detecting surface defects of a varistor based on attitude normalization according to claim 4, characterized in that, The step of matching the normalized image with the fixed point cloud template includes: For each point cloud in the fixed point cloud template, a corresponding grayscale range is preset, and each point cloud is bound to the grayscale range of the corresponding point cloud. Multiple matching tentacles are set up. Based on the matching tentacles, the normalized image is matched with a fixed point cloud template to obtain multiple marker points. Each matching tentacle includes multiple tentacles, and each tentacle includes multiple touch points. The multiple touch points are connected sequentially by touch lines. The touch lines are established based on the vertical correspondence between point clouds in the low, middle and high layers.
6. The method for detecting surface defects of a varistor based on attitude normalization according to claim 5, characterized in that, The step of matching the normalized image with the fixed point cloud template based on the matching tentacles includes: Multiple matching tentacles are evenly distributed in the middle layer of a fixed point cloud template. Each matching tentacle is vertically inserted through the lower, middle and upper layers of the template. The contact points on each tentacle correspond one-to-one with the point cloud to which it is attached. During the matching process, if the gray level of the corresponding pixel block in the normalized image is within the gray level range of the middle-layer template point cloud, then no mark is added to the point cloud of the middle-layer template. If the gray level of the corresponding pixel block in the normalized image is not within the gray level range of the higher-layer template point cloud, then a mark is added to the point cloud of the middle-layer template. If the gray level of the corresponding pixel block in the normalized image is not within the gray level range of the lower-layer template point cloud, then a mark is added to the point cloud of the middle-layer template. If the gray level of the pixel block is simultaneously within the gray level ranges corresponding to the point clouds of multiple templates, then no mark is added to the point cloud on the tentacle. The point cloud corresponding to the contact points on multiple tentacles is marked to obtain multiple marked points, and the change information corresponding to the marked points is bound.
7. The method for detecting surface defects of a varistor based on attitude normalization according to claim 6, characterized in that, The step of activating a fixed point cloud template based on a normalized image to obtain a set of point cloud activation markers includes: Determine multiple marker points obtained from normalized image matching and their corresponding change information; The point cloud in the fixed point cloud template is activated based on multiple marker points and their corresponding change information to obtain a point cloud activation marker set. The point cloud activation marker set includes the activated point cloud and its corresponding tentacle code, point cloud code and its change information.
8. The method for detecting surface defects of a varistor based on attitude normalization according to claim 1, characterized in that, The step of transmitting the point cloud activation marker set to the pre-trained defect detection model, and the defect detection model outputting the corresponding defect type, wherein point cloud activation marker sets less than a preset number are not transmitted, and the varistor image is determined to be defect-free, includes: Build and train a defect detection model to obtain a trained defect detection model, and deploy the defect detection model in the cloud; The same fixed point cloud template is set at the input end of the defect detection model on both the acquisition end and the cloud end; The number of active point clouds in the point cloud activation marker set is determined, and it is determined whether the point cloud activation marker set needs to be transmitted based on the number of active point clouds. If it is less than the preset number of activations, it is determined that there are no defects on the surface of the varistor and no transmission is made. If it is greater than or equal to the preset number of activations, the point cloud activation marker set is transmitted. The cloud merges and restores the received point cloud activation marker set with the preset fixed point cloud template at the defect detection model input end. The restored point cloud activation marker set is input into the trained defect detection model, and the defect detection model outputs the defect type corresponding to the varistor image.