Ultrasonic radar pin defect detection method

Through deep learning object detection algorithm and image processing technology, the position and defects of ultrasonic radar PIN pins are automatically detected, which solves the problems of low detection efficiency and insufficient accuracy in the existing technology, and achieves efficient and accurate defect detection, improving product quality and safety.

CN120163768APending Publication Date: 2025-06-17COLIGEN CHINA
View PDF 0 Cites 9 Cited by

Patent Information

Application Number
CN202510150530.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

The existing ultrasonic radar PIN needle defect detection methods are inefficient, insufficient accuracy, and poor adaptability, making it difficult to effectively detect under different light and environmental conditions.

Method used

Deep learning object detection algorithm and image processing technology are adopted to automatically acquire images and data processing to identify the position and defect type of the PIN pin, combined with Canny edge detection algorithm and morphological operations, to improve the accuracy and reliability of the detection.

Benefits of technology

It significantly improves detection efficiency and accuracy, reduces manual intervention, enhances detection robustness and anti-interference ability, is easy to expand and maintain, and improves product quality and safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120163768A_ABST
    Figure CN120163768A_ABST
Patent Text Reader

Abstract

The invention provides an ultrasonic radar pin defect detection method, which comprises the following steps of: acquiring an image by a camera, and setting a trigger condition to automatically acquire the image; applying a deep learning target detection algorithm to locate the position of a pin, inputting a collected image into a trained target detection model, and obtaining a bounding box of the pin and a confidence score of the bounding box; image processing is carried out to determine the center coordinate position of a pin, image processing is carried out on a bounding box region output by the target detection model, an image processing algorithm is used to analyze each pin region, and the center coordinate of the pin is determined; and defect judgment: formulating a standard distance according to a set pin standard size and production requirements, recording the pixel distance of each pin, and judging whether the pins have defects or not by comparing the actually measured pixel distance with a preset standard distance. According to the invention, a deep learning target detection algorithm and an image processing technology are utilized, the position and defect type of the PIN needle can be accurately identified, and the accuracy and reliability of detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of appearance defect detection, and particularly to a method for detecting defects of ultrasonic radar pin pins. Background Art

[0002] As one of the key sensors for autonomous driving and intelligent devices, the performance and quality of ultrasonic radars directly affect the overall performance and safety of the devices. As one of the core components of ultrasonic radars, PIN pins are prone to defects such as bending, fracture, and dislocation during the production process. Traditional defect detection methods mainly rely on manual inspection or simple visual inspection. These methods are not only inefficient but also easily interfered by human factors, resulting in insufficient accuracy and reliability of the detection results.

[0003] With the development of deep learning technology and image processing technology, automated detection methods based on computer vision have gradually become an important means to solve this problem. However, most of the existing PIN pin defect detection methods are based on traditional image processing technology. These methods have poor adaptability under the influence of factors such as light and environment and are not easy to expand. Therefore, it is of great significance to develop an efficient and accurate method for detecting defects of ultrasonic radar PIN pins. Summary of the Invention

[0004] Aiming at the deficiencies of the prior art, the present invention provides a method for detecting defects of ultrasonic radar pin pins. This method greatly improves the detection efficiency and reduces the labor cost by automatically collecting images and processing data. By using deep learning object detection algorithms and image processing technology, it can accurately identify the position and defect type of PIN pins, improving the accuracy and reliability of the detection.

[0005] The present invention achieves the above object through the following technical solutions:

[0006] A method for detecting defects of ultrasonic radar pin pins, comprising the following steps:

[0007] Step S1: The camera collects images. A high-resolution industrial camera is selected, which supports image collection of at least 1080p. The camera is fixed on the detection device, and the trigger condition is set to automatically collect images;

[0008] Step S2: Apply a deep learning object detection algorithm to locate the position of the pin pins. Use a deep learning framework to build an object detection model, and use a large number of labeled image data to train the object detection model so as to accurately identify the pin pins. Input the collected images into the trained object detection model to obtain the bounding boxes of the pin pins and their confidence scores. By setting a confidence threshold, only the detection results higher than this threshold are retained to improve the accuracy and reduce false positives;

[0009] Step S3: Image processing to determine the center coordinate position of the pin. Perform image processing on the bounding box area output by the target detection model, and use image processing algorithms to analyze each pin area to determine the center coordinates of the pin;

[0010] Step S4: Defect judgment. Set a standard distance according to the set standard size of the pin and production requirements, record the pixel distance of each pin, and judge whether there is a defect in the pin by comparing the actually measured pixel distance with the preset standard distance.

[0011] According to an ultrasonic radar pin defect detection method provided by the present invention, use a deep learning framework to construct a YOLO or Faster R-CNN model to identify pins, including the following steps:

[0012] Data preparation step:

[0013] Image annotation: Obtain a large number of image data containing pins and annotate these images; the annotation content needs to include the position coordinates and category information of the pins;

[0014] Dataset division: Divide the annotated image data into a training set, a validation set, and a test set for model training, validation, and testing;

[0015] Model construction step:

[0016] Select a deep learning framework: Select TensorFlow or PyTorch as the deep learning framework for constructing and training a YOLO or Faster R-CNN model;

[0017] For the YOLO model, select a YOLO version suitable for the target detection task and configure the corresponding network architecture; for the Faster R-CNN model, select a backbone network and construct a Region Proposal Network (RPN) and a Fast R-CNN detector;

[0018] Model training step:

[0019] Data preprocessing: Perform preprocessing operations on the training set and validation set images to meet the model input requirements;

[0020] Model training: Use the training set image data to train the model;

[0021] Model validation: Use the validation set image data to validate the trained model and evaluate the performance of the model on unseen data;

[0022] Model application step:

[0023] Image input: Input the collected image containing the pin into the trained YOLO or Faster R-CNN model;

[0024] Object detection and recognition: The model performs object detection and recognition on the input image and outputs the position coordinates and class information of the pin.

[0025] According to an ultrasonic radar pin defect detection method provided by the present invention, when obtaining the bounding box of the pin and its confidence score, the collected image containing the pin is input into the trained YOLO or Faster R-CNN model for forward propagation calculation;

[0026] The trained model outputs a series of predicted bounding boxes, and each bounding box represents a region in the image that may contain a pin;

[0027] For each predicted bounding box, the trained model simultaneously outputs a confidence score, indicating the probability that the bounding box contains a pin;

[0028] According to the requirements of the actual application scenario and the performance of the model on the validation set, a confidence threshold is set, and this threshold is used to screen the detection results;

[0029] Compare the confidence score of each predicted bounding box with the set threshold, and only retain the predicted bounding boxes with a confidence score higher than the threshold as the final detection results. By filtering out the predicted bounding boxes with lower confidence, false positive detection results are effectively reduced.

[0030] According to an ultrasonic radar pin defect detection method provided by the present invention, based on the selected high-confidence bounding boxes, the target region of each pin is determined;

[0031] Apply the Canny edge detection algorithm to the target region of each pin to extract the edge information of the pin and form a clear contour;

[0032] Perform a closing operation on the extracted pin contour to remove the noise on the contour and fill small holes;

[0033] Identify all boundary points on the contour after the closing operation;

[0034] Calculate the average coordinates of all boundary points and use this average coordinate as the geometric center coordinate of the pin.

[0035] According to an ultrasonic radar pin defect detection method provided by the present invention, the performing a closing operation on the extracted pin contour includes:

[0036] Select a structural element, whose shape and size are determined according to the characteristics of the pin profile and the sizes of noise and holes;

[0037] Perform a closing operation on the extracted pin profile and the defined structural element, which specifically includes:

[0038] Dilation operation: Slide the structural element on the profile to expand the profile outward, thereby connecting adjacent profile parts and filling small holes;

[0039] Erosion operation: Slide the structural element on the dilated profile again to contract the profile inward, thereby removing noise and small protrusions on the profile;

[0040] After the closing operation, a pin profile with noise removed and small holes filled is obtained.

[0041] According to an ultrasonic radar pin defect detection method provided by the present invention, through contour analysis, calculate the geometric center coordinates of the pin, expressed by the following formula:

[0042]

[0043]

[0044] where, m 00 is the zero-order moment of the contour, representing the total area of the contour region; m 10 is the first-order moment of the contour, representing the horizontal centroid of the contour; m 01 is the first-order moment of the contour, representing the vertical centroid of the contour;

[0045] where, the zero-order moment m 00 : m 00 =∑ i 1, that is, the area of each pixel in the contour region, usually equal to the number of pixels of the contour; the first-order moments m 10 and m 00 : m 00 =∑ i x i respectively represent the weighted sums of the horizontal coordinates and vertical coordinates of all points in the contour region.

[0046] According to an ultrasonic radar pin defect detection method provided by the present invention, after identifying the position of each pin, that is, the center coordinates, record its pixel coordinates in the image, and the specific implementation includes:

[0047] For two adjacent pin needles, calculate their pixel distances in the image. According to the pixel coordinates of the two pin needles, assumed to be (x1, y1) and (x2, y2) respectively, use the Euclidean distance formula or other distance calculation formulas to calculate the pixel distance D between them. The calculation formula for D is as follows:

[0048]

[0049] Output and store the pixel distance of each calculated pin needle.

[0050] According to an ultrasonic radar pin needle defect detection method provided by the present invention, when setting the standard distance, set the upper limit standard and the lower limit standard for the distance between pin needles according to the product design requirements and manufacturing specifications. This standard is expressed in pixels;

[0051] For the pixel distance of each calculated pin needle, compare it with the set upper limit standard and lower limit standard to determine whether there is a defect and determine the defect type:

[0052] Bending: If the actual pixel distance is greater than the upper limit standard, it is determined as a bending defect;

[0053] Displacement: If the actual pixel distance is less than the lower limit standard, it is determined as a displacement defect;

[0054] Missing: If a pin needle is not detected at a position where a pin needle is expected to exist, that is, the pixel distance at this position cannot be calculated, it is determined as a missing defect;

[0055] Record the determined defect type and its related information, and output a defect report.

[0056] According to an ultrasonic radar pin needle defect detection method provided by the present invention, it further includes:

[0057] Apply the non-maximum suppression (NMS) algorithm to eliminate overlapping bounding boxes to ensure that each pin needle is only recorded once. Specifically, it includes:

[0058] Sort all predicted bounding boxes in descending order of confidence scores;

[0059] Starting from the bounding box with the highest confidence, traverse each bounding box in turn. For the currently traversed bounding box, perform the following steps:

[0060] Take the current bounding box as the reference bounding box;

[0061] Calculate the overlap degree between the reference bounding box and all other non-suppressed bounding boxes;

[0062] For bounding boxes with an overlap degree exceeding a preset threshold, mark them as suppressed, indicating that these candidate boxes overlap too much with the reference box and should be eliminated;

[0063] Repeat the above steps until all candidate boxes have been traversed;

[0064] Output the final position of the pin. Among them, all non-suppressed candidate boxes are the final pin position boxes, and each box corresponds to a unique pin position;

[0065] Record and output the relevant information of the final pin position box, and this information includes at least the position coordinates and the confidence score.

[0066] According to an ultrasonic radar pin defect detection method provided by the present invention, apply the Canny edge detection algorithm to the target area of each pin, specifically including:

[0067] Perform Gaussian filtering on the image data of the target area of each pin to smooth the image and reduce noise;

[0068] Use the gradient calculation operator to calculate the gradient magnitude and direction of each pixel point in the image to highlight the edge features in the image;

[0069] In the gradient magnitude image, perform non-maximum suppression on each pixel point, that is, only retain the local maximum in the gradient direction to refine the edge and eliminate the interference of non-edge pixels;

[0070] Set two thresholds, a high threshold and a low threshold, and perform threshold segmentation on the gradient magnitude image after non-maximum suppression; among them, the pixel points higher than the high threshold are regarded as strong edge points, the pixel points lower than the low threshold are discarded, and the pixel points between the two are judged according to their connectivity with the strong edge points to form continuous edges;

[0071] According to the edge information extracted by the Canny edge detection algorithm, use the contour tracking or connection algorithm to form a clear contour of the PIN needle, and this contour is used to accurately reflect the shape and size characteristics of the PIN needle.

[0072] It can be seen that compared with the prior art, the present invention proposes an ultrasonic radar PIN needle defect detection method, which focuses on improving the efficiency and accuracy of PIN needle defect detection in ultrasonic radars. The following are the beneficial effects of the present invention:

[0073] Significantly improve the detection efficiency: The present invention realizes the automatic detection of PIN needle defects by integrating camera image acquisition, deep learning object detection, and image processing technologies. Compared with the traditional manual detection method, the present invention can greatly reduce manual intervention and improve the detection speed, so as to meet the requirements of modern industry for rapid detection.

[0074] Improve detection accuracy: By using deep learning algorithms such as YOLO and Faster R-CNN, the present invention can accurately identify and locate the position of the PIN pins. Combining image processing techniques such as edge detection and morphological operations, the central coordinates of the PIN pins can be accurately calculated, and by comparing with the preset standards, it can accurately determine whether there are defects such as bending, misalignment, and missing of the PIN pins. This method is more accurate than manual detection and reduces the possibility of human errors.

[0075] Enhance detection robustness: The deep learning object detection algorithm adopted by the present invention is trained with a large number of labeled images and has robustness under different angles and lighting conditions. At the same time, steps such as noise suppression and contour extraction in image processing techniques also enhance the anti-interference ability of the detection, enabling this method to work stably in various complex environments.

[0076] Easy to expand and maintain: The detection method of the present invention is based on computer vision technology and has good scalability. With the continuous development of deep learning algorithms and image processing techniques, the present invention can further improve the detection performance by updating the algorithm model or optimizing the image processing process. In addition, the maintenance cost of the automated detection system is relatively low, which is beneficial to reducing the operating cost of enterprises.

[0077] Improve product quality and safety: By promptly detecting and handling the defects of the PIN pins, the present invention helps to improve the product quality and reliability of ultrasonic radar devices. This can not only reduce equipment failures and maintenance costs caused by defects, but also improve the use safety of the equipment, providing a strong guarantee for the development of fields such as autonomous driving and intelligent devices.

[0078] In summary, the ultrasonic radar PIN pin defect detection method proposed by the present invention has significant beneficial effects, including improving detection efficiency, accuracy, robustness, being easy to expand and maintain, and improving product quality and safety. This method is of great significance for promoting the development and application of ultrasonic radar technology.

[0079] The following further elaborates the present invention in detail in conjunction with the accompanying drawings and specific embodiments. Description of the Drawings

[0080] Figure 1 It is a flowchart of an embodiment of a method for detecting ultrasonic radar PIN pin defects of the present invention. Specific Embodiments

[0081] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without making creative efforts belong to the scope of protection of the present invention.

[0082] As used herein, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0083] Refer to Figure 1 , this embodiment provides a method for detecting ultrasonic radar pin defects, and the method includes the following steps:

[0084] Step S1: The camera captures images. A high-resolution industrial camera is selected, and this camera supports image capture of at least 1080p; the camera is fixed on the detection device, and the trigger condition is set to automatically capture images;

[0085] Step S2: Apply a deep learning object detection algorithm to locate the position of the pin. Use a deep learning framework (such as TensorFlow or PyTorch) to build an object detection model, and use a large number of labeled image data to train the object detection model so as to accurately identify the pin; input the captured image into the trained object detection model to obtain the bounding box of the pin and its confidence score; by setting a confidence threshold (such as 0.7), only retain the detection results higher than this threshold to improve accuracy and reduce false positives;

[0086] Step S3: Image processing to determine the central coordinate position of the pin. Perform image processing on the bounding box area output by the object detection model, use image processing algorithms to analyze each pin area, and determine the central coordinates of the pin;

[0087] Step S4: Defect judgment. According to the set standard size of the pin and production requirements, a standard distance is formulated, the pixel distance of each pin is recorded, and by comparing the actually measured pixel distance with the preset standard distance, it is judged whether the pin has defects.

[0088] In the above step S1, an industrial camera with a resolution of at least 1920x1080 pixels is selected. Higher resolutions (such as 3 million pixels, 5 million pixels, etc.) can provide clearer images, but they will also increase the burden and cost of data processing. Therefore, on the premise of meeting the requirements, an appropriate resolution can be selected. Select the interface type of the camera according to the interface type of the detection device, such as GigE, USB3.0, Camera Link, etc., to ensure smooth communication between the camera and the detection device. Among them, cooperate with an LED lamp with a high color rendering index, and fix the LED lamp around the camera or at an appropriate position of the detection device to ensure that the light can evenly irradiate the object to be detected. At the same time, avoid direct light hitting the camera lens to prevent the influence of glare and reflection.

[0089] The focal length of the lens should ensure the clear visibility of the pin. Measure the distance between the camera lens and the object to be detected (pin). According to the detection requirements, determine the field of view range that the camera needs to capture. For the detection of pins, the field of view range should be small enough to ensure the clear visibility of the pins. Calculate using the relationship formula among the focal length, working distance, and field of view range. The formula is: focal length (f) = working distance (WD) × target size (H or V) / field of view (FOV) (H or V), where the target size is the size of the camera sensor (such as 1 / 2", 2 / 3", etc.), and it needs to be converted to millimeters for calculation. Select an appropriate industrial lens according to the calculated focal length.

[0090] Use a uniform light source (such as a ring-shaped LED lamp) to avoid the influence of shadows and reflections on the image quality. The ring-shaped LED lamp can provide uniform light irradiation, reducing the influence of shadows and reflections. At the same time, the ring-shaped LED lamp can also adjust the brightness and angle of the light according to the detection requirements. Install the ring-shaped LED lamp around the camera lens to ensure that the light can evenly irradiate the object to be detected. After installation, debug the light source to ensure that the uniformity and brightness of the light meet the detection requirements.

[0091] Fix the camera on the detection device to ensure that the viewing angle is the same for each detection. Design an appropriate fixing bracket according to factors such as the size and weight of the detection device and the camera. The bracket should be stable enough to withstand the weight and vibration of the camera. When installing the camera, adjust its installation angle to ensure that the viewing angle is the same for each detection. This can be achieved by using an adjustable-angle bracket or connector. Use fasteners such as bolts and screws to fix the camera on the bracket to ensure a firm and reliable connection.

[0092] Set trigger conditions (such as sensor signals on the production line) to automatically capture images. Select an appropriate triggering method: Based on the signal type of the detection device and the triggering mode of the camera, select an appropriate triggering method. For example, if the detection device emits a level pulse signal, the hard trigger mode of the camera can be selected; if a software signal is emitted, the soft trigger mode of the camera can be selected. Connect the trigger signal of the detection device to the trigger input of the camera to ensure correct and error-free signal connection. Set trigger parameters such as trigger mode and trigger polarity in the camera's configuration software. Ensure that the camera can automatically capture images according to the expected trigger conditions. Among them, this trigger can be achieved through a photoelectric sensor. Connect the output signal of the photoelectric sensor to the trigger input of the camera. Set the trigger conditions in the camera's configuration software, select the photoelectric sensor as the trigger source, and set parameters such as trigger sensitivity and trigger delay according to actual needs to ensure that the camera captures images at the correct moment. When the pin passes through the sensor, the sensor emits a trigger signal, and the camera immediately captures an image after receiving the signal. In this way, it can ensure that the image of the pin can be accurately captured every time, providing reliable data support for subsequent quality inspection and analysis.

[0093] In step S2 above, use a deep learning framework to build a YOLO or Faster R-CNN model to identify pins, including the following steps:

[0094] Data preparation steps:

[0095] Image annotation: Obtain a large number of image data containing pins and annotate these images; the annotation forms include but are not limited to rectangular box annotation, and the annotation content needs to include the position coordinates and category information of the pins;

[0096] Dataset division: Divide the annotated image data into a training set, a validation set, and a test set for model training, validation, and testing. The dataset needs to include pin images under different angles and lighting conditions to improve the robustness and accuracy of the model.

[0097] Model construction steps:

[0098] Select a deep learning framework: Select TensorFlow or PyTorch as the deep learning framework for building and training a YOLO or Faster R-CNN model;

[0099] For the YOLO model, select a YOLO version suitable for the object detection task and configure the corresponding network architecture; for the Faster R-CNN model, select the backbone network and build a Region Proposal Network (RPN) and a Fast R-CNN detector.

[0100] Model training steps:

[0101] Data preprocessing: Preprocess the training set and validation set images, such as scaling, cropping, normalization, etc., to meet the model input requirements;

[0102] Model training: Use the training set image data to train the model. During the training process, cross-validation is used to ensure the performance of the model on unseen samples. At the same time, data augmentation techniques (such as rotation, scaling, etc.) are used to improve the generalization ability of the model. And monitor the changes of indicators such as the loss function and accuracy, and adjust the model parameters and training strategies in a timely manner.

[0103] Model validation: Use the validation set image data to validate the trained model and evaluate the performance of the model on unseen data.

[0104] Model application steps:

[0105] Image input: Input the collected image containing the pin into the trained YOLO or Faster R-CNN model;

[0106] Object detection and recognition: The model performs object detection and recognition on the input image and outputs the position coordinates and category information of the pin.

[0107] In this embodiment, when obtaining the bounding box of the pin and its confidence score, the collected image containing the pin is input into the trained YOLO or Faster R-CNN model for forward propagation calculation;

[0108] A series of predicted bounding boxes are output by the trained model, and each bounding box represents a region in the image that may contain the pin;

[0109] For each predicted bounding box, the trained model simultaneously outputs a confidence score, indicating the probability that the bounding box contains the pin;

[0110] According to the requirements of the actual application scenario and the performance of the model on the validation set, a confidence threshold is set, and this threshold is used to screen the detection results;

[0111] Compare the confidence score of each predicted bounding box with the set threshold, and only retain the predicted bounding boxes with confidence scores higher than the threshold as the final detection results. By filtering out the predicted bounding boxes with lower confidence, false positive detection results are effectively reduced. Among them, the box with the highest confidence is recorded as the final output, and the detection results are stored in JSON format for subsequent analysis.

[0112] In this embodiment, based on the selected high-confidence bounding boxes, the target area of each pin is determined, and the Canny edge detection algorithm is applied to the target area of each pin to extract the edge information of the pin and form a clear contour.

[0113] Perform a closing operation on the extracted pin contour to remove the noise on the contour and fill small holes. On the contour after the closing operation, identify all boundary points, calculate the average coordinates of all boundary points, and use the average coordinates as the geometric center coordinates of the pin.

[0114] In this embodiment, performing a closing operation on the extracted pin contour includes:

[0115] Select a structuring element, whose shape and size are determined according to the characteristics of the pin contour and the size of the noise and holes;

[0116] Perform a closing operation on the extracted pin contour and the defined structuring element, which specifically includes:

[0117] Dilation operation: Slide the structuring element on the contour to expand the contour outward, thereby connecting adjacent contour parts and filling small holes;

[0118] Erosion operation: Slide the structuring element on the dilated contour again to contract the contour inward, thereby removing the noise and small protruding parts on the contour;

[0119] After the closing operation, obtain the pin contour after removing noise and filling small holes.

[0120] In this embodiment, through contour analysis, calculate the geometric center coordinates of the pin, expressed by the following formula:

[0121]

[0122]

[0123] where m 00 is the zero-order moment of the contour, representing the total area of the contour region; m 10 is the first-order moment of the contour, representing the horizontal center of gravity of the contour; m 01 is the first-order moment of the contour, representing the vertical center of gravity of the contour;

[0124] where the zero-order moment m 00 : m 00 =∑ i 1 is the area of each pixel within the contour region, usually equal to the number of pixels of the contour; the first-order moments m 10 and m 00 : m 00 =∑ ix i They respectively represent the weighted sums of the horizontal coordinates and vertical coordinates of all points in the contour region.

[0125] After identifying the position of each pin, that is, the center coordinates, record its pixel coordinates in the image. The specific implementation includes:

[0126] For two adjacent pins, calculate their pixel distances in the image. According to the pixel coordinates of the two pins, assuming they are (x1, y1) and (x2, y2) respectively, use the Euclidean distance formula or other distance calculation formulas to calculate the pixel distance D between them. The calculation formula of D is:

[0127]

[0128] Output and store the calculated pixel distance of each pin.

[0129] In this embodiment, when setting the standard distance, according to the product design requirements and manufacturing specifications, set the upper limit standard and lower limit standard of the distance between pins. This standard is expressed in pixels;

[0130] For the pixel distance of each calculated pin, compare it with the set upper limit standard and lower limit standard to determine whether there are defects and determine the defect type:

[0131] Bending: If the actual pixel distance is greater than the upper limit standard, it is determined as a bending defect;

[0132] Displacement: If the actual pixel distance is less than the lower limit standard, it is determined as a displacement defect;

[0133] Missing: If no pin is detected at a position where a pin is expected to exist, that is, the pixel distance at this position cannot be calculated, it is determined as a missing defect;

[0134] Record the determined defect type and its related information (such as defect position, defect degree, etc.), and output a defect report.

[0135] In this embodiment, it also includes:

[0136] Apply the non-maximum suppression (NMS) algorithm to eliminate overlapping bounding boxes to ensure that each pin is only recorded once. It specifically includes:

[0137] Sort all predicted bounding boxes in descending order of confidence scores;

[0138] Starting from the bounding box with the highest confidence, traverse each bounding box in turn. For the currently traversed bounding box, perform the following steps:

[0139] Take the current bounding box as the reference box;

[0140] Calculate the overlap degree between the reference box and all other non-suppressed bounding boxes;

[0141] For the bounding boxes with an overlap degree exceeding the preset threshold, mark them as suppressed, indicating that these candidate boxes overlap too much with the reference box and should be eliminated;

[0142] Repeat the above steps until all candidate boxes have been traversed;

[0143] Output the positions of the final pins. Among them, all non-suppressed candidate boxes are the final pin position boxes, and each box corresponds to a unique pin position;

[0144] Record and output the relevant information of the final pin position boxes, and this information includes at least the position coordinates and confidence scores.

[0145] In this embodiment, apply the Canny edge detection algorithm to the target area of each pin, specifically including:

[0146] Perform Gaussian filtering on the image data of the target area of each pin to smooth the image and reduce noise; the standard deviation of the Gaussian filter is adjusted according to the image noise level and edge detail requirements to ensure effective noise suppression while retaining edge details.

[0147] Use gradient calculation operators (such as Sobel operator, Prewitt operator, etc.) to calculate the gradient magnitude and direction of each pixel point in the image to highlight the edge features in the image.

[0148] In the gradient magnitude image, perform non-maximum suppression on each pixel point, that is, only retain the local maximum value in the gradient direction to refine the edge and eliminate the interference of non-edge pixels.

[0149] Set two thresholds, a high threshold and a low threshold, and perform threshold segmentation on the gradient magnitude image after non-maximum suppression; among them, the pixel points higher than the high threshold are regarded as strong edge points, the pixel points lower than the low threshold are discarded, and the pixel points between the two are judged according to their connectivity with the strong edge points to form continuous edges.

[0150] Optimize the smoothing effect of the image by adjusting the standard deviation of the Gaussian filter to ensure effective noise suppression while retaining edge details; select appropriate gradient calculation operators to improve the accuracy and efficiency of edge detection; set reasonable double thresholds according to the image contrast and edge strength to accurately extract edge information and reduce false detection and missed detection.

[0151] According to the edge information extracted by the Canny edge detection algorithm, a clear contour of the PIN needle is formed using a contour tracking or connection algorithm, and this contour is used to accurately reflect the shape and size characteristics of the PIN needle.

[0152] Through the above specific implementation steps and optimization methods of the Canny edge detection algorithm, the method provided in this embodiment can efficiently and accurately extract the edge information of the PIN needle and form a clear contour, ensuring the accuracy and reliability of the PIN needle defect detection.

[0153] It can be seen that compared with the prior art, the present invention proposes a method for detecting PIN needle defects in an ultrasonic radar. This method focuses on improving the efficiency and accuracy of detecting PIN needle defects in an ultrasonic radar. The following are the beneficial effects of the present invention:

[0154] Significantly improve the detection efficiency: The present invention realizes the automatic detection of PIN needle defects by integrating camera image acquisition, deep learning object detection, and image processing technologies. Compared with the traditional manual detection method, the present invention can greatly reduce manual intervention and improve the detection speed, thus meeting the requirements of modern industry for rapid detection.

[0155] Improve the detection accuracy: By using deep learning algorithms such as YOLO and Faster R-CNN, the present invention can accurately identify and locate the position of the PIN needle. Combining image processing technologies such as edge detection and morphological operations, the central coordinates of the PIN needle can be accurately calculated, and by comparing with the preset standards, it can be accurately determined whether there are defects such as bending, misalignment, and missing of the PIN needle. This method is more accurate than manual detection and reduces the possibility of human errors.

[0156] Enhance the detection robustness: The deep learning object detection algorithm adopted by the present invention has been trained with a large number of labeled images and has robustness under different angles and lighting conditions. At the same time, steps such as noise suppression and contour extraction in the image processing technology also enhance the anti-interference ability of the detection, enabling this method to work stably in various complex environments.

[0157] Easy to expand and maintain: The detection method of the present invention is based on computer vision technology and has good scalability. With the continuous development of deep learning algorithms and image processing technologies, the present invention can further improve the detection performance by updating the algorithm model or optimizing the image processing process. In addition, the maintenance cost of the automatic detection system is relatively low, which is beneficial to reducing the operating cost of enterprises.

[0158] Improving product quality and safety: By promptly detecting and handling defects in PIN needles, the present invention helps improve the product quality and reliability of ultrasonic radar devices. This can not only reduce equipment failures and maintenance costs caused by defects but also enhance the safety of equipment use, providing strong support for the development of fields such as autonomous driving and intelligent devices.

[0159] In summary, the ultrasonic radar PIN needle defect detection method proposed by the present invention has significant beneficial effects, including improving detection efficiency, accuracy, and robustness, being easy to expand and maintain, and enhancing product quality and safety. This method is of great significance for promoting the development and application of ultrasonic radar technology.

[0160] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity in description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope described in this specification.

[0161] The above embodiments are only the preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantive changes and substitutions made by those skilled in the art based on the present invention fall within the scope of protection required by the present invention.

Claims

1. An ultrasonic radar pin defect detection method, characterized in that: The following steps are involved: Step S1: The camera acquires images. A high-resolution industrial camera is selected, which supports at least 1080p image acquisition. The camera is fixed on the detection equipment and trigger conditions are set to automatically acquire images. Step S2: Apply deep learning target detection algorithm to locate the pin position, use deep learning framework to build target detection model, and use a large amount of labeled image data to train the target detection model so that pins can be accurately identified; Input the captured image into the trained object detection model to obtain the pin's bounding box and its confidence score; by setting a confidence threshold, only the detection results above the threshold are retained to improve accuracy and reduce false positives; Step S3: image processing to determine the center coordinate position of the pin, image processing is performed on the bounding box area output by the target detection model, and each pin area is analyzed using an image processing algorithm to determine the center coordinate of the pin; Step S4: Defect judgment: formulate a standard distance according to the set pin standard size and production requirements, record the pixel distance of each pin, and judge whether the pin has defects by comparing the actually measured pixel distance with the preset standard distance.

2. The method according to claim 1, characterized in that: Using a deep learning framework to build a YOLO or Faster R-CNN model to identify pins includes the following steps: Data preparation steps: Image annotation: Obtain a large amount of image data containing pins and annotate these images; the annotation content must include the location coordinates and category information of the pins; Dataset division: The labeled image data is divided into training set, validation set and test set for model training, validation and testing; Model building steps: Choose a deep learning framework: Choose TensorFlow or PyTorch as the deep learning framework for building and training YOLO or Faster R-CNN models; For the YOLO model, select the YOLO version suitable for the target detection task and configure the corresponding network architecture; for the Faster R-CNN model, select the backbone network and build the region proposal network RPN and Fast R-CNN detector; Model training steps: Data preprocessing: Preprocess the training set and validation set images to meet the model input requirements; Model training: Use the training set image data to train the model; Model validation: Use validation set image data to validate the trained model and evaluate the performance of the model on unseen data; Model application steps: Image input: Input the collected images containing pins into the trained YOLO or Faster R-CNN model; Object detection and recognition: The model performs object detection and recognition on the input image and outputs the location coordinates and category information of the pins.

3. The method according to claim 2, characterized in that: When obtaining the pin's bounding box and its confidence score, the collected image containing the pin is input into the trained YOLO or Faster R-CNN model for forward propagation calculation; The trained model outputs a series of predicted bounding boxes, each of which represents an area in the image that may contain a pin. For each predicted bounding box, the trained model also outputs a confidence score, indicating the probability that the bounding box contains a pin; According to the requirements of the actual application scenario and the performance of the model on the validation set, a confidence threshold is set, which is used to filter the detection results; The confidence score of each predicted bounding box is compared with the set threshold, and only the predicted bounding boxes with confidence scores higher than the threshold are retained as the final detection results. By filtering out predicted bounding boxes with lower confidence, false positive detection results are effectively reduced.

4. The method according to claim 3, characterized in that: Determine the target area of ​​each pin based on the selected high-confidence bounding box; Apply the Canny edge detection algorithm to the target area of ​​each pin to extract the edge information of the pin and form a clear outline; Perform a closing operation on the extracted pin contour to remove noise on the contour and fill small holes; On the contour processed by the closing operation, all boundary points are identified; Calculate the average coordinates of all boundary points and use the average coordinates as the geometric center coordinates of the pin.

5. The method according to claim 4, characterized in that The performing a closing operation on the extracted pin needle contour includes: Select a structural element whose shape and size are determined by the characteristics of the pin outline and the size of the noise and holes; The extracted pin needle contour is closed with the defined structural element, which specifically includes: Dilation operation: Slide the structural element on the contour to expand the contour outward, thereby connecting adjacent contour parts and filling small holes; Erosion operation: Slide the structural element again on the expanded contour to shrink the contour inward, thereby removing noise and small protrusions on the contour; After the closing operation, the pin outline is obtained after removing noise and filling small holes.

6. The method according to claim 4, characterized in that: Through contour analysis, the geometric center coordinates of the pin are calculated and expressed as the following formula: Among them, m 00 is the zero-order moment of the contour, indicating the total area of ​​the contour region; m 10 is the first moment of the contour, indicating the horizontal center of gravity of the contour; m 01 is the first moment of the contour, indicating the vertical center of gravity of the contour; Among them, the zero-order moment m 00 ∶m 00 =∑ i 1 is the area of ​​each pixel in the contour area, which is usually equal to the number of pixels in the contour; the first-order moment m 10 and m 00 ∶m 00 =∑ i x i Represent the weighted sum of the horizontal and vertical coordinates of all points in the contour area respectively.

7. The method according to claim 1, characterized in that: After identifying the position of each pin, that is, the center coordinate, record its pixel coordinates in the image. The specific implementation includes: For two adjacent pins, calculate their pixel distance in the image. According to the pixel coordinates of the two pins, assuming they are (x1, y1) and (x2, y2) respectively, use the Euclidean distance formula or other distance calculation formula to calculate the pixel distance D between them, where the calculation formula of D is: The calculated pixel distance of each pin is output and stored.

8. The method according to claim 7, characterized in that: When setting the standard distance, set the upper and lower limits of the distance between pins according to product design requirements and manufacturing specifications. The standard is expressed in pixels. For each calculated pixel distance of the pin, compare it with the set upper and lower limit standards to determine whether there is a defect and determine the defect type: Bending: If the actual pixel distance is greater than the upper limit standard, it is judged as a bending defect; Misalignment: If the actual pixel distance is less than the lower limit standard, it is judged as a misalignment defect; Missing: If a pin is not detected at a location where a pin is expected to exist, that is, the pixel distance at that location cannot be calculated, it is considered a missing defect; The determined defect type and related information are recorded, and a defect report is output.

9. The method according to any one of claims 1 to 8, characterized in that: Also includes: The non-maximum suppression (NMS) algorithm is used to eliminate overlapping frames and ensure that each pin is recorded only once, which includes: Sort all predicted bounding boxes by confidence score from high to low; Starting from the bounding box with the highest confidence, traverse each bounding box in turn, and for the currently traversed bounding box, perform the following steps: Use the current bounding box as the reference box; Compute the overlap between the reference box and all other unsuppressed bounding boxes; For bounding boxes whose overlap exceeds a preset threshold, they are marked as suppressed, indicating that these candidate boxes overlap too much with the reference box and should be eliminated; Repeat the above steps until all candidate boxes have been traversed; Output the final pin position, where all unsuppressed candidate boxes are the final pin position boxes, and each box corresponds to a unique pin position; Record and output the relevant information of the final pin position frame, which at least includes the position coordinates and confidence score.

10. The method according to claim 4, characterized in that Apply the Canny edge detection algorithm to the target area of ​​each pin, including: Gaussian filtering is performed on the image data of the target area of ​​each pin to smooth the image and reduce noise; The gradient calculation operator is used to calculate the gradient magnitude and direction of each pixel in the image to highlight the edge features in the image; In the gradient magnitude image, non-maximum suppression is performed on each pixel, that is, only the local maximum value in the gradient direction is retained to refine the edge and eliminate the interference of non-edge pixels; Two thresholds, a high threshold and a low threshold, are set to perform threshold segmentation on the gradient amplitude image after non-maximum suppression processing; pixels above the high threshold are regarded as strong edge points, pixels below the low threshold are discarded, and pixels between the two are judged according to their connectivity with the strong edge points to form a continuous edge; According to the edge information extracted by the Canny edge detection algorithm, a clear outline of the PIN needle is formed by using a contour tracking or connection algorithm, and the outline is used to accurately reflect the shape and size characteristics of the PIN needle.

Citation Information

Cited By

  • Steel coil longitudinal cutting line surface defect positioning method and system

    CN120355782A

  • Wafer defect detection method and device and medium

    CN120765556A

  • Connection point defect identification method and device based on visual inspection, equipment and medium

    CN120782771A

  • Lightning rod deformation detection method, system and device and readable storage medium

    CN121025996A

  • A lightning rod shape change detection method, system, device and readable storage medium

    CN121025996B