Abstract
Circular tubes and ball joints are widely used in large-span grid structures. Bending of circular tubes is a common form of damage in grid structures, posing a potential risk of global safety. Traditional manual inspections are labor and time cost, and usually need high-altitude operation. To address this issue, an automatic bent tube detection method based on computer vision and deep learning is proposed in this article. In the method, ball joints in the image are identified and localized using YOLOv5s object-detection network, and then the tubes are identified by semantic segmentation conducted by a DeepLab v3+ network enhanced with the contextual transformer block. The axes of the bent tubes are extracted from the segmented masks by the skeletonization algorithms. Finally, bent-tube deflections are assessed as the perpendicular distance from the bent-tube axis to the joint anchor box centerline. The proposed framework is validated by eccentric compression tests on three circular tubes with ball joints. It is shown that the average error in deflection assessment by the proposed framework is less than 2 mm, with a maximum error rate of 3.7% which is deemed acceptable in engineering application.
Keywords
Introduction
Grid structures are composed of interconnected members and joints arranged in specific geometric patterns. 1 This structural typology offers several advantages, including spatial efficiency, light weight, superior seismic performance, and the capability to span large distance. 2 As a result, grid structures are widely used in large-span buildings such as train stations, 3 stadiums, 4 and airport terminals. 5 In these large-span grid structures, circular tubes are usually used as the main load-bearing members, and ball joints including bolted balls and hollow welded balls are usually used to connect the members. Given the importance of these public facilities, timely and proactively maintenance of in-service grid structures is essential for preventing structural failures and ensuring public safety. 6
Member bent is one of the main damages observed in in-service grid structures, as shown in Figure 1. Initial imperfections, unnormal loading conditions, and unfavorable support conditions are the possible reasons that cause unrecoverable bending of the members. 7 The bending deformation reduces the axial load bearing capacity of the member. Moreover, the member’s load-bearing capacity will further decrease due to the P-Delta effect. 8 Severe member bending may trigger progressive collapse of the whole structural system. Therefore, the timely and accurately detection of bent members is critical for the proactive maintenance and safety evaluation of in-service grid structures.

Bent members in in-service grid structures. (a) Bent bottom chord member in an in-service stadium. (b) Bent web member in an in-service stadium. (c) Bend web members in an in-service roof of swimming pool. (d) Bend web member in an in-service grid roof.
At current, detection of bent members is mainly relying on manual inspection. 9 As shown in Figure 2, manual inspection of bent members usually needs to work at height and measure the member deflections by handheld tools. Obviously, the manual inspection is labor and time cost, and exposes the inspectors to safety hazards due to the substantial height clearances, particularly in aging grid structures.10,11

On-site manual inspection. (a) High-altitude operation. (b) Manual measurement.
The emergence of computer vision technology offers a promising way to efficient detection of bent tube. Vision-based methodologies have been extensively investigated and successfully implemented in various structural inspection applications, particularly in damage detection12–15 and deformation measurement.17–24 Traditional vision-based methods can be generally classified into three main categories, that is, coded-target photogrammetric methods, surface-point tracking methods, and surface comparison methods. 16 Han et al. 17 developed a deflection measurement method for suspension bridges by combining unmanned aerial vehicle (UAV) photography with a stationary laser spot reference. In a separate study, Xu et al. 18 introduced a feature point-based template matching technique to simultaneously track multiple points on a cable-stayed footbridge, enabling modal frequency estimation for both the deck and cables. Jiang et al. 19 proposed a deep learning-based displacement calculation method incorporating Kalman filter for target trajectory prediction. Yang et al. 20 integrated digital image correlation (DIC) techniques with advanced video processing and unsupervised learning algorithms for structural modal analysis. Cheng et al. 21 utilized a visual sensor system to determine the spatial positions of measurement points during vibration testing of a double suspension system. Ri et al. 22 introduced an approach combining a phase-based sampled moiré technique with four-degree-of-freedom geometric modeling, utilizing placed markers on bridge girders to differentiate between actual bridge displacements from apparent displacements induced by camera motion. Sun and Huang 23 implemented a comprehensive deformation monitoring strategy by leveraging DIC techniques with clustering algorithms for large-span steel structures during construction. Wang et al. 24 employed advanced subpixel localization techniques to monitor steel truss structure buckling and load identification. However, these traditional approaches exhibit significant limitations for in-service grid structures, primarily due to their dependence on historical deformation data, which are often unavailable in practical applications.
The emergence of deep learning has fundamentally improved vision-based inspection capabilities, enabling deformation assessment from individual images without relying on historical sequential image data. 25 Recently, vision-based methods incorporated with deep learning have gained significant attention in structural health monitoring and damage detection. 26 Gao and Mosalam 27 constructed a multiscale image dataset encompassing pixel, component, and structural levels, proposing a deep learning approach for concurrent various visual tasks, such as component type recognition and damage assessment. Yu et al. 28 introduced a deep learning-assisted DIC method for full-field deflection and cracks detection in concrete beams under laboratory conditions. Atha and Jahanshahi 29 introduced a CNN-based method for detecting and quantifying surface corrosion on steel structures. Cha et al. 30 developed a fast R-CNN-based method for real-time multidamage detection, including cracks, rebar corrosion, and delamination. Choi and Cha 31 developed a convolutional neural network designed for real-time segmentation of concrete cracks in images, whereas Kang and Cha 32 introduced a method for evaluating the complexity of image scenes. Zhai et al. 33 employed cluster segmentation for column edge displacement fitting to monitor dynamic deformation of reinforced concrete (RC) column with fibre reinforced plastics (FRP) tubes in axial compression tests. Several researchers have employed UAVs in conjunction with deep learning algorithms to assess structural damage in indoor environments. Their investigations have encompassed various research directions, including target-based localization methodologies,34,35 image stabilization acquisition techniques, 36 and additional related areas. These advancements have facilitated the detection of bent members in grid structures through visual information extracted from imagery. Although the promising potential of deep learning-enhanced vision-based methods in structural detection, to the best of authors’ knowledge, they are not able to be directly used to detect bent members in in-service grid structures, specifically tailoring being needed.
To fill the gap between the existing method and the demand for efficient and accurate in in-service grid structures, this article develops a novel bent tube detection (BTD) method based on computer vision and deep learning. The outline of the article is as follows: The second section presents the workflow of the proposed BTD method. The third section introduces the dataset building and training details of the networks. In the fourth section, eccentric loading experiments are conducted to verify the effectiveness of the proposed method. Finally, the fifth section concludes the article.
Vision-based framework for bent-tube detection
Currently, there are various computer vision techniques, including object detection, that are able to extract and truncate images of individual members from photographs of grid structures. 37 In this article, we consider a target member with ball joints has been truncated from the captured image, as shown in Figure 3.

Truncated image with target member.
The main flow of the proposed BTD method is as shown in Figure 4. First, spherical joints are located within the input image. Second, high-fidelity semantic segmentation of the targeted tubes is conducted to obtain their geometric contours. Third, the medial axis of the segmentation results is extracted. Finally, the deflection of the member is calculated by combining the positions of the spherical joints and the tube axis. The details of above procedures are given as follows.

Framework of BTD method. BTD: bent tube detection.
Identification and localization of ball joints
In this study, the lightweight YOLOv5s model which is a state-of-art single stage detector is adopted for its efficient parameterization while maintaining competitive performance. 38 As illustrated in Figure 5, the adopted YOLOv5s architecture comprises four principal components: the input layer, backbone network for feature extraction, neck network for feature aggregation, and detection head for final predictions.

Architecture of YOLOv5s.
In the input of YOLOv5s, the image containing tube with joints undergoes multiple preprocessing steps, including geometric and color transformation, mosaic data augmentation, image size normalization, and adaptive anchor box computation. The backbone architecture implements CSPDarknet architecture 39 for feature extraction, comprising three key modules: CBS for standardized convolution operations, C3 40 for cross-stage partial feature integration, and SPPF 41 for optimized spatial pyramid pooling. This backbone architecture processes the edge and shape information of the joint while implementing dimensional reduction to enhance computational efficiency. The neck architecture of YOLOv5s inherits and optimizes the hybrid feature pyramid structure that integrates FPN and PAN from its predecessors. The detection head architecture integrates convolutional layers, pooling operations, and fully connected layers to enable multiscale target detection within the hierarchical feature pyramid network. This architecture facilities precise joint localization through parametrized bounding boxes. The spatial coordinates and dimensional attributes of each joint are determined within the image coordinate system using the bounding box parameters.
High-fidelity tube semantic segmentation
To facilitate the precise extraction of geometric contour of the target tube, we implemented a semantic segmentation methodology on the acquired imagery data. This deep learning-based approach enables pixelwise classification and boundary delineation of structural components. The DeepLab v3+ 42 establishes a new benchmark in semantic segmentation by integrating the spatial pyramid pooling module with an encoder–decoder structure in deep neural networks. 43 It has demonstrated superior performance in detecting structural defects compared to other end-to-end deep convolutional networks. 44 However, while DeepLab v3+ excels in natural scene understanding and general classification tasks, its original design compromises edge segmentation capability which is a crucial aspect for tube deflection assessment. Specifically, the network’s inherent focus on model generalization limits its performance in precise boundary delineation, particularly for bent tube structures.
To overcome this limitation, a novel contextual transformer (CoT) block 45 is incorporated into DeepLab v3+ to improve edge detection and feature representation for segmentation of tubular components. As shown in Figure 6, CoT block extends traditional self-attention architectures 46 by incorporating neighboring contextual information, rather than relying only on isolated query key pairs at each spatial location. The proposed network is named Tb-DeepLab v3+ and illustrated in Figure 7. It is clearly shown that the Tb-DeepLab v3+ maintains the fundamental encoder–decoder framework while introducing specialized components for tube-specific feature learning.

Detailed structures of conventional self-attention block (a) and CoT block (b). (a) Conventional self-attention block. (b) CoT block. CoT: contextual transformer.

Architecture of Tb-DeepLab v3+ network.
The integration of CoT block into DeepLab v3+ enhances both the feature representation capabilities and network robustness. Through the innovative fusion of static and dynamic attention matrices, the CoT module achieves refined segmentation, particularly in edge details. 45 This improves the network’s performance in complex engineering scenarios, offering more precise recognition of structural members.
Axis extraction of tube
Following the geometric contour segmentation using the Tb-DeepLab v3+ network, axis extraction is performed to evaluate the tube deflection. The Zhang–Suen thinning algorithm is employed for its capability to generate connected, single-pixelwide skeletons while preserving topological properties.47,48
As illustrated in Figure 8, the Zhang–Suen thinning algorithm iteratively examines each boundary pixel (P1) against its neighboring pixels (P2–P8) using connectivity-preserving criteria. Specifically, it preserves critical topological features including endpoints, connection points, and internal pixels to maintain structural connectivity. This iterative process continues until no further pixels can be removed, yielding a well-defined centerline that accurately represents the tube’s geometric axis.

Neighborhood pixels schematic.
Deflection calculation of bent tube
YOLOv5s network is used to detect the joints and their centers in the acquired image. The pixel-level tube axis is then extracted using Zhang–Suen thinning algorithm. 48 The extracted tube dimensions are calibrated using the actual joint dimensions which could easily be measured to establish the pixel-to-physical conversion ratio. If the shooting angle of the image is orthogonal to the plane where the maximum bending deformation of the tube member occurs, the deflection of the member can be determined as the distance from the axis to the line connecting the centers of the joint, as shown in Figure 9.

Deflection of a tube member.
In practice, it is almost impossible to ensure that the shooting angle of the image is orthogonal to the maximum bending deformation plane of the target tube member. As a result, biangle images are used to determine the maximum bending deformation, that is, the deflection, of the target tube member.
As shown in Figure 10, the angle θ between two shooting directions can be readily controlled and measured using construction drawings or geometric models of the structure. According to projection principles, the measured deflections represent the projections of the actual deflection vector onto the respective camera incident planes. The true deflection value d can be derived from two measurement values through geometric relationship:
where a and b are the deflection values obtained from the two image captures, respectively.

Schematic of multiangle image acquisition.
In summary, the main procedures of the proposed BTD method can be represented as Figure 11.

Main procedures of BTD method. BTD: bent tube detection.
Networks establishment for bent-tube detection
Dataset building
A dataset is established for training advanced models of joint object detection and tube semantic segmentation in grid structures. The dataset comprises a total of 438 high-quality images collected from real grid structures in neighborhood and online resources. Typical examples of them are as shown in Figure 12.

Typical examples of images for dataset.
The dataset is expanded to 1750 images through data augmentation techniques, including rotation, flipping, and brightness adjustments. This process enhances data volume and diversity, and improves model robustness. Following standard machine learning practices, the dataset is partitioned into 1400 training images (80%) and 350 testing images (20%). Object labeling is conducted using the Roboflow platform to annotate the dataset with bounding boxes and class labels. Segmentation labeling is performed with the LabelMe tool, using contours of bent tubes.
Evaluation metrics
Precision, recall, and mean average precision (mAP) serve as standard metrics for quantitative evaluation of detection model performance. 49 Precision measures the accuracy of the model’s predictions by calculating the ratio of true positive predictions among all positive predictions made by the model. Recall, on the other hand, evaluates the model’s ability to identify all relevant positive instances by calculating the ratio of true positive predictions among all actual positive instances in the dataset. The precision and recall can be expressed as follows:
where TP (true positive) represents number of correctly classified positive samples; FP (false positive) denotes the number of negative samples misclassified as positive; and FN (false negative) indicates the number of positive samples misclassified as negative. The AP metric measures the precision rate averaged across all recall levels by integrating the precision-recall curve, while the mAP is the average of AP values across different classes or models.
where
The Intersection over Union (IoU) metric is a crucial measure of detection accuracy in segmentation tasks. 50 It quantifies the overlap between the predicted bounding box and the ground truth. Mathematically, IoU is defined as the ratio of their intersection area to union area:
In bent-tube detection, a higher IoU suggests more accurate segmentation of the tube member from the image. The mean IoU (mIoU) extends IoU to multiclass scenarios by averaging IoU values across all classes in the dataset. This provides a comprehensive assessment of segmentation accuracy across different bent-tube categories. Similarly, the mAP@0.5: 0.95 metric evaluates detection performance by averaging precision values across multiple IoU thresholds, specifically from 0.5 to 0.95 in steps of 0.05. This approach evaluates model performance under both relaxed (IoU = 0.5) and strict (IoU = 0.95) matching criteria, yielding a comprehensive assessment of the framework’s effectiveness.
Training processes
All our experiments are conducted using PyTorch 3.10 framework on Windows. A workstation equipped with an NVIDIA Tesla V100 (24GB GPU) and an Intel(R) Xeon(R) Silver 4314 CPU is used to run the experiments.
YOLOv5s
Transfer learning is employed to enhance optimization efficiency, utilizing the pretrained weights from YOLOv5s.pt, which are based on the COCO dataset, 51 as initialization parameters. To maintain network stability, a warm-up phase of five epochs is implemented. Training process is monitored through systematic logging weights and performance metrics. The experimental hyperparameters are detailed in Table 1.
Experimental hyperparameter values of YOLOv5s.
The performance curves depicting loss and mAP@0.5: 0.95 for the YOLOv5s model over 100 epochs, are presented in Figure 13. The transfer learning strategy enables efficient learning of abstract features, leading to rapid convergence within the first 60 epochs with mAP@0.5: 0.95 swiftly reaching 0.85. After 80 epochs, both loss and mAP curves gradually stabilize and maintain consistency until the end of the training process. The mAP@0.5: 0.95 stabilizes after reaching a high value 0.93, which indicates optimal model convergence without overfitting or underfitting.

Training loss and mAP curves of YOLOv5s. mAP: mean average precision.
Tb-DeepLab v3+ network
The hyperparameters utilized for training the Tb-DeepLab v3+ network is presented in Table 2. Training and validation losses are monitored through systematic logging. To evaluate model performance, cross-entropy loss (L CE ) and Dice loss (L Dice ) are selected. L CE measures the difference between the true labels and the predicted probabilities, guiding the training process, while L Dice assesses the sample similarity to mitigate the negative impact of foreground–background imbalance. These loss functions which complement each other in the segmentation task are as follows:
where N is the number of pixels;
Experimental hyperparameter values of Tb-DeepLab v3+.
The segmentation performance of the Tb-DeepLab v3+ network is evaluated using the established dataset, as illustrated in Figure 14. During the initial 50 epochs of freeze learning, the network converges rapidly, with loss decreasing swiftly to 0.16, indicating the effectiveness of freeze learning strategy, leveraging through the pretrained model. When transitioning to full network training with all weights unfrozen, a brief rebound in loss occurs, followed by rapid loss recovery after the 55th epoch. The loss curve gradually stabilizes after 150 epochs, with the final mIoU reaching 0.93. These results demonstrate that the improved Tb-DeepLab v3+ network achieves comparable performance to manual labeling, thus validating the effectiveness of the proposed segmentation network.

Training loss and mIoU curves of Tb-DeepLab v3+. mIoU: mean Intersection over Union.
The effectiveness of the proposed Tb-DeepLab v3+ network is evaluated through an ablation study. The results of different architectures used in the ablation experiments are presented in Figure 15. Identical parameters (e.g., dataset, learning rate) are used across all ablation experiments to ensure a fair comparison. The original DeepLab v3+ network serves as baseline. With the incorporation of the CoT block, the Tb-DeepLab v3+ network yields a 4.2% improvement in mIoU. This improvement demonstrates that the CoT module’s effectiveness in enhancing circular edge segmentation of tube fittings. Consequently, the proposed Tb-DeepLab v3+ network demonstrates superior performance for tube fittings segmenting task.

Ablation study results of Tb-DeepLab v3+.(a) Comparison of training loss. (b) Comparison of mIoU. mIoU: mean Intersection over Union.
Comparative experiments are also conducted on multiple advanced CNN-based segmentation networks using the same dataset. To ensure a fair comparison, all models are trained using a transfer learning strategy, initializing the model parameters with pretrained weights from the COCO dataset and trained for 50 epochs under identical conditions. As shown in Table 3, Tb-DeepLab v3+ achieved a high mIoU of 88.7%. This accuracy is competitive with, and in some cases surpasses, that of recent models like Mask2Former (87.1%) and is comparable to segment anything 2 (89.5%). Crucially, “Tb-DeepLab v3+” demonstrates significantly superior computational efficiency. It has substantially fewer parameters (6.72M) and lower floating point operations (FLOPs) (54.87G) compared to Mask2Former (52.3M params, 190G FLOPs) and especially Segment Anything 2 (636M params, 6.4 × 105 G FLOPs). Furthermore, with an inference speed of 51.7 ms, our model is the fastest among those evaluated, which is vital for enabling practical, near real-time inspection. The results demonstrate that our enhanced DeepLab v3+ achieves an optimal balance between the high segmentation accuracy required for precise deflection assessment and the computational efficiency necessary for a deployable engineering solution.
Comparison with state-of-the-art segmentation methods.
Both ablation studies and comparative analysis validate the effectiveness of the proposed Tb-DeepLab v3+ network for tube segmentation, demonstrating its potential for practical applications.
Experimental validation
Experimental settings
To further validate the proposed BTD method, eccentric compression tests are conducted on three circular tubes with ball joints, as illustrated in Figure 16. Steel with a nominal yield strength of 355 MPa is used for the specimens. Each specimen is made of a 1500-mm long circular tube connected to hollow spherical joints at both ends. The circular tube has an outer diameter of 114 mm and a wall thickness of 4 mm. The hollow spherical joints have a diameter of 300 mm and a wall thickness of 8 mm.

Photographs of an eccentric compressional test. (a) Before loading. (b) After loading.
The eccentric compression tests are conducted using an electrohydraulic servo machine with a maximum loading capacity of 10,000 kN. The tests employ a displacement-controlled loading procedure at a rate of 0.2 mm/min. As shown in Figure 16, knife-hinge devices are positioned at both ends of the specimen to provide pin-ended boundary conditions. Prior to testing, specimen alignment is calibrated using laser and a spirit level measurement to ensure that (i) the longitudinal axis of the tube is perpendicular to the knife-hinges and (ii) the mid-axis of the circular tube is parallel to the knife-hinges at prespecified initial loading eccentricity. Five total station reflectors and displacement meters are stuck to the tube to monitor lateral displacements during the loading process. The vertical shortening of the specimen is recorded by the displacement transducer embedded in the loading machine. Tests terminate at 80% postpeak load or unsafe deformation occurring. Lateral displacement measurements and images are collected at 4-mm vertical displacement intervals, beginning at an 8-mm vertical displacement, using a Canon EOS 50D camera.
Experimental results
Due to the slippage of the displacement meter during the experiment, only data from the total station is utilized for comparison with the proposed method. Images from the tests are processed with the YOLOv5s and the Tb-DeepLab v3+ network trained in the third section and then the deflections of the specimens are determined by employing the proposed algorithms of axis extraction, and deflection calculation.
Figure 17 compares deflections from the proposed vision-based detection method with those from the total station measurements. The shape of the line illustrates the deformation of the tube, while the inflection points indicate the deflection measurements at each point along the tube. The loading process encompasses six vertical displacement intervals of 4 mm each. The two curves representing these methods demonstrate general consistency, and the accompanying histograms illustrate that the discrepancies between the two methods are substantially smaller than the deflections. Table 4 summarizes the average maximum deflections of the three specimens at every interval from both measurements, along with the average errors and error rates of the measurements from the proposed method against the total station. It is found that the maximum error and the maximum error rate are 1.72 mm and 3.7%, respectively. This level of error is deemed to be acceptable in practical applications.

Comparison of deflections detected by vision-based method with those measured by total station. (a) Deflections corresponding to end displacement of 8 mm. (b) Deflections corresponding to end displacement of 12 mm. (c) Deflections corresponding to with end displacement of 16 mm. (d) Deflections corresponding to end displacement of 20 mm. (e) Deflections corresponding to end displacement of 24 mm. (f) Deflections corresponding to end displacement of 28 mm.
Errors between deflection measurements with different methods.
Conclusions
This study proposes a novel vision-based method for detection of bent tube with ball joints. An object-detection network using YOLOv5s is trained to identify and localize ball joints. The network convergence with mAP@0.5: 0.95 of 0.93. The DeepLab v3+ network is incorporated with CoT block to enhance its ability in edge segmentation of tube members. The enhanced DeepLab v3+ network, which is named Tb-DeepLab v3+, exhibits a 4.2% improvement in mIoU. Eccentric compression tests on three circular tubes with ball joints are conducted to verify the effectiveness of the propose method. Compared with total station measurements, the proposed method shows error rates within 3.7% which is deemed as acceptable for practical applications.
This study targets the detection of bending in circular tube members with ball joints, which are commonly used in grid structures. The proposed method is not applicable to members with different cross-sections or other types of joints. Additionally, our research currently focuses on deflection detection at the member level and has not been extended to structural-level applications. Images of members taken in real structures often suffer from occlusion by surrounding members, which can significantly limit segmentation accuracy. Moreover, images captured in real structures are constrained by access conditions, posing challenges to acquiring complete visual information of the target members and joints. These practical constraints complicate the acquisition of comprehensive and high-quality data for analysis.
To gain high-quality image from real grid structures, quadruped robots and drones will be considered as vehicles for filming equipment in our future work. In another hand, follow-up work will also focus on upgrading the adopted models based on the current research. While the YOLOv5s and Tb-DeepLab v3+ networks have demonstrated good accuracy and robustness, the rapid advancements in computer vision modeling present opportunities for improvement. We plan to explore and implement customized enhancements on latest models to further improve detection accuracy.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: The authors gratefully acknowledge the support from the National Key Research and Development Program of China (2023YFC3805602) and the Funding of Center for Balance Architecture, Zhejiang University.
