A method and system for locating the center of hexagonal fittings based on an improved PidiNet
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]本申请的目的在于提供一种基于改进PidiNet的六边形金具中心定位方法及系统,以解决或缓解上述现有技术中存在的问题
本申请实施例提供的基于改进PidiNet的六边形金具中心定位方法中,首先,根据获取的图像样本数据集,对预先构建的PidiNet-SCA模型进行训练;然后,对待检测六边形金具图像进行霍夫圆检测,并基于待检测六边形金具的霍夫定位数据对待检测六边形金具图像进行分割,得到待检测六边形金具的截取子图;并对待检测六边形金具的截取子图依次进行蒙板过滤、像素值过滤和图像腐蚀,得到待检测六边形金具的去躁子图;接着,对待检测六边形金具的去躁子图进行霍夫直线检测,并根据霍夫直线检测的输出直线的斜率,将输出直线划分为3类;最后,根据3类输出直线中任意两类和霍夫定位数据,确定待检测六边形金具的定位中心点。籍以,通过霍夫圆检测进行初定为,再通过蒙板过滤、像素值过滤和图像腐蚀去除噪声,使用霍夫直线检测定位六边形变现,通过斜率将变现分类,并基于边线的平均霍夫点计算六边形的中心点,实现针对六边形金具边缘图像的六边形中心定位,在此过程中,受光照条件影响小,使得能够在复杂光照条件下具有更高的鲁棒性。
Smart Images

Figure CN118823102B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of detection technology, and in particular to a method and system for locating the center of hexagonal fittings based on an improved PidiNet. Background Technology
[0002] On power transmission lines, hardware components (such as bolts and nuts) are exposed to the outdoor environment and are susceptible to loosening and damage due to long-term temperature changes and harsh weather. To ensure the safe operation of power transmission lines, regular inspections of the lines and hardware components are necessary.
[0003] Traditional inspection of power transmission line hardware requires operators to climb onto the live line and tighten each hardware component one by one to the specified torque. During this process, personnel must also cope with complex weather conditions, making it a dangerous high-altitude operation. Furthermore, manual inspection is prone to oversights and delays, potentially failing to detect loose or damaged nuts in a timely manner, thus leading to power transmission line faults. Summary of the Invention
[0004] The purpose of this application is to provide a method and system for locating the center of hexagonal fittings based on an improved PidiNet, so as to solve or alleviate the problems existing in the prior art.
[0005] To achieve the above objectives, this application provides the following technical solution: This application provides a method for locating the center of a hexagonal fitting based on an improved PidiNet, comprising: step S101, obtaining an image of the hexagonal fitting to be detected based on the improved PidiNet-SCA model; step S102, performing Hough circle detection on the fitting image, and segmenting the fitting image based on the Hough positioning data of the hexagonal fitting to be detected to obtain a cropped sub-image of the hexagonal fitting to be detected; wherein, the Hough positioning data includes: Hough circle center coordinates and Hough radius; step S103. Perform mask filtering, pixel value filtering, and image erosion sequentially on the cropped sub-image of the hexagonal fitting to be detected to obtain a denoising sub-image of the hexagonal fitting to be detected; Step S104. Perform Hough line detection on the denoising sub-image of the hexagonal fitting to be detected, and divide the output lines into 3 categories according to the slope of the output lines of the Hough line detection; Step S105. Determine the positioning center point of the hexagonal fitting to be detected based on any two of the 3 categories of output lines and the Hough positioning data.
[0006] Preferably, in step S101, the compact spatial attention module (CSAM) of the PidiNet model is replaced with a snake-shaped convolutional attention module (SCAM) to obtain the PidiNet-SCA model; wherein, in the snake-shaped convolutional attention module (SCAM), a first convolutional unit, a second convolutional unit, and a sigmoid function are sequentially concatenated after the ReLU activation function, and the input features of the snake-shaped convolutional attention module (SCAM) are multiplied by the output features of the sigmoid function to obtain the output features of the snake-shaped convolutional attention module (SCAM); wherein, the first convolutional module has 1 channel, including the concatenated... Convolution and Convolution; the second convolution module includes concatenated... directional serpentine convolution and Oriented serpentine convolution, and the directional serpentine convolution, the The input and output of the directional serpentine convolution are added together.
[0007] Preferably, in step S102, the segmentation of the hardware image based on the Hough positioning data of the hexagonal hardware to be detected to obtain a cropped sub-image of the hexagonal hardware to be detected specifically involves: based on the hardware image, expanding the size by 1.25 times the initial radius to obtain a square region centered on the Hough center coordinates of the hexagonal hardware to be detected, which is the segmented region of the cropped sub-image.
[0008] Preferably, in step S104, the output straight line is determined based on the Hough line detection. The two Hof points on Calculate the output straight line slope ;in, , All are positive integers. ; Traverse the slopes of all the output lines, and calculate the slope of each output line relative to each assumed slope in the assumed slope set. One-dimensional Manhattan distance Wherein, the assumed slope , This is the maximum absolute value of the slopes of all the output lines. The minimum absolute value of the slope of all the output lines; based on the assumed slope of each output line. One-dimensional Manhattan distance The slope corresponding to the minimum value is used to determine each of the assumed slopes. The corresponding number of slopes; the output lines corresponding to the three assumed slopes with a non-zero number of slopes are divided into three categories.
[0009] Preferably, in step S105, the traversal The x-coordinate of the point with the smaller x-coordinate value in each of the output lines described in the class. ,Sure The x-coordinate in the output line of the class minimum point and maximum point ;in, ; calculate The output line described above does not include the minimum point. The maximum value point The output lines are respectively connected to the minimum point. The maximum value point distance According to distance ,Will The output line described in the class is divided into Linear and Linear type; calculate separately In the output line of the class, the Straight lines and the aforementioned The average value of the Hough points of the linear-like structure is obtained accordingly. Two average Hough points of similar straight lines and stated Two mean Hough points of a straight line Based on the average Hough points of any two of the three types of output lines, the coordinates of the center point of the hexagonal fitting to be detected in the denoising subgraph are determined. Positioning is performed based on the Hough positioning data and the center point coordinates. The coordinates of the center point of the detected hexagonal fitting in the noise reduction sub-graph are set. The location center point of the hexagonal hardware to be detected in the hardware image is obtained by mapping the image onto the hardware image.
[0010] Preferably, the coordinates of the center point of the hexagonal fitting to be detected in the denoising subgraph are determined based on the average Hough points of any two of the three types of output lines. Positioning includes: determining the center of the three types of output lines. The output line of the class is the same as Whether the output lines described in the class intersect; ,and Not equal; responding to The output line of the class is the same as If the output lines of the class intersect, then it is determined. The output line of the class is the same as The coordinates of the midpoint of the line connecting the two intersection points of the output straight line are the coordinates of the center point of the hexagonal fitting to be tested in the noise reduction sub-graph. .
[0011] Preferably, the determination of the three types of output lines... The output line of the class is the same as Whether the output lines of the class intersect includes: according to The average Hough point of the output line described above and The average Hough point of the output line described above According to the formula: Sure The intersection judgment condition of the output lines described above and The intersection judgment condition of the output lines described above ; in response to Then determine The output line of the class is the same as The output lines of the class intersect.
[0012] Preferably, according to the formula: The coordinates of the center point of the detected hexagonal hardware in the noise reduction subgraph. Mapping the hexagonal hardware to be detected onto the hardware image, the positioning center point of the hexagonal hardware to be detected in the hardware image is obtained. ;in, The coordinates of the center of the Hough circle are given. Let Hough radius be the radius of Hough.
[0013] This application embodiment also provides a hexagonal fitting center localization system based on an improved PidiNet, comprising: a model detection unit configured to obtain a fitting image of a hexagonal fitting to be detected based on an improved PidiNet-SCA model; a first image processing unit configured to perform Hough circle detection on the fitting image and segment the fitting image based on the Hough localization data of the hexagonal fitting to be detected to obtain a cropped sub-image of the hexagonal fitting to be detected; wherein, the Hough localization data includes: Hough circle center coordinates and Hough radius; a second... The image processing unit is configured to sequentially perform mask filtering, pixel value filtering, and image erosion on the cropped sub-image of the hexagonal fitting to be detected to obtain a denoising sub-image of the hexagonal fitting to be detected; the straight line classification unit is configured to perform Hough line detection on the denoising sub-image of the hexagonal fitting to be detected, and classify the output lines into 3 categories according to the slope of the output lines of the Hough line detection; the center positioning unit is configured to determine the positioning center point of the hexagonal fitting to be detected based on any two of the 3 categories of output lines and the Hough positioning data.
[0014] Beneficial effects: The hexagonal fitting center localization method based on the improved PidiNet provided in this application embodiment first trains a pre-constructed PidiNet-SCA model based on the acquired image sample dataset. Then, Hough circle detection is performed on the image of the hexagonal fitting to be detected, and the image of the hexagonal fitting to be detected is segmented based on the Hough localization data of the hexagonal fitting to be detected to obtain a cropped sub-image of the hexagonal fitting to be detected. Then, the cropped sub-image of the hexagonal fitting to be detected is sequentially subjected to mask filtering, pixel value filtering, and image erosion to obtain a denoising sub-image of the hexagonal fitting to be detected. Next, Hough line detection is performed on the denoising sub-image of the hexagonal fitting to be detected, and the output lines are divided into 3 categories according to the slope of the output lines of the Hough line detection. Finally, the localization center point of the hexagonal fitting to be detected is determined based on any two of the 3 categories of output lines and the Hough localization data. Therefore, the hexagonal shape is initially determined by Hough circle detection, and then noise is removed by mask filtering, pixel value filtering and image erosion. Hough line detection is used to locate the hexagonal shape, the shape is classified by slope, and the center point of the hexagon is calculated based on the average Hough points of the edge lines. This achieves the hexagonal center localization for the edge image of the hexagonal hardware. In this process, it is less affected by the lighting conditions, which makes it more robust under complex lighting conditions. Attached Figure Description
[0015] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. Wherein: Figure 1This is a flowchart illustrating a hexagonal fitting center positioning method based on an improved PidiNet, according to some embodiments of this application. Figure 2 This is a schematic diagram of an image of a hexagonal fitting to be inspected according to some embodiments of this application; Figure 3 This is a schematic diagram illustrating Hough circle detection of a hardware image according to some embodiments of this application; Figure 4 This is a schematic diagram of a masked filter provided according to some embodiments of this application; Figure 5 This is a schematic diagram illustrating pixel value filtering according to some embodiments of this application; Figure 6 This is a schematic diagram of image erosion provided according to some embodiments of this application; Figure 7 This is a schematic diagram illustrating the classification of output lines according to some embodiments of this application; Figure 8 This is a schematic diagram illustrating the intersection of two types of output lines according to some embodiments of this application; Figure 9 This is a schematic diagram showing the center positioning of a hexagonal fitting to be tested according to some embodiments of this application; Figure 10 This is a schematic diagram of the structure of a hexagonal fitting center positioning system based on an improved PidiNet, according to some embodiments of this application. Detailed Implementation
[0016] The present application will now be described in detail with reference to the accompanying drawings and embodiments. Various examples are provided by way of explanation and not by way of limitation. In fact, those skilled in the art will understand that modifications and variations can be made to the present application without departing from the scope or spirit of the present application. For example, a feature shown or described as part of one embodiment may be used in another embodiment to produce yet another embodiment. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention should fall within the scope of protection of the embodiments of the present invention.
[0017] The trend in fitting inspection is to replace manual inspection with robots that can be used to fasten or disassemble power line fittings. To achieve regular inspection of power fittings by robots, the first problem to be solved is to determine the center position of the fitting.
[0018] Based on this, this application proposes a method for center localization of hexagonal fittings based on PidiNet. Using a constructed PidiNet-SCA model, the output image of the hexagonal fitting to be detected is obtained. The output image is then initially localized using Hough circle detection, followed by noise removal through masking, pixel value filtering, and image erosion. Next, Hough line detection is used to locate the hexagonal edges of the fitting, and the edges are classified by slope. The center point of the hexagon is calculated based on the average Hough points of the edges, thus achieving hexagonal center localization for the edge image of the hexagonal fitting. In this way, a deep learning edge detection model is used for hexagonal fitting center localization. Based on the geometric relationships of the hexagon, the output image of the PidiNet-SCA model is post-processed, and the edge lines of the hexagonal fitting are located using Hough line detection. The coordinates of the center point of the hexagonal fitting are calculated based on the geometric properties of the hexagon. Compared with traditional edge detection models, this method has less noise, is less affected by lighting conditions, and is easier to accurately locate under complex lighting conditions.
[0019] like Figures 1 to 9 As shown, this hexagonal fitting center localization method based on improved PidiNet includes: Step S101: Based on the improved PidiNet-SCA model, obtain the image of the hexagonal fitting to be detected.
[0020] In this application, the Compact Spatial Attention Module (CSAM) of the PidiNet model is replaced with the Serpentine Convolutional Attention Module (SCAM), resulting in the PidiNet-SCA model. In the Serpentine Convolutional Attention Module (SCAM), a first convolutional unit, a second convolutional unit, and a sigmoid function are sequentially concatenated after the ReLU activation function. The input features of the Serpentine Convolutional Attention Module (SCAM) are multiplied by the output features of the sigmoid function to obtain the output features of the Serpentine Convolutional Attention Module (SCAM). The first convolutional module has one channel, including the concatenated... Convolution and Convolution; the second convolutional module includes concatenated... directional serpentine convolution and Oriented serpentine convolution, and directional serpentine convolution, The input and output of the directional serpentine convolution are added together.
[0021] In other words, the snake-shaped attention module receives input features (number of channels). After that, the ReLU activation function is first used to increase the nonlinearity of the network to prevent gradient vanishing; then, a series of... Convolution and Convolution is used to change the number of channels (resulting in a channel count of 1) and improve the module's learning ability; then, these are concatenated sequentially. directional serpentine convolution, Oriented serpentine convolutions, and concatenated directional serpentine convolution, The directional serpentine convolution also performs short-circuiting, meaning the input and output of the serpentine convolution are added together to prevent overfitting. The features are then mapped to the range of 0 to 1 using the sigmoid function, resulting in a single-channel model with a value range of [value range missing]. The feature is then multiplied by the input feature to obtain the output feature.
[0022] In this application, the improved PidiNet-SCA model is trained using the publicly available datasets BSDS500 and PASCAL-VOC. The number of data samples (samples) passed to the PidiNet-SCA model for training in a single iteration is set to 1, and a dynamic learning rate is used. Specifically, the initial learning rate is set to 0.005, and it is multiplied by 0.1 at the beginning of the 12th and 16th iterations. The Adam algorithm based on adaptive moment estimation is selected as the optimizer, and the number of iterations for training the PidiNet-SCA model is set to 20.
[0023] The trained PidiNet-SCA model utilizes multiple feature extraction modules to extract features from the input image (i.e., the original image of the hexagonal hardware to be detected) through differential convolution. The features extracted by each feature extraction module are sequentially processed through a compact dilated convolution module, a serpentine spatial attention module, and a... Convolution is used to enhance the extracted features; then, the enhanced features are fused by the feature fusion module to obtain the output image (i.e., the image of the hexagonal fitting to be detected).
[0024] The PidiNet-SCA model's backbone consists of four differential convolutional groups, each containing four differential convolutions, used to extract edge features from the input image; a compact dilated convolutional module is used to extract features with multiple receptive fields of different sizes; a serpentine spatial attention module is used to better identify important regions in the features spatially and suppress unimportant regions; and a 1×1 convolution is used to change the number of channels, reducing the number of channels in all four feature layers to 1. Then, the four normalized features are concatenated, resulting in a feature with 4 channels, and the concatenated feature is further adjusted to have 1 channel using a 1×1 convolution. Finally, the sigmoid function is used to map the features to the interval (0,1).
[0025] Step S102: Perform Hough circle detection on the hardware image, and segment the hardware image based on the Hough positioning data of the hexagonal hardware to be detected to obtain the cropped sub-image of the hexagonal hardware to be detected.
[0026] The hexagonal hardware has a circular texture along its edges. Based on this, this application uses Hough circle detection to initially locate the hardware image and separate the hexagonal hardware from the background. Specifically, the `cv2.HoughCircles` function in the OpenCV framework is used for Hough circle detection. The minimum distance to the center is set to 100, the gradient threshold is set to 50, the accumulator threshold for the center and radius is set to 90, and the minimum radius of the detected circle is set to 100. `cv2.HoughCircles` outputs the center coordinates (Hough circle center coordinates) and radius (Hough radius) of the circle. Then, the hardware image is segmented using the Hough center coordinates and the Hough radius. Specifically, based on the hardware image, an expansion size of 1.25 times the initial radius is used to obtain a square region centered on the Hough center coordinates of the hexagonal hardware to be detected. This square region is the segmentation area for the cropped sub-image. In other words, starting from the Hough center coordinates, the Hough radius is expanded by 1.25 times in four directions (up, down, left, and right) to form a square region centered on the Hough center coordinates, thus segmenting the hexagonal hardware to be detected from the background and obtaining the cropped sub-image.
[0027] Step S103: The cropped sub-image of the hexagonal hardware to be tested is sequentially subjected to mask filtering, pixel value filtering and image erosion to obtain the denoising sub-image of the hexagonal hardware to be tested.
[0028] In the cropped sub-image, circular textures and fine textures outside the hexagons are considered noise and need to be removed to enhance reliability. Specifically, during masking filtering, the geometric properties of hexagons are utilized to remove noise through a ring-shaped mask. This ring-shaped mask has the same width and height as the cropped sub-image. The inner ring radius of the mask is 0.9 times the radius of the Hough circle, and the outer ring radius is 1.2 times the radius of the Hough circle. Both the inner and outer rings are centered on the Hough circle.
[0029] The edge images output by deep learning edge detection are characterized by "low noise pixel values and high edge pixel values." Pixel values in the cropped sub-image are filtered by setting pixels with values below 190 to zero. When performing image erosion on the cropped sub-image, the `cv2.erode` function from the OpenCV framework is used to effectively remove white noise. The kernel size for the erosion operation is... The number of iterations is 1.
[0030] Step S104: Perform Hough line detection on the noise reduction map of the hexagonal fitting to be tested, and classify the output lines into 3 categories based on the slope of the output lines of the Hough line detection.
[0031] After removing image noise, the cv2.HoughLines function under the OpenCV framework is used to perform Hough line detection on the denoised sub-image, where the minimum line length is set to 70. For the two points (Hough points) on the output line of the Hough line detection, the coordinates of the Hough points of similar lines are relatively small. Therefore, in this application, Hough points are used as a tool for classifying the output lines.
[0032] Specifically, based on the output line of the Hough line detection... The two Hof points on Calculate and output a straight line slope ;in, , All are positive integers. According to the formula: Determine the output line slope .
[0033] According to the geometric properties of hexagons, opposite sides of a hexagon are parallel. Therefore, the slope of the sides of a hexagon has three possible values. ). From the output straight line slope It can be seen that, regardless of the angle of the hexagonal fitting being inspected during image capture, there are always two slopes among the three that result in a pair of non-strictly opposite numbers, i.e., opposite numbers that are positive and negative but have similar absolute values. In this application, all output straight lines are calculated. slope absolute value And find the absolute value. The maximum and minimum values are defined as follows: .Will Set as assumed slope This serves as the basis for classifying the output lines. Specifically, it iterates through the slopes of all output lines, calculating the slope of each output line relative to each assumed slope in the assumed slope set. One-dimensional Manhattan distance Among them, according to the formula: Determine the output line With the assumed slope One-dimensional Manhattan distance .
[0034] Then, based on each output line and the assumed slope One-dimensional Manhattan distance The size of each assumed slope is determined. The corresponding slope. This will output the line and the assumed slope. One-dimensional Manhattan distance The slope corresponding to the minimum value is added to the category of the corresponding assumed slope.
[0035] Traversing the slope Then, the four assumed slopes correspond to... The slopes are shown in Table 1: Table 1. Number of slopes corresponding to assumed slopes Furthermore, the output lines corresponding to the three assumed slopes with non-zero slope values are divided into three categories. That is, from... Find the zero value in the equation. The assumed slope corresponding to the zero value is the non-existent slope. The opposite of the non-existent slope is the real slope. Thus, the classification of the three slopes of the hexagon is completed, that is, the output line is divided into 3 categories.
[0036] Step S105: Determine the positioning center point of the hexagonal fitting to be tested based on any two of the three types of output lines and the Hough positioning data.
[0037] After excluding the assumed slope with a slope of zero and its opposite, the remaining two assumed slopes are real slopes and are opposites of each other. Either of the two assumed slopes can achieve the centering of the hexagonal fitting. Based on the parallel relationship of opposite sides of the hexagon, the slope multiple is classified as follows: Class or There are four types of output lines for this class. In this application, they are classified according to their slope as follows: Class and The output line of the class determines the positioning center point of the hexagonal hardware to be detected, and the redundant output lines are filtered out based on the Hough positioning data obtained from the Hough line detection.
[0038] Specifically, first, traversal The x-coordinate of the point with the smaller x-coordinate value in each output line of the class output line. ,Sure Class outputs the x-coordinate of the line minimum point and maximum point ;in, Then, calculate. The output line does not include the minimum point. Maximum point The output lines are respectively at the minimum point Maximum point distance .
[0039] According to distance ,Will The output line is divided into classes. Linear and Similar to a straight line. If Then the output line will be classified as Class, if Then the output line will be classified as Class. Among them, Linear and Lines are parallel, but... Linear or Within each class of lines, the output lines are repeated. Finally, based on the classification, the average Hough points in each class are calculated, and the hexagonal sides are determined based on the average Hough points. Specifically, the calculation... In the class output line, The average value of the Hough points of the linear-like structure is obtained as follows: Two mean Hough points of a straight line .
[0040] Here, according to the formula: Determine the description Two mean Hough points of a straight line In the formula, for The number of output lines in the straight line category. for Output a straight line from a line-like format. The two Hough points. Based on the same theory, determine the calculation... In the class output line, The average value of the Hough points of the linear-like structure is obtained as follows: Two mean Hough points of a straight line .
[0041] After obtaining the average Hough points of any two of the three types of output lines, the coordinates of the center point of the hexagonal fitting to be tested in the noise reduction graph are determined based on the intersection of the lines connecting the average Hough points of any two of the three types of output lines. Positioning is then performed. Specifically, first, the midpoint of the three types of output lines is determined. The class outputs a straight line and The class outputs whether the lines intersect, where... ,and They are not equal.
[0042] Here, according to The average Hough point of the output line and The average Hough point of the output line According to the formula: Sure Intersection criteria for output lines and Intersection criteria for output lines .in, express The class outputs any point on the straight line and the average Hough point. The relative positional relationship; express The class outputs any point on the straight line and the average Hough point. The relative positional relationship. When Then determine The class outputs a straight line and The class outputs intersecting lines, determine The class outputs a straight line and The coordinates of the midpoint of the line connecting the two intersection points of the output line are the coordinates of the center point of the hexagonal fitting to be detected in the noise reduction sub-graph. .
[0043] Here, when Then, according to the intersection judgment condition or That will confirm The class outputs a straight line and The class outputs the intersection of the lines. Specifically, according to the formula: Sure The class outputs the line in the line Linear and In the case of straight lines Intersection points of similar lines ,as well as The class outputs the line in the line Linear and In the case of straight lines Intersection points of similar lines .
[0044] According to the formula: Sure The class outputs a straight line and The class outputs the coordinates of the midpoint of the line connecting the two intersection points of the straight line, which is the coordinate of the center point of the hexagonal fitting to be detected in the noise reduction image. .
[0045] Finally, according to the formula: The coordinates of the center point of the hexagonal fitting in the noise reduction diagram will be detected. Mapping the hexagonal hardware to be detected onto the hardware image yields the location center point within the hardware image. In the formula, Let Hough's center coordinates be the coordinates of the circle. Let Hough radius be denoted as .
[0046] Therefore, a deep learning edge detection model is used to locate the center of a hexagonal fitting. Based on the geometric relationship of the hexagon, the output image of the PidiNet-SCA model is post-processed, and the edge line of the hexagonal fitting is located using Hough line detection. The center point coordinates of the hexagonal fitting to be detected are calculated according to the geometric properties of the hexagon. Compared with the traditional edge detection model, it has less noise, is less affected by lighting conditions, and is easy to accurately locate under complex lighting conditions.
[0047] like Figure 10 As shown, this application embodiment also provides a hexagonal fitting center localization system based on improved PidiNet, including: a model detection unit 1001, configured to be based on the improved PidiNet-SCA model, to obtain the fitting image of the hexagonal fitting to be detected; The first image processing unit 1002 is configured to perform Hough circle detection on the hardware image and segment the hardware image based on the Hough positioning data of the hexagonal hardware to be detected to obtain a cropped sub-image of the hexagonal hardware to be detected; wherein, the Hough positioning data includes: Hough circle center coordinates and Hough radius; The second image processing unit 1003 is configured to sequentially perform mask filtering, pixel value filtering and image erosion on the cropped sub-image of the hexagonal hardware to be detected, so as to obtain a denoising sub-image of the hexagonal hardware to be detected. The line classification unit 1004 is configured to perform Hough line detection on the noise-reducing sub-image of the hexagonal fitting to be detected, and classify the output line into 3 categories based on the slope of the output line of the Hough line detection. The central positioning unit 1005 is configured to determine the positioning center point of the hexagonal fitting to be tested based on any two of the three types of output straight lines and Hough positioning data.
[0048] The hexagonal fitting center positioning system based on the improved PidiNet provided in this application can realize the steps and processes of any of the above-described embodiments of the hexagonal fitting center positioning method based on the improved PidiNet, and achieve the same technical effect, which will not be repeated here.
[0049] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0050] In this invention, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to a specific feature, structure, material, or characteristic described in connection with that embodiment or example, which is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0051] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for locating the center of a hexagonal fitting based on an improved PidiNet, characterized in that, include: Step S101: Based on the improved PidiNet-SCA model, obtain the image of the hexagonal hardware to be detected; wherein, the compact spatial attention module CSAM of the PidiNet model is replaced with a serpentine convolutional attention module SCAM to obtain the PidiNet-SCA model; in the serpentine convolutional attention module SCAM, a first convolutional unit, a second convolutional unit, and a sigmoid function are sequentially concatenated after the ReLU activation function, and the input features of the serpentine convolutional attention module SCAM are multiplied by the output features of the sigmoid function to obtain the output features of the serpentine convolutional attention module SCAM; wherein, the number of channels of the first convolutional unit is 1, including the concatenated... Convolution and Convolution; the second convolutional module includes concatenated... directional serpentine convolution and Oriented serpentine convolution, and the directional serpentine convolution, the The input and output of a directional serpentine convolution are added together; Step S102: Perform Hough circle detection on the hardware image, and segment the hardware image based on the Hough positioning data of the hexagonal hardware to be detected to obtain a cropped sub-image of the hexagonal hardware to be detected; wherein, the Hough positioning data includes: Hough circle center coordinates and Hough radius; Step S103: Perform mask filtering, pixel value filtering and image erosion sequentially on the cropped sub-image of the hexagonal hardware to be detected to obtain the denoising sub-image of the hexagonal hardware to be detected. Step S104: Perform Hough line detection on the noise reduction image of the hexagonal fitting to be tested, and classify the output lines into 3 categories based on the slope of the output lines of the Hough line detection; wherein, the output lines based on the slope of the output lines of the Hough line detection... The two Hof points Calculate the output straight line slope ; Traverse the slopes of all the output lines, and calculate the slope of each output line relative to each assumed slope in the assumed slope set. One-dimensional Manhattan distance Wherein, the assumed slope , This is the maximum absolute value of the slopes of all the output lines. The minimum absolute value of the slope of all the output lines; based on the assumed slope of each output line. One-dimensional Manhattan distance The slope corresponding to the minimum value is used to determine each of the assumed slopes. The corresponding number of slopes; the output lines corresponding to the three assumed slopes with a non-zero number of slopes are divided into three categories. Step S105: Determine the positioning center point of the hexagonal fitting to be tested based on any two of the three types of output lines and the Hough positioning data; Among them, traversal The x-coordinate of the point with the smallest x-coordinate value in each of the output lines described in the class. ,Sure The x-coordinate in the output line of the class minimum point and maximum point ;calculate The output line described above does not include the minimum point. The maximum value point The output lines are respectively connected to the minimum point. The maximum value point distance According to distance ,Will The output line described in the class is divided into Linear and Linear type; calculate separately In the output line of the class, the Straight lines and the aforementioned The average value of the Hough points of the linear-like structure is obtained accordingly. Two average Hough points of similar straight lines and stated Two mean Hough points of a straight line ; Determine the middle of the three types of output lines The output line of the class is the same as Whether the output lines of the class intersect; in response to The output line of the class is the same as If the output lines of the class intersect, then it is determined. The output line of the class is the same as The coordinates of the midpoint of the line connecting the two intersection points of the output straight line are the coordinates of the center point of the hexagonal fitting to be tested in the noise reduction sub-graph. ; According to the formula: The coordinates of the center point of the detected hexagonal hardware in the noise reduction sub-graph Mapping the hexagonal hardware to be detected onto the hardware image, the positioning center point of the hexagonal hardware to be detected in the hardware image is obtained. ; The coordinates of the center of the Hough circle are given. Let Hough radius be the radius of Hough. , All are positive integers. ,and They are not equal.
2. The hexagonal fitting center positioning method based on improved PidiNet according to claim 1, characterized in that, In step S102, the segmentation of the hardware image based on the Hough localization data of the hexagonal hardware to be detected to obtain a cropped sub-image of the hexagonal hardware to be detected is specifically as follows: Based on the image of the hardware, a square region centered on the Hough center coordinates of the hexagonal hardware to be detected is obtained by expanding the size by 1.25 times the initial radius, which is the segmentation region of the cropped sub-image.
3. The hexagonal fitting center positioning method based on the improved PidiNe according to claim 1, characterized in that, The determination of the three types of output lines The output line of the class is the same as Whether the output lines of the class intersect include: according to The average Hough point of the output line described above and The average Hough point of the output line described above According to the formula: Sure The intersection judgment condition of the output lines described above and The intersection judgment condition of the output lines described above ; In response to Then determine The output line of the class is the same as The output lines of the class intersect.
4. A hexagonal fitting center positioning system based on an improved PidiNet, characterized in that, Determining the positioning center point of the hexagonal fitting to be tested using the improved PidiNet-based hexagonal fitting center positioning method as described in any one of claims 1-3 includes: The model detection unit is configured to use an improved PidiNet-SCA model to obtain the image of the hexagonal fitting to be detected. The first image processing unit is configured to perform Hough circle detection on the hardware image and segment the hardware image based on the Hough positioning data of the hexagonal hardware to be detected to obtain a cropped sub-image of the hexagonal hardware to be detected; wherein, the Hough positioning data includes: Hough circle center coordinates and Hough radius; The second image processing unit is configured to sequentially perform mask filtering, pixel value filtering, and image erosion on the cropped sub-image of the hexagonal hardware to be detected, so as to obtain a denoising sub-image of the hexagonal hardware to be detected. The straight line classification unit is configured to perform Hough line detection on the noise-reducing sub-image of the hexagonal fitting to be detected, and classify the output line into 3 categories according to the slope of the output line of the Hough line detection. The central positioning unit is configured to determine the positioning center point of the hexagonal fitting to be tested based on any two of the three types of output lines and the Hough positioning data.
Citation Information
Patent Citations
Steel structure bolt loosening rapid identification method
CN115035046A
Pathological image hash retrieval method based on snakelike convolution multi-scale pooling and norm attention mechanism
CN117789934A