A bogie bolt loosening detection method based on series steel wire
By using an improved YOLOv8 model and U-net network to identify figure-eight series anti-loosening steel wires, combined with skeleton extraction and curvature calculation, the problems of low efficiency and insufficient accuracy in bolt loosening detection in existing technologies are solved, achieving efficient and accurate bolt loosening detection.
Patent Information
- Application Number
- CN202411695967.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-11-25
AI Technical Summary
Current technologies for detecting bolt loosening rely on manual inspection, which is inefficient and susceptible to environmental interference. Furthermore, traditional deep learning methods have low detection accuracy and cannot identify loosening situations when the bolt rotation angle is exactly one revolution.
An improved YOLOv8 bolt area detection model is used to identify the area where the figure-eight series anti-loosening steel wires are connected. The U-net network is used to determine whether the area includes both sides of the figure-eight anti-loosening steel wires. Binarization and skeleton extraction are performed, and the included angle and curvature are calculated to determine the bolt looseness.
It improves the identification accuracy and reliability of bolt loosening detection, reduces missed detections and false detections, enhances the robustness and stability of detection, and ensures accurate judgment of bolt loosening in complex environments.
Smart Images

Figure CN119540209B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of rail transit inspection technology, specifically to a method for detecting loose bogie bolts based on series steel wires. Background Technology
[0002] The bogie is a crucial component of a train, playing a vital role in its safe operation, stability, and passenger comfort. Bolts are essential components connecting the various parts of the bogie; loosening or loss directly impacts the train's stability and smooth operation. However, current bolt loosening detection largely relies on manual inspection, which is labor-intensive, inefficient, and susceptible to environmental interference. Therefore, a method to replace manual loosening detection is needed to improve efficiency and reliability of train maintenance. Existing non-manual bolt loosening detection methods utilize deep learning, often based on anti-loosening lines. A bolt is considered loose when the angles of two anti-loosening lines deviate. However, this method has a limitation: when the bolt rotates exactly one full turn and the two anti-loosening lines overlap again, the loosening cannot be detected. Summary of the Invention
[0003] To address the aforementioned shortcomings in existing technologies, this invention provides a bogie bolt loosening detection method based on series steel wires, which solves the problems of large workload, low efficiency, and susceptibility to environmental interference in manual inspection in existing technologies, as well as the problem of low detection accuracy in traditional deep learning methods.
[0004] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows:
[0005] A method for detecting loose bogie bolts based on series steel wires includes the following steps:
[0006] S1. Use the improved YOLOv8 bolt area detection model to identify the area where the figure-eight series anti-loosening steel wire series bolts are located;
[0007] S2. Input the area where the figure-eight anti-loosening steel wire and the series bolt are located into the trained U-net network for recognition, and determine whether the output result of the trained U-net network is an image containing both sides of the figure-eight anti-loosening steel wire. If so, proceed to step S3; otherwise, the output is abnormal.
[0008] Among them, the two sides of the figure-eight anti-loosening steel wire have two lines of different colors, namely the first color line and the second color line;
[0009] S3. Perform binarization on the image containing both sides of the figure-eight anti-loosening steel wire to obtain a binarized image containing both sides of the figure-eight anti-loosening steel wire, and extract the skeleton by removing the edge part of the color line to obtain the first single pixel line and the second single pixel line.
[0010] S4. Calculate the angle between the first single-pixel line and the second single-pixel line, and determine whether the angle is less than the set threshold. If it is, output an error; otherwise, proceed to step S5.
[0011] S5. Extract the interval pixels in the first single pixel line and perform a Cartesian coordinate transformation. By fitting the interval pixels in Cartesian coordinates, obtain the interval pixel fitting curve.
[0012] S6. Select the curve segments of the fitted curve between the first curve coordinate value interval and the second curve coordinate value interval to obtain the first curve segment and the second curve segment. Calculate the curvature of each interval pixel point within the first curve segment and the second curve segment to obtain the curvature value of each interval pixel point. Determine whether the maximum curvature value is greater than the standard curvature. If so, the bolt is loose; otherwise, the bolt is not loose.
[0013] Furthermore, step S1 specifically includes:
[0014] S11. Obtain the image dataset of the tandem wire metro bogie bolts, and use annotation software to annotate the label data of the tandem wire metro bogie bolt image data to obtain the labeled tandem wire metro bogie bolt image dataset.
[0015] The label data indicates the area where the figure-eight series anti-loosening steel wire series bolts are located;
[0016] S12. Introduce a structural reparameterization feature reuse module and a downsampling convolutional layer at the backbone network end to construct an improved YOLOv8 bolt region detection model.
[0017] Among them, the structural reparameterization feature reuse module is used to fuse feature maps from different layers or scales to achieve feature reuse;
[0018] Downsampling convolutional layers are used to reduce the width and height of feature maps, thereby reducing image resolution;
[0019] S13. Input the labeled series of wire metro bogie bolt image datasets into the improved YOLOv8 bolt region detection model for training, and obtain the trained improved YOLOv8 bolt region detection model, which is used to identify the region where the figure-eight series anti-loosening wire series bolts are located.
[0020] Furthermore, the improved YOLOv8 bolt region detection model includes a backbone network end, a neck network end, and a head network end;
[0021] The backbone network includes a first convolutional layer, a second convolutional layer, a first structure reparameterized feature reuse module, a first downsampling convolutional layer, a second structure reparameterized feature reuse module, a second downsampling convolutional layer, a third structure reparameterized feature reuse module, a third downsampling convolutional layer, a fourth structure reparameterized feature reuse module, and a multi-scale feature aggregation pyramid module.
[0022] The neck network includes a first upsampling module, a first connection module, a first residual connection module, a second upsampling module, a second connection module, a second residual connection module, a third convolutional layer, a third connection module, a third residual connection module, a fourth convolutional layer, a fourth connection module, and a fourth residual connection module;
[0023] The head network includes a large detection head, a medium detection head, and a small detection head.
[0024] Furthermore, step S13 specifically includes:
[0025] S131. Input the labeled series steel wire subway bogie bolt image dataset into the backbone network of the improved YOLOv8 bolt region detection model for feature extraction to obtain feature maps at different scales.
[0026] S132. Input feature maps of different scales into the neck network of the improved YOLOv8 bolt region detection model for feature fusion to obtain fused features of different scales.
[0027] S133. Input the fusion features of different scales into the head network of the improved YOLOv8 bolt region detection model to identify the region where the figure-eight series anti-loosening steel wire series bolts are located, and obtain the trained improved YOLOv8 bolt region detection model, which is used to identify the region where the figure-eight series anti-loosening steel wire series bolts are located.
[0028] Furthermore, step S3 specifically includes:
[0029] S31. The Ostu threshold segmentation method is used to binarize the image containing both sides of the figure-eight anti-loosening steel wire to obtain a binarized image containing both sides of the figure-eight anti-loosening steel wire.
[0030] S32. Extract the skeleton from the binarized image containing the two sides of the figure-eight anti-loosening steel wire, and obtain the first single-pixel line and the second single-pixel line by removing the edge part of the color line.
[0031] Furthermore, step S31 specifically includes:
[0032] S311. Calculate the zero-order matrix of the gray-level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.:
[0033]
[0034] Where k represents the range of gray values of pixels in the gray-level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i represents the gray value of the pixel, zeroCM represents the zero-order matrix, and zeroCM(k) represents the cumulative sum of the zero-order matrix, that is, the cumulative sum of the normalized gray-level histogram from gray value 0 to k. I The histogram represents the normalized grayscale histogram of the image containing both sides of the figure-eight anti-loosening wire. I (i) represents the proportion of pixels with gray value i in the normalized gray histogram;
[0035] S312. Calculate the first-order cumulative matrix of the gray-level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.:
[0036]
[0037] Where oneCM represents the first-order cumulative matrix, and oneCM(k) represents the cumulative sum of the first-order cumulative matrix;
[0038] S313. Calculate the average gray level of the gray level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, that is:
[0039] mean = oneCM(255)
[0040] Where mean represents the average value;
[0041] S314. Calculate the variance of the grayscale histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.:
[0042]
[0043] Where, σ 2 Indicates variance;
[0044] S315. Based on the variance of the grayscale histogram of the image containing the two sides of the figure-eight anti-loosening steel wire, select the largest variance and use the grayscale value corresponding to the largest variance as the threshold for Ostu threshold segmentation to binarize the image containing the two sides of the figure-eight anti-loosening steel wire, and obtain the binarized image containing the two sides of the figure-eight anti-loosening steel wire.
[0045] Furthermore, step S32 specifically includes:
[0046] S321. Divide the pixels to be processed and number them as P1;
[0047] S322. Obtain 8 neighboring pixels centered on the pixel to be processed. The 8 neighboring pixels of the pixel to be processed are located above, upper right, right, lower right, lower, lower left, left, and upper left of the pixel to be processed, respectively, and are numbered P2, P3, P4, P5, P6, P7, P8, and P9.
[0048] S323. Determine whether the eight neighboring pixels of the pixel to be processed meet the first deletion condition or the second deletion condition. If so, delete the pixel to be processed; otherwise, keep the pixel to be processed.
[0049] S324. Repeat steps S321-S323 until there are no more pixels to be removed in the temporary image, thus completing the removal process of the edge part and obtaining a number of first single pixels and a number of second single pixels.
[0050] The first deletion condition is:
[0051]
[0052] The second deletion condition is:
[0053]
[0054] Where N represents the number of non-zero numbers among the 8 neighboring pixels of the pixel to be processed, and N(1) represents the number of changes from 0 to 1 when the 8 neighboring pixels of the pixel to be processed are in order;
[0055] S325. Fit several first single-pixel points to obtain a first single-pixel line, and simultaneously fit several second single-pixel points to obtain a second single-pixel line.
[0056] Furthermore, the formula for calculating the angle between the first single-pixel line and the second single-pixel line in step S4 is as follows:
[0057]
[0058] Where θ represents the angle between the first and second single-pixel lines, arctan represents the arctangent function, m1 represents the slope of the first single-pixel line, m2 represents the slope of the second single-pixel line, and x... 12 y 12 Let x and y represent the x and y coordinates of pixel 2 on the first pixel line, respectively. 11 y 11 Let x and y represent the x and y coordinates of pixel 1 on the first pixel line, respectively. 22 y 22 Let x and y represent the x and y coordinates of pixel 2 on the second pixel line, respectively. 21 y 21These represent the x and y coordinates of pixel 1 on the second pixel line, respectively.
[0059] Furthermore, step S5 specifically includes:
[0060] S51. Based on the first single-pixel line, obtain several first single-pixel points of the first single-pixel line;
[0061] S52. Save the first single pixel at each position every 10 first single pixels and call it the interval pixel, to obtain several interval pixels and their coordinates;
[0062] S53. Transform the coordinates of several interval pixels to a Cartesian coordinate system to obtain several interval pixels in a Cartesian coordinate system;
[0063] S54. Fit several interval pixels in the rectangular coordinate system to obtain the interval pixel fitting curve.
[0064] Furthermore, the formula for calculating the curvature of each interval pixel point within the first curve segment and the second curve segment in step S6 is as follows:
[0065]
[0066] Where, k ′ y represents the curvature of each interval pixel point within the first or second curve segment. ′ y represents the first derivative of the first or second curve segment at a certain interval of pixels. ′″ It represents the second derivative of the first or second curve segment at a certain interval of pixels.
[0067] The present invention has the following beneficial effects:
[0068] This invention proposes a bogie bolt loosening detection method based on series-connected steel wires. It utilizes an improved YOLOv8 bolt region detection model to identify the region containing figure-eight series-connected anti-loosening steel wire bolts, significantly improving the accuracy and reliability of the identification and effectively reducing missed and false detections. Simultaneously, a trained U-net network is used to identify whether the region includes the two sides of the figure-eight anti-loosening steel wire, further filtering and improving data accuracy and ensuring precise positioning of the anti-loosening steel wire region during filtering and further identification. Finally, curvature is calculated through skeleton extraction, angle calculation, and curve fitting to determine whether the bogie bolts with series-connected steel wires are loose, improving the accuracy of bolt identification while reducing environmental influences, thus giving the bolt detection strong robustness and stability. Attached Figure Description
[0069] Figure 1This is a schematic flowchart of a bogie bolt loosening detection method based on series steel wires proposed in this invention;
[0070] Figure 2 A schematic diagram showing the area where the figure-eight series anti-loosening steel wire series bolts are located;
[0071] Figure 3 A schematic diagram of the structure of the improved YOLOv8 bolt area detection model;
[0072] Figure 4 A schematic diagram of an image containing the two sides of a figure-eight anti-loosening steel wire for identification;
[0073] Figure 5 This is a schematic diagram showing the positions of the eight neighboring pixels of the pixel to be processed;
[0074] Figure 6 This is a schematic diagram of the skeleton extraction structure;
[0075] Figure 7 This is a schematic diagram of the curve fitting at interval pixels. Detailed Implementation
[0076] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0077] like Figure 1 As shown, a method for detecting loose bogie bolts based on series steel wires includes the following steps S1-S6:
[0078] S1. Use the improved YOLOv8 bolt area detection model to identify the area where the figure-eight series anti-loosening steel wire series bolts are located.
[0079] In this embodiment, the purpose of constructing the improved YOLOv8 bolt area detection model is to accurately identify the area where figure-eight series anti-loosening steel wire bolts are located, with an accuracy rate of 96.7%, significantly improving the reliability of model detection and effectively reducing missed detections and false detections. The model training and recognition process is as follows:
[0080] Specifically, step S1 includes S11-S13:
[0081] S11. Obtain the image dataset of tandem wire metro bogie bolts, and use annotation software to annotate the label data of the tandem wire metro bogie bolt image dataset to obtain a labeled tandem wire metro bogie bolt image dataset.
[0082] The label data indicates the area where the figure-eight series anti-loosening steel wire series bolts are located.
[0083] In this embodiment, an image dataset with a figure-eight series anti-loosening steel wire series bolt area is provided, and the image dataset is labeled with label data using annotation software. The label data is the figure-eight series anti-loosening steel wire series bolt area, resulting in a labeled series steel wire subway bogie bolt image dataset for model training.
[0084] S12. Introduce a structural reparameterization feature reuse module and a downsampling convolutional layer at the backbone network end to construct an improved YOLOv8 bolt region detection model.
[0085] The structure reparameterization feature reuse module is used to fuse feature maps from different layers or scales to achieve feature reuse; the downsampling convolutional layer is used to reduce the width and height of the feature map and reduce the image resolution.
[0086] In this embodiment, the structural reparameterization feature reuse module achieves feature reuse by fusing feature maps from different layers or scales, improving the efficiency and performance of the improved YOLOv8 bolt region detection model. This helps the improved YOLOv8 bolt region detection model capture richer contextual information, thereby improving the accuracy of recognition. The downsampling convolutional layer is used to reduce the width and height of the feature map to reduce its resolution, thereby reducing the amount of computation and allowing the improved YOLOv8 bolt region detection model to capture features at a deeper level.
[0087] The improved YOLOv8 bolt area detection model includes its structure and connection relationships, as follows: Figure 3 As shown, the network consists of a backbone network, a neck network, and a head network. The backbone network is used for feature extraction, the neck network for feature fusion, and the head network is responsible for target detection, including predicting bounding boxes, categories, and confidence levels. The backbone network includes a first convolutional layer, a second convolutional layer, a first structured reparameterized feature reuse module, a first downsampling convolutional layer, a second structured reparameterized feature reuse module, a second downsampling convolutional layer, a third structured reparameterized feature reuse module, a third downsampling convolutional layer, a fourth structured reparameterized feature reuse module, and a multi-scale feature aggregation pyramid module. The neck network includes a first upsampling module, a first connection module, a first residual connection module, a second upsampling module, a second connection module, a second residual connection module, a third convolutional layer, a third connection module, a third residual connection module, a fourth convolutional layer, a fourth connection module, and a fourth residual connection module. The head network includes a large detection head, a medium detection head, and a small detection head.
[0088] S13. Input the labeled series of wire metro bogie bolt image datasets into the improved YOLOv8 bolt region detection model for training, and obtain the trained improved YOLOv8 bolt region detection model, which is used to identify the region where the figure-eight series anti-loosening wire series bolts are located.
[0089] Specifically, step S13 includes S131-S133:
[0090] S131. Input the labeled series steel wire subway bogie bolt image dataset into the backbone network of the improved YOLOv8 bolt region detection model for feature extraction to obtain feature maps at different scales.
[0091] S132. Input feature maps of different scales into the neck network of the improved YOLOv8 bolt region detection model for feature fusion to obtain fused features of different scales.
[0092] S133. Input the fusion features of different scales into the head network of the improved YOLOv8 bolt region detection model to identify the region where the figure-eight series anti-loosening steel wire series bolts are located, and obtain the trained improved YOLOv8 bolt region detection model, which is used to identify the region where the figure-eight series anti-loosening steel wire series bolts are located.
[0093] In this embodiment, the training conditions for the improved YOLOv8 bolt region detection model are as follows: epochs are set to 300, batch size to 4, and learning rate to 0.01. After training, the optimal weight model is automatically saved and used as the model for component detection. This model is used to identify regions with figure-eight anti-loosening steel wires and save the identification results, where the identification results are as follows: Figure 2 As shown.
[0094] S2. Input the area where the figure-eight anti-loosening steel wire and the series bolt are located into the trained U-net network for recognition, and determine whether the output result of the trained U-net network contains the image of both sides of the figure-eight anti-loosening steel wire. If so, proceed to step S3; otherwise, output an error. The two sides of the figure-eight anti-loosening steel wire are two lines of different colors, namely the first color line and the second color line.
[0095] In this embodiment, the U-Net network is selected to identify the area containing the two sides of the figure-eight anti-loosening wire in the region of the series bolt. The purpose is to achieve more accurate target segmentation and improve detection accuracy. After training and optimization, the U-Net network achieves a recognition accuracy of 94.5%, ensuring precise positioning of the anti-loosening wire area during screening and further identification. As a highly efficient image segmentation model, U-Net can accurately extract the edges and details of the target area. In this application, U-Net can accurately segment the two sides of the figure-eight anti-loosening wire, thereby extracting a clear outline and providing reliable data support for subsequent bolt detection and analysis. Using U-Net for region segmentation helps reduce background interference and improve the accuracy of data processing. Bolts and anti-loosening wires are often in complex backgrounds, and traditional detection methods are easily affected by environmental noise. U-Net can efficiently isolate the anti-loosening wire area, excluding irrelevant background parts, significantly improving detection accuracy. Furthermore, the precisely segmented regions lay a solid foundation for subsequent skeleton extraction, angle calculation, and curve fitting, ensuring more accurate feature analysis and aiding in determining bolt loosening conditions. The U-net network was trained on a dataset of bolts with steel wires. Training conditions included 100 epochs, a batch size of 4, a learning rate of 0.01, 3 num-classes, and the Visual Geometric Groups (VGG) network skeleton. The input image size was 512*512. Finally, the trained U-net network was used to identify whether the region containing the figure-eight series anti-loosening steel wire bolts contained two line categories. The identification results are as follows: Figure 4 As shown, two lines of different colors were identified, namely the first color line and the second color line, where the first color line is red and the second color line is green.
[0096] S3. Perform binarization on the image containing both sides of the figure-eight anti-loosening steel wire to obtain a binarized image containing both sides of the figure-eight anti-loosening steel wire, and extract the skeleton by removing the edge part of the color line to obtain the first single-pixel line and the second single-pixel line.
[0097] In this embodiment, the purpose of binarizing the image containing both sides of the figure-eight anti-loosening wire is to enhance the contrast of the target area and highlight the structural features of the anti-loosening wire. Binarization separates the anti-loosening wire area from the background, displaying the wire as a white area and the background as black, thus simplifying the feature extraction process and facilitating subsequent skeleton extraction and morphological analysis. Furthermore, binarization helps reduce noise interference, making the target area clearer and easier to process. The purpose of skeleton extraction is to extract the centerline of the anti-loosening wire, thereby obtaining key information about its geometric shape. Skeleton extraction simplifies the outline of the anti-loosening wire into a linear representation, preserving its topological structure and shape features, which is crucial for subsequent angle calculation, curve fitting, and bolt loosening detection. By extracting the skeleton, the curvature and direction of the anti-loosening wire can be analyzed more accurately, thereby determining whether it is loose. Skeleton extraction not only reduces the complexity of data processing but also improves the accuracy and efficiency of the analysis.
[0098] Specifically, step S3 includes S31-S32:
[0099] S31. The Ostu threshold segmentation method is used to binarize the image containing both sides of the figure-eight anti-loosening steel wire to obtain a binarized image containing both sides of the figure-eight anti-loosening steel wire.
[0100] In this example, the Ostu thresholding method is used for binarization. This method improves the efficiency and accuracy of segmentation by automatically selecting the optimal threshold. It automatically calculates a globally optimal threshold by analyzing the image's grayscale histogram, reducing the need for manual adjustment and lowering the risk of human intervention. Simultaneously, the Ostu method maximizes inter-class variance, effectively improving the segmentation quality of foreground and background, especially highlighting the target region against complex backgrounds. Furthermore, this method is highly adaptable, capable of handling various image features, reducing noise impact, and improving the clarity of the segmentation results. The specific operation process of automatically selecting the optimal threshold for binarization using the Ostu thresholding method is as follows:
[0101] Specifically, step S31 includes S311-S315:
[0102] S311. Calculate the zero-order matrix of the gray-level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.:
[0103]
[0104] Where k represents the range of gray values of pixels in the gray-level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i represents the gray value of the pixel, zeroCM represents the zero-order matrix, and zeroCM(k) represents the cumulative sum of the zero-order matrix, that is, the cumulative sum of the normalized gray-level histogram from gray value 0 to k. I The histogram represents the normalized grayscale histogram of the image containing both sides of the figure-eight anti-loosening wire. I (i) represents the proportion of pixels with gray value i in the normalized gray histogram.
[0105] In this embodiment, zeroCM(k) is mainly used to measure the proportion of pixels with gray values in the range of 0 to k in the entire image; in addition, histogram I (i) is primarily used to measure the frequency of each grayscale value, relative to the total number of all pixels in the image.
[0106] S312. Calculate the first-order cumulative matrix of the gray-level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.:
[0107]
[0108] Where oneCM represents the first-order cumulative matrix, and oneCM(k) represents the cumulative sum of the first-order cumulative matrix.
[0109] In this embodiment, oneCM(k) accumulates the intensity contribution of pixels in the gray value range from 0 to k. It is an accumulation of weighted summation of gray levels, and k reflects the center of the gray value distribution or the trend of brightness change.
[0110] S313. Calculate the average gray level of the gray level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, that is:
[0111] mean = oneCM(255)
[0112] Here, mean represents the average value.
[0113] S314. Calculate the variance of the grayscale histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.:
[0114]
[0115] Where, σ 2 Indicates variance.
[0116] In this embodiment, k is calculated using the above formula, thereby selecting the threshold of the Ostu threshold segmentation method.
[0117] S315. Based on the variance of the grayscale histogram of the image containing the two sides of the figure-eight anti-loosening steel wire, select the largest variance and use the grayscale value corresponding to the largest variance as the threshold for Ostu threshold segmentation to binarize the image containing the two sides of the figure-eight anti-loosening steel wire, and obtain the binarized image containing the two sides of the figure-eight anti-loosening steel wire.
[0118] S32. Extract the skeleton from the binarized image containing the two sides of the figure-eight anti-loosening steel wire, and obtain the first single-pixel line and the second single-pixel line by removing the edge part of the color line.
[0119] In this embodiment, the binarized image containing both sides of the figure-eight anti-loosening steel wire is used as a temporary image. The skeleton is extracted using the 8-neighborhood method, thereby removing the edge parts of the first color line and the second color line, and converting the first color line and the second color line into single-pixel lines so that the angle between the two single-pixel lines can be calculated in subsequent steps.
[0120] Specifically, step S32 includes S321-S325:
[0121] S321. Divide the pixels to be processed and number them P1.
[0122] S322. Obtain 8 neighboring pixels centered on the pixel to be processed. The 8 neighboring pixels of the pixel to be processed are located above, upper right, right, lower right, lower, lower left, left, and upper left of the pixel to be processed, respectively, and are numbered P2, P3, P4, P5, P6, P7, P8, and P9.
[0123] In this embodiment, a schematic diagram showing the positions of the eight neighboring pixels of the pixel to be processed is shown below. Figure 5 As shown, the eight neighboring pixels of the pixel to be processed are located at the top, top right, right, bottom right, bottom, bottom left, left, and top left of the pixel to be processed.
[0124] S323. Determine whether the eight neighboring pixels of the pixel to be processed meet the first deletion condition or the second deletion condition. If so, delete the pixel to be processed; otherwise, retain the pixel to be processed.
[0125] S324. Repeat steps S321-S323 until there are no more pixels to be removed in the temporary image, thus completing the removal process of the edge part and obtaining a number of first single pixels and a number of second single pixels.
[0126] The first deletion condition is:
[0127]
[0128] The second deletion condition is:
[0129]
[0130] Where N represents the number of non-zero values among the 8 neighboring pixels of the pixel to be processed, and N(1) represents the number of changes from 0 to 1 when the 8 neighboring pixels of the pixel to be processed are in order.
[0131] S325. Fit several first single-pixel points to obtain a first single-pixel line, and simultaneously fit several second single-pixel points to obtain a second single-pixel line.
[0132] In this embodiment, a schematic diagram showing the completion of skeleton extraction is shown below. Figure 6 As shown, Figure 6 The first single-pixel line and the second single-pixel line are shown.
[0133] S4. Calculate the angle between the first single-pixel line and the second single-pixel line, and determine whether the angle is less than the set threshold. If so, output an error; otherwise, proceed to step S5.
[0134] In this embodiment, the slope of the first single-pixel line can be calculated using the single pixels on the first single-pixel line. Similarly, the slope of the second single-pixel line can be calculated using the single pixels on the second single-pixel line. Therefore, the angle between the first and second single-pixel lines can be calculated based on their slopes. The purpose of calculating the angle between the two lines is to prevent the U-net network from identifying the same line as two separate lines if the angle is less than a threshold. Furthermore, based on the axial wire connection method, the threshold is set to 18°-23°, which is considered a reasonable range.
[0135] Specifically, the formula for calculating the angle between the first single-pixel line and the second single-pixel line in step S4 is as follows:
[0136]
[0137] Where θ represents the angle between the first and second single-pixel lines, arctan represents the arctangent function, m1 represents the slope of the first single-pixel line, m2 represents the slope of the second single-pixel line, and x... 12 y 12 Let x and y represent the x and y coordinates of pixel 2 on the first pixel line, respectively. 11 y 11 Let x and y represent the x and y coordinates of pixel 1 on the first pixel line, respectively. 22 y 22 Let x and y represent the x and y coordinates of pixel 2 on the second pixel line, respectively. 21 y 21These represent the x and y coordinates of pixel 1 on the second pixel line, respectively.
[0138] S5. Extract the interval pixels in the first single pixel line and perform Cartesian coordinate transformation. By fitting the interval pixels in Cartesian coordinates, obtain the interval pixel fitting curve.
[0139] In this embodiment, the fitting method is Random Sample Consensus (RANSAC). The purpose of choosing RANSAC is to improve robustness to outliers in the dataset. RANSAC can automatically identify and remove points that do not conform to the model in the presence of noise and outliers, thereby ensuring more accurate and stable fitting results. The fitted curves for the interval pixels are shown below. Figure 7 As shown, since the actual origin of the image coordinate system is at the top left corner of the image, it is extremely inconvenient to observe the pixel lines in the coordinate system. Therefore, the pixel coordinate axes are inverted in the figure. The solid lines in the figure represent the standard curvature of this method. Figure 7 The first single-pixel line represented by the spaced pixels shown in the diagram has a good fitting effect, the steel wire shows no obvious deformation, and the bolts are not loose. Furthermore, Figure 7 The horizontal and vertical axes represent the pixel coordinates of the image, i.e., the width and height of the image.
[0140] Specifically, step S5 includes S51-S54:
[0141] S51. Based on the first single pixel line, obtain several first single pixel points of the first single pixel line.
[0142] S52. Save the first single pixel at each position every 10 first single pixels and call it the interval pixel, to obtain several interval pixels and their coordinates.
[0143] S53. Transform the coordinates of several interval pixels to a Cartesian coordinate system to obtain several interval pixels in the Cartesian coordinate system.
[0144] S54. Fit several interval pixels in the rectangular coordinate system to obtain the interval pixel fitting curve.
[0145] S6. Select the curve segments of the fitted curve between the first curve coordinate value interval and the second curve coordinate value interval to obtain the first curve segment and the second curve segment. Calculate the curvature of each interval pixel point within the first curve segment and the second curve segment to obtain the curvature value of each interval pixel point. Determine whether the maximum curvature value is greater than the standard curvature. If so, the bolt is loose; otherwise, the bolt is not loose.
[0146] In this embodiment, based on the fitted curve of the interval pixel points, the curve segments with curve coordinate values between 400-900 (the first curve coordinate value range) and 1000-1700 (the second curve coordinate value range) are selected, that is, the first curve segment and the second curve segment are used as the curve segments for calculating curvature. The purpose of this selection is that these two curve segments are the main areas where deformation occurs, so by checking these two curve segments, it is possible to determine whether the bolt is loose.
[0147] Specifically, the formula for calculating the curvature of each interval pixel point within the first curve segment and the second curve segment in step S6 is as follows:
[0148]
[0149] Where, k ′ y represents the curvature of each interval pixel point within the first or second curve segment. ′ y represents the first derivative of the first or second curve segment at a certain interval of pixels. ′″ It represents the second derivative of the first or second curve segment at a certain interval of pixels.
[0150] In summary, the bogie bolt loosening detection method based on series steel wire proposed in this invention demonstrates excellent accuracy and stability in bolt area detection and anti-loosening steel wire identification, respectively, using the improved YOLOv8 model and U-net network. Specifically, the improved YOLOv8 bolt area detection model can accurately identify the series bolt area of figure-eight series anti-loosening steel wires, achieving an accuracy rate of 96.7%, significantly improving detection reliability and effectively reducing missed and false detections. Meanwhile, the U-net network is used to identify the two sides of the figure-eight anti-loosening steel wires; after training and optimization, the accuracy rate reaches 94.5%, ensuring precise positioning of the anti-loosening steel wire area during screening and further identification, providing reliable data support for subsequent analysis. Furthermore, by combining the advantages of YOLOv8 and U-net, and supplementing with skeleton extraction, angle calculation, and curve fitting to analyze bolt loosening, the overall algorithm achieves an accuracy rate of 95.3%. Tested in various environments, the method demonstrated strong robustness and stability, with low variance in the recognition results. Even under complex backgrounds and significant changes in lighting, the algorithm maintained a consistently high recognition rate and low error level. Therefore, these results indicate that the improved detection method not only enhances the efficiency and accuracy of bolt loosening detection but also provides a reliable intelligent solution for bogie maintenance.
[0151] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
[0152] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of this invention.
Claims
1. A method for detecting loose bogie bolts based on series steel wires, characterized in that, Includes the following steps: S1. The improved YOLOv8 bolt area detection model is used to identify the area where the figure-eight series anti-loosening steel wire series bolts are located, specifically: S11. Obtain the image dataset of the tandem wire metro bogie bolts, and use annotation software to annotate the label data of the tandem wire metro bogie bolt image data to obtain the labeled tandem wire metro bogie bolt image dataset. The label data indicates the area where the figure-eight series anti-loosening steel wire series bolts are located; S12. Introduce a structural reparameterization feature reuse module and a downsampling convolutional layer at the backbone network end to construct an improved YOLOv8 bolt region detection model. Among them, the structural reparameterization feature reuse module is used to fuse feature maps from different layers or scales to achieve feature reuse; Downsampling convolutional layers are used to reduce the width and height of feature maps, thereby reducing image resolution; S13. Input the labeled series steel wire subway bogie bolt image dataset into the improved YOLOv8 bolt region detection model for training to obtain the trained improved YOLOv8 bolt region detection model, which is used to identify the region where the figure-eight series anti-loosening steel wire series bolts are located. S2. Input the area where the figure-eight anti-loosening steel wire and the series bolt are located into the trained U-net network for recognition, and determine whether the output result of the trained U-net network is an image containing both sides of the figure-eight anti-loosening steel wire. If so, proceed to step S3; otherwise, the output is abnormal. Among them, the two sides of the figure-eight anti-loosening steel wire have two lines of different colors, namely the first color line and the second color line; S3. Perform binarization on the image containing both sides of the figure-eight anti-loosening steel wire to obtain a binarized image containing both sides of the figure-eight anti-loosening steel wire, and extract the skeleton by removing the edge part of the color line to obtain the first single pixel line and the second single pixel line. S4. Calculate the angle between the first single-pixel line and the second single-pixel line, and determine whether the angle is less than the set threshold. If it is, output an error; otherwise, proceed to step S5. S5. Extract the interval pixels in the first single pixel line and perform a Cartesian coordinate transformation. By fitting the interval pixels in Cartesian coordinates, obtain the interval pixel fitting curve. S6. Select the curve segments of the fitted curve between the first curve coordinate value interval and the second curve coordinate value interval to obtain the first curve segment and the second curve segment. Calculate the curvature of each interval pixel point within the first curve segment and the second curve segment to obtain the curvature value of each interval pixel point. Determine whether the maximum curvature value is greater than the standard curvature. If so, the bolt is loose; otherwise, the bolt is not loose.
2. The method for detecting loose bogie bolts based on series steel wires according to claim 1, characterized in that, The improved YOLOv8 bolt region detection model includes a backbone network, a neck network, and a head network. The backbone network includes a first convolutional layer, a second convolutional layer, a first structure reparameterized feature reuse module, a first downsampling convolutional layer, a second structure reparameterized feature reuse module, a second downsampling convolutional layer, a third structure reparameterized feature reuse module, a third downsampling convolutional layer, a fourth structure reparameterized feature reuse module, and a multi-scale feature aggregation pyramid module. The neck network includes a first upsampling module, a first connection module, a first residual connection module, a second upsampling module, a second connection module, a second residual connection module, a third convolutional layer, a third connection module, a third residual connection module, a fourth convolutional layer, a fourth connection module, and a fourth residual connection module; The head network includes a large detection head, a medium detection head, and a small detection head.
3. The method for detecting loose bogie bolts based on series steel wires according to claim 2, characterized in that, Step S13 specifically includes: S131. Input the labeled series steel wire subway bogie bolt image dataset into the backbone network of the improved YOLOv8 bolt region detection model for feature extraction to obtain feature maps at different scales. S132. Input feature maps of different scales into the neck network of the improved YOLOv8 bolt region detection model for feature fusion to obtain fused features of different scales. S133. Input the fusion features of different scales into the head network of the improved YOLOv8 bolt region detection model to identify the region where the figure-eight series anti-loosening steel wire series bolts are located, and obtain the trained improved YOLOv8 bolt region detection model, which is used to identify the region where the figure-eight series anti-loosening steel wire series bolts are located.
4. The method for detecting loose bogie bolts based on series steel wires according to claim 3, characterized in that, Step S3 specifically includes: S31. The Ostu threshold segmentation method is used to binarize the image containing both sides of the figure-eight anti-loosening steel wire to obtain a binarized image containing both sides of the figure-eight anti-loosening steel wire. S32. Extract the skeleton from the binarized image containing the two sides of the figure-eight anti-loosening steel wire, and obtain the first single-pixel line and the second single-pixel line by removing the edge part of the color line.
5. The bogie bolt loosening detection method based on series steel wires according to claim 4, characterized in that, Step S31 specifically includes: S311. Calculate the zero-order matrix of the gray-level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.: in, This represents the range of grayscale values for pixels in the grayscale histogram of the image containing both sides of the figure-eight anti-loosening steel wire. Represents the grayscale value of a pixel. Represents a zero-order matrix. This represents the cumulative sum of a zero-order matrix, i.e., from gray value 0 to... The cumulative sum of the normalized gray-level histogram, This represents the normalized grayscale histogram of the image containing both sides of the figure-eight anti-loosening steel wire. The gray values in the normalized gray-level histogram represent the gray-level values. The proportion of pixels; S312. Calculate the first-order cumulative matrix of the gray-level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.: in, Represents a first-order cumulative matrix. This represents the cumulative sum of a first-order cumulative matrix; S313. Calculate the average gray level of the gray level histogram of the image containing both sides of the figure-eight anti-loosening steel wire, that is: in, This represents the average value; S314. Calculate the variance of the grayscale histogram of the image containing both sides of the figure-eight anti-loosening steel wire, i.e.: in, Indicates variance; S315. Based on the variance of the grayscale histogram of the image containing the two sides of the figure-eight anti-loosening steel wire, select the largest variance and use the grayscale value corresponding to the largest variance as the threshold for Ostu threshold segmentation to binarize the image containing the two sides of the figure-eight anti-loosening steel wire, and obtain the binarized image containing the two sides of the figure-eight anti-loosening steel wire.
6. The bogie bolt loosening detection method based on series steel wires according to claim 5, characterized in that, Step S32 specifically includes: S321. Divide the pixels to be processed and number them as follows: ; S322. Obtain the 8 neighboring pixels centered on the pixel to be processed. The 8 neighboring pixels are located at the top, top right, right, bottom right, bottom, bottom left, left, and top left of the pixel to be processed, respectively, and are numbered sequentially as follows: , , , , , , , ; S323. Determine whether the eight neighboring pixels of the pixel to be processed meet the first deletion condition or the second deletion condition. If so, delete the pixel to be processed; otherwise, keep the pixel to be processed. S324. Repeat steps S321-S323 until there are no more pixels to be removed in the temporary image, thus completing the removal process of the edge part and obtaining a number of first single pixels and a number of second single pixels. The first deletion condition is: ; The second deletion condition is: in, This represents the number of non-zero values among the eight neighboring pixels of the pixel to be processed. This represents the number of changes from 0 to 1 when the pixel to be processed is ordered by its 8 nearest neighbors. S325. Fit several first single-pixel points to obtain a first single-pixel line, and simultaneously fit several second single-pixel points to obtain a second single-pixel line.
7. The method for detecting loose bogie bolts based on series steel wires according to claim 6, characterized in that, The formula for calculating the angle between the first single-pixel line and the second single-pixel line in step S4 is: in, This indicates the angle between the first and second single-pixel lines. Represents the arctangent function. This represents the slope of the first single-pixel line. This indicates the slope of the second single-pixel line. , Let x and y represent the x and y coordinates of pixel 2 on the first pixel line, respectively. , Let x and y represent the x and y coordinates of pixel 1 on the first pixel line, respectively. , Let x and y represent the x and y coordinates of pixel 2 on the second pixel line, respectively. , These represent the x and y coordinates of pixel 1 on the second pixel line, respectively.
8. The bogie bolt loosening detection method based on series steel wires according to claim 7, characterized in that, Step S5 specifically includes: S51. Based on the first single-pixel line, obtain several first single-pixel points of the first single-pixel line; S52. Save the first single pixel at each position every 10 first single pixels and call it the interval pixel, to obtain several interval pixels and their coordinates; S53. Transform the coordinates of several interval pixels to a Cartesian coordinate system to obtain several interval pixels in a Cartesian coordinate system; S54. Fit several interval pixels in the rectangular coordinate system to obtain the interval pixel fitting curve.
9. The method for detecting loose bogie bolts based on series steel wires according to claim 8, characterized in that, The formula for calculating the curvature of each interval pixel point within the first and second curve segments in step S6 is as follows: in, This represents the curvature of each interval pixel within the first or second curve segment. This represents the first derivative of the first or second curve segment at a certain interval of pixels. It represents the second derivative of the first or second curve segment at a certain interval of pixels.
Citation Information
Patent Citations
Series steel wire anti-loosening structure detection method based on machine vision
CN111145154A
Bolt detection method, device, equipment and medium
CN115511828A