Frame body rod piece distance detection method and system
The improved YOLOv5n model is used to quickly identify rod nodes and calculate spacing, which solves the real-time and accuracy issues of rod spacing detection in the existing technology and realizes fast and accurate rod detection without manual intervention.
Patent Information
- Application Number
- CN202510817220.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-10-14
AI Technical Summary
The existing technology for detecting the distance between rods cannot meet the real-time requirements and the detection accuracy is low due to the small targets of the rod nodes.
An improved YOLOv5n model, including a backbone network, a neck network, and a prediction network, is used to quickly identify rod nodes through machine vision and calculate the distance between adjacent nodes. The improved YOLOv5n model is used to extract multi-scale features and fuse features of different scales to identify nodes, which is particularly suitable for large building structures.
It can quickly and accurately identify rod nodes without manual inspection, meet real-time requirements, improve the accuracy and efficiency of detection, and is suitable for the detection of large building structures.
Smart Images

Figure CN120782718A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of building detection, in particular to a frame rod spacing detection method and system. BACKGROUND
[0002] At present, the spacing detection of rods on the construction site is manually checked by using traditional measuring instruments such as tape measures. These instruments need close contact and are not suitable for detecting defects or accurately measuring sizes and recording data. The inspection process is mainly based on manual inspection and judgment, which is labor-intensive and inefficient, especially for large structures.
[0003] Existing methods are generally based on machine vision of rod spacing or rod nodes. For example, the construction scaffold spacing detection technology based on the DeepFlux algorithm invented by Lin Hongqiang et al. does not fully consider the influence of complex backgrounds and light changes on image processing in the construction site, such as strong light, shadows, and reflections, which will affect the effect of skeleton extraction. For example, the scaffold engineering assembly quality intelligent detection method based on Scan-vs-BIM and key feature recognition proposed by Zhao Jie et al. mainly focuses on the accuracy of the algorithm, but does not design the real-time detection requirement. In actual construction, the monitoring of scaffolds needs quick response to ensure safety. Some other rod node detection methods based on machine vision fail to effectively consider the small target of "rod node", resulting in frequent missed detection or false detection in practice.
[0004] In summary, the existing methods have the problems of rod spacing detection that cannot meet real-time requirements and that fail to effectively consider the small target of "rod node", resulting in low detection accuracy. SUMMARY
[0005] Therefore, the technical problem to be solved by the present application is to overcome the problems in the prior art that rod spacing detection cannot meet real-time requirements and that fails to effectively consider the small target of "rod node", resulting in low detection accuracy.
[0006] To solve the above technical problems, the present application provides a frame rod spacing detection method, comprising:
[0007] Step S1: obtaining an image with rod nodes to be detected;
[0008] Step S2: identifying the rod nodes in the image with rod nodes by using an improved YOLOv5n model;
[0009] The improved YOLOv5n model comprises a backbone network, a Neck network and a prediction network connected in sequence. The backbone network is used to extract multi-scale features of the image, the Neck network is used to fuse features of different scales, and the prediction network is used to identify nodes based on the fused features of different scales.
[0010] Step S3: calculating the distance between the two adjacent nodes of the identified rod members.
[0011] In an embodiment of the present application, the backbone network comprises a first CONV layer, a second CONV layer, a first C3 module, a third CONV layer, a second C3 module, a fourth CONV layer, a third C3 module, a fifth CONV layer, a fourth C3 module and a SPFF module connected in sequence.
[0012] In an embodiment of the present application, the Neck network comprises a sixth CONV layer, a first Upsample layer, a first Concat layer, a fifth C3 module, a seventh CONV layer, a second Upsample layer, a second Concat layer, a sixth C3 module, an eighth CONV layer, a third Upsample layer, a third Concat layer, a seventh C3 module, a ninth CONV layer, a fourth Concat layer, an eighth C3 module, a first CA layer, a tenth CONV layer, a fifth Concat layer, a ninth C3 module, a second CA layer, an eleventh CONV layer, a sixth Concat layer, a tenth C3 module, a third CA layer connected in sequence, wherein,
[0013] the sixth CONV layer is connected with the sixth Concat layer and the SPFF module respectively, the first Concat layer is connected with the third C3 module, the seventh CONV layer is connected with the tenth CONV layer, the second Concat layer is connected with the second C3 module, the eighth CONV layer is connected with the fourth Concat layer, and the third Concat layer is connected with the first C3 module.
[0014] In an embodiment of the present application, the prediction network comprises a first CONV2d layer, a second CONV2d layer, a third CONV2d layer and a fourth CONV2d layer, wherein,
[0015] the first CONV2d layer is connected with the third CA layer, the second CONV2d layer is connected with the ninth C3 module, the third CONV2d layer is connected with the first CA layer, and the fourth CONV2d layer is connected with the seventh C3 module.
[0016] In an embodiment of the present application, each of the first C3 module to the tenth C3 module comprises a first CBS module, a Bottleneck module, a seventh Concat layer and a second CBS module connected in sequence, and the output of the seventh Concat layer is further connected with the input of the first CBS module through a third CBS module, wherein,
[0017] The bottleneck module comprises a fourth CBS module and a fifth CBS module connected in sequence, and the input of the fourth CBS module and the output of the fifth CBS module are output after passing through an ADD layer.
[0018] In an embodiment of the present application, the SPFF module comprises a sixth CBS module, a first Maxpooling layer, a second Maxpooling layer, a third Maxpooling layer, an eighth Concat layer and a seventh CBS module connected in sequence, wherein,
[0019] The sixth CBS module, the first Maxpooling layer and the second Maxpooling layer are connected with the eighth Concat layer respectively.
[0020] In an embodiment of the present application, the first CBS module to the seventh CBS module comprise a twelfth CONV layer, a BN layer and a SiLU layer connected in sequence.
[0021] To solve the above technical problems, the present application provides a frame member spacing detection system, comprising:
[0022] An acquisition module is configured to acquire an image of a frame member node to be detected.
[0023] An identification module is configured to identify the frame member node in the image of the frame member node by using an improved YOLOv5n model.
[0024] The improved YOLOv5n model comprises a backbone network, a neck network and a prediction network connected in sequence, wherein the backbone network is configured to extract multi-scale features of the image, the neck network is configured to fuse features of different scales, and the prediction network is configured to identify the node based on the fused features of different scales.
[0025] A calculation module is configured to calculate the spacing between two adjacent frame member nodes identified.
[0026] To solve the above technical problems, the present application provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the frame member spacing detection method.
[0027] To solve the above technical problems, the present application provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps of the frame member spacing detection method.
[0028] The above technical solution of the present application has the following advantages compared with the prior art:
[0029] The frame rod spacing detection method constructed by the application does not need to check and judge the spacing of two rod nodes by artificial means, and can quickly and accurately identify the rod nodes by the method of machine vision (specifically, by using the improved YOLOv5n model), and is particularly suitable for large building structures. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to make the content of the application more easily understood, the application will be further described in detail below according to specific embodiments of the application and in conjunction with the drawings.
[0031] Figure 1 is a method flowchart of the application;
[0032] Figure 2 is a structure schematic diagram of the improved YOLOv5n model in the embodiment of the application;
[0033] Figure 3 is a structure schematic diagram of the C3 module in the embodiment of the application;
[0034] Figure 4 is a structure schematic diagram of the SPFF module in the embodiment of the application;
[0035] Figure 5 is a structure schematic diagram of the CBS module in the embodiment of the application. DETAILED DESCRIPTION
[0036] The application will be further described below in conjunction with the drawings and specific embodiments, so that those skilled in the art can better understand the application and implement it, but the embodiments are not limiting the application.
[0037] Embodiment one
[0038] Please refer to Figure 1 The application relates to a frame rod spacing detection method, which comprises the following steps:
[0039] Step S1: acquiring an image with rod nodes to be detected;
[0040] Step S2: identifying the rod nodes in the image with rod nodes by using the improved YOLOv5n model;
[0041] Please refer to Figure 2The improved YOLOv5n model in the embodiment includes a backbone network, a Neck network and a prediction network connected in sequence, the backbone network is used for extracting multi-scale features of an image, specifically extracting multi-scale features, from low layers to high layers, capturing semantic information at different levels, the Neck network is used for fusing features of different scales, specifically combining semantic information of high layers and details of low layers when fusing features of different scales, and improving the ability of detecting objects of different sizes, and the prediction network is used for identifying nodes based on the fused features, specifically generating a bounding box, a class (i.e., whether it is a node) and a confidence (i.e., how large the probability of being a node is).
[0042] Step S3: calculating the distance between the two adjacent nodes of the identified rod members.
[0043] Further, the backbone network in the embodiment includes a first CONV layer (i.e., a convolutional layer), a second CONV layer, a first C3 module, a third CONV layer, a second C3 module, a fourth CONV layer, a third C3 module, a fifth CONV layer, a fourth C3 module and a SPFF module connected in sequence.
[0044] Further, the Neck network in the embodiment includes a sixth CONV layer, a first Upsample layer, a first Concat layer, a fifth C3 module, a seventh CONV layer, a second Upsample layer, a second Concat layer, a sixth C3 module, an eighth CONV layer, a third Upsample layer, a third Concat layer, a seventh C3 module, a ninth CONV layer, a fourth Concat layer, an eighth C3 module, a first CA layer, a tenth CONV layer, a fifth Concat layer, a ninth C3 module, a second CA layer, an eleventh CONV layer, a sixth Concat layer, a tenth C3 module, a third CA layer connected in sequence, wherein the sixth CONV layer is connected with the sixth Concat layer and the SPFF module respectively, the first Concat layer is connected with the third C3 module, the seventh CONV layer is connected with the tenth CONV layer, the second Concat layer is connected with the second C3 module, the eighth CONV layer is connected with the fourth Concat layer, and the third Concat layer is connected with the first C3 module.
[0045] Since the CA layer, i.e., the CA attention mechanism, belongs to the prior art, the CA attention mechanism will not be described herein, and the purpose of adding the CA attention mechanism after the corresponding C3 module in the Neck network is to enhance feature expression, reduce redundant information and improve the overall performance of the model. The CA attention mechanism can help the model better capture the correlation and dependency between channels, thereby improving the understanding ability of the model for input data.
[0046] It is worth mentioning that, for the problem of small "rod node" target, the Neck network is improved in this embodiment, and the MC module is added in the Neck network (from the sixth C3 module to the fourth Concat layer), please see Figure 2 To improve the recognition accuracy of long-distance small targets, 1 upsampling is added in the Neck network (i.e. the third Upsample layer), and after the third upsampling, it is fused with the first C3 module of the backbone network to obtain the prediction layer in the MC module (i.e. the output of the seventh C3 module in MC), and the output is a 160*160 feature map, which is used to effectively detect small targets. The improved YOLOv5n in this embodiment uses 4 prediction scale prediction layers, which fully utilizes the high resolution of bottom layer features and the high semantic information of deep layer features, and does not significantly increase the network complexity.
[0047] Further, the prediction network in this embodiment includes a first CONV2d layer, a second CONV2d layer, a third CONV2d layer and a fourth CONV2d (CONV2d layer is a core component in deep learning for processing two-dimensional data (such as images, feature maps), which extracts local spatial features through a sliding window (filter) and maps input data to a higher or lower dimensional feature space), wherein the first CONV2d layer is connected with the third CA layer, the second CONV2d layer is connected with the ninth C3 module, the third CONV2d layer is connected with the first CA layer, and the fourth CONV2d layer is connected with the seventh C3 module; the first CONV2d layer outputs a 160*160 feature map, the second CONV2d layer outputs an 80*80 feature map, the third CONV2d layer outputs a 40*40 feature map, and the fourth CONV2d layer outputs a 20*20 feature map. It should be noted that 160*160, 80*80, 40*40 and 20*20 are feature maps (Feature Maps) from different levels, which are used to detect small targets, small targets, medium targets and large targets respectively. These feature maps are predicted by convolution layers of different scales, which correspond to the detection ability of the improved YOLOv5n model for objects of different sizes, mainly through multi-scale prediction to achieve accurate detection of targets of various sizes.
[0048] Further, please refer to Figure 3The first C3 module to the tenth C3 module in the embodiment each include a first CBS module, a bottleneck module, a seventh Concat layer, and a second CBS module connected in sequence, and the output of the seventh Concat layer is further connected with the input of the first CBS module through a third CBS module, wherein the bottleneck module includes a fourth CBS module and a fifth CBS module connected in sequence, and the input of the fourth CBS module and the output of the fifth CBS module are output after an ADD layer.
[0049] Further, please refer to Figure 4 In the embodiment, the SPFF module includes a sixth CBS module, a first Maxpooling layer (i.e., a maximum pooling layer), a second Maxpooling layer, a third Maxpooling layer, an eighth Concat layer, and a seventh CBS module connected in sequence, wherein the sixth CBS module, the first Maxpooling layer, and the second Maxpooling layer are connected with the eighth Concat layer. The SPFF module is used to improve the detection capability of the model for different sizes of targets, especially small targets, through multi-scale feature fusion and enhancement. The first Maxpooling layer, the second Maxpooling layer, and the third Maxpooling layer are each used for down-sampling (reducing the resolution of the feature map) and feature enhancement, thereby improving the robustness and computational efficiency of the model by retaining the most significant features in the local region.
[0050] Further, please refer to Figure 5 In the embodiment, the first CBS module to the seventh CBS module include a twelfth CONV layer, a BN layer, and a SiLU layer connected in sequence, wherein the CBS module is used to realize efficient feature extraction and optimization through standardized convolution operation and nonlinear feature enhancement; the BN layer is used to normalize the convolution output, accelerate the model convergence, and alleviate the problem of gradient vanishing or explosion; and the SiLU layer combines the smoothness of Sigmoid and the sparsity of ReLU, and can better transmit gradients than ReLU, and is especially suitable for deep networks.
[0051] The improved YOLOv5n model is used to identify the rod nodes in the embodiment, and experimental verification shows that, compared with the YOLOv5n model, the detection speed is changed from 0.57s required for processing one image to 0.49s, which is improved by 0.08s, and the rod node detection can meet the real-time requirement.
[0052] Furthermore, after using the improved YOLOv5n model to identify two rod nodes, the distance between the rod nodes (i.e., pixel distance) is calculated using Euclidean distance. Finally, perspective geometry is used to convert the pixel distance into the actual rod node spacing (i.e., the frame rod spacing). In actual application, by measuring the frame rod spacing, it is possible to determine whether there are any locations that do not meet safety technical specifications (i.e., the rods where the unqualified nodes are located can be identified).
[0053] Furthermore, after obtaining the pixel distance d of the rod node pixels , using the perspective geometry method to convert the pixel distance d pixels Converted to the actual spacing of member nodes, the formula is as follows:
[0054]
[0055] Where D represents the distance between the two targets (rod nodes) in the actual plane, h represents the distance from the camera to the target plane, and f represents the focal length of the camera.
[0056] Example 2
[0057] This embodiment provides a frame rod spacing detection system, including:
[0058] Acquisition module: used to acquire images with rod nodes to be detected;
[0059] Recognition module: used to identify the rod nodes in the image with rod nodes using the improved YOLOv5n model;
[0060] The improved YOLOv5n model includes a backbone network, a Neck network, and a prediction network connected in sequence, wherein the backbone network is used to extract multi-scale features of the image, the Neck network is used to fuse features of different scales, and the prediction network is used to identify nodes based on the fused features of different scales;
[0061] Calculation module: used to calculate the distance between two identified member nodes.
[0062] Example 3
[0063] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the frame rod spacing detection method described in the first embodiment are implemented.
[0064] Example 4
[0065] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the frame rod spacing detection method described in the first embodiment are implemented.
[0066] Those skilled in the art will appreciate that embodiments of the application can be readily used as a method, apparatus, or computer program product. Accordingly, the application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer readable program code thereon. Embodiments of the application can be implemented in various computer languages including, but not limited to, Java and JavaScript.
[0067] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0068] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0069] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0070] While the preferred embodiments of the application have been described, additional variations and modifications can be made to the embodiments by those of ordinary skill in the art once they have the benefit of the foregoing description. Therefore, the appended claims are intended to cover all such variations and modifications as falling within the scope of the application.
[0071] Obviously, the embodiments described above are only examples for clearly illustrating the application, and are not intended to limit the embodiments. Based on the above description, other different forms of changes or variations can be made by those of ordinary skill in the art. Here, all the embodiments are not required to be enumerated. The obvious changes or variations derived therefrom are still within the protection scope of the application.
Claims
1. A method for detecting the spacing between frame members, characterized in that: include: Step S1: Acquire an image with a rod node to be detected; Step S2: identifying the rod nodes in the image with the rod nodes by using the improved YOLOv5n model; The improved YOLOv5n model includes a backbone network, a Neck network, and a prediction network connected in sequence, wherein the backbone network is used to extract multi-scale features of the image, the Neck network is used to fuse features of different scales, and the prediction network is used to identify nodes based on the fused features of different scales; Step S3: Calculate the distance between two adjacent identified member nodes.
2. The frame member spacing detection method according to claim 1, characterized in that: The backbone network includes a first CONV layer, a second CONV layer, a first C3 module, a third CONV layer, a second C3 module, a fourth CONV layer, a third C3 module, a fifth CONV layer, a fourth C3 module and an SPFF module connected in sequence.
3. The frame member spacing detection method according to claim 2, characterized in that: The Neck network includes a sixth CONV layer, a first Upsample layer, a first Concat layer, a fifth C3 module, a seventh CONV layer, a second Upsample layer, a second Concat layer, a sixth C3 module, an eighth CONV layer, a third Upsample layer, a third Concat layer, a seventh C3 module, a ninth CONV layer, a fourth Concat layer, an eighth C3 module, a first CA layer, a tenth CONV layer, a fifth Concat layer, a ninth C3 module, a second CA layer, an eleventh CONV layer, a sixth Concat layer, a tenth C3 module, and a third CA layer, which are connected in sequence. The sixth CONV layer is connected to the sixth Concat layer and the SPFF module respectively, the first Concat layer is connected to the third C3 module, the seventh CONV layer is connected to the tenth CONV layer, the second Concat layer is connected to the second C3 module, the eighth CONV layer is connected to the fourth Concat layer, and the third Concat layer is connected to the first C3 module.
4. The frame member spacing detection method according to claim 3, characterized in that: The prediction network includes a first CONV2d layer, a second CONV2d layer, a third CONV2d layer and a fourth CONV2d layer, wherein, The first CONV2d layer is connected to the third CA layer, the second CONV2d layer is connected to the ninth C3 module, the third CONV2d layer is connected to the first CA layer, and the fourth CONV2d layer is connected to the seventh C3 module.
5. The frame member spacing detection method according to claim 4, characterized in that: The first to tenth C3 modules each include a first CBS module, a Bottleneck module, a seventh Concat layer, and a second CBS module connected in sequence, and the output of the seventh Concat layer is further connected to the input of the first CBS module through the third CBS module, wherein: The Bottleneck module includes a fourth CBS module and a fifth CBS module connected in sequence, and the input of the fourth CBS module and the output of the fifth CBS module are output after passing through an ADD layer.
6. The frame member spacing detection method according to claim 5, characterized in that: The SPFF module includes a sixth CBS module, a first Maxpooling layer, a second Maxpooling layer, a third Maxpooling layer, an eighth Concat layer and a seventh CBS module connected in sequence, wherein: The sixth CBS module, the first Maxpooling layer, and the second Maxpooling layer are respectively connected to the eighth Concat layer.
7. The frame member spacing detection method according to claim 1, characterized in that: The first to seventh CBS modules include a twelfth CONV layer, a BN layer, and a SiLU layer connected in sequence.
8. A frame member spacing detection system, characterized by: include: Acquisition module: used to acquire images with rod nodes to be detected; Recognition module: used to identify the rod nodes in the image with rod nodes using the improved YOLOv5n model; The improved YOLOv5n model includes a backbone network, a Neck network, and a prediction network connected in sequence, wherein the backbone network is used to extract multi-scale features of the image, the Neck network is used to fuse features of different scales, and the prediction network is used to identify nodes based on the fused features of different scales; Calculation module: used to calculate the distance between two adjacent identified member nodes.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the frame rod spacing detection method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the frame rod spacing detection method according to any one of claims 1 to 7 are implemented.