## 1 Introduction  
In-line inspection (ILI) plays a crucial role in pipeline management, ensuring the safety and reliability of natural gas pipelines. A pipeline inspection gauge (PIG) is a device widely used in ILI to measure irregularities in the pipe, including corrosion, cracks, and deformations [1, 2, 3]. In natural gas pipelines, a PIG is passively moved by the pressure of the gas flow over hundreds of kilometers, carrying various sensors, including magnetic, acoustic, optical, etc. For efficient data collection, a PIG is required to move at a stable speed. However, features such as elbows, T-junctions, significant thickness changes, or heavy welds can cause a PIG device to become stuck. Once the pressure builds up behind a PIG device, it can result in sudden speed surges reaching tens of meters per second [4, 5]. This phenomenon, known as speed excursion, not only prevents the sensors from fully collecting data but also incurs damage to PIGs and pipelines. In lower-pressure pipelines, the speed excursion is even more severe, making them nearly impossible for PIG operation. To address this problem, newer PIG systems are equipped with advanced mechanisms like pressure controls and active joints to regulate the speed to smoothly move through elbows, T-junctions, significant thickness changes, or heavy welds. Detecting and estimating these features along the pipeline plays a key role in the success of these control mechanisms. While significant thickness change and heavy welds need adaptive pressure controls, elbows and T-junctions require much more complicated control maneuvers involving both pressure controls and active joints. This paper focuses on elbow and T-junction detection and estimation (ETDE). The ETDE problem involves detecting elbows and T-junctions as well as estimating their critical parameters to enable PIG devices to navigate through these features smoothly. For elbows, these parameters consist of the distance to the elbow, its direction, radius, and length. Similarly, T-junction parameters include the distance to the T-junction, the direction of its branch, the branch radius, and the length of the T-junction. To be integrated into PIG systems, ETDE must address two key constraints: limited processing power and real-time operation. ETDE is performed on the PIG processing unit with limited processing power due to the limited battery and long operating distance. It also needs to perform ETDE in real-time to promptly react to the existence of elbows and T-junctions. These conflicting constraints present significant challenges to the ETDE problem. Given these constraints, ETDE needs to provide early and reliable detection to support maneuvering in high-speed movement while achieving reasonable accuracy. The existing approaches for ETDE rely on either contact sensors [6, 7], 2D cameras [8, 9, 10, 11], stereo camera [12, 13], or 3D ranging sensors [14, 15]. While contact sensors approaches [6, 7] offer low-complexity solutions, they are unsuitable for PIGs due to delayed detection and the potential for PIG and pipe damage at high speeds. On the other hand, cameras [8, 9, 10, 11] and stereo 2D cameras [12, 13] suffer from inherently high complexity due to image processing. The 3D ranging sensors are a promising approach for ETDE in PIG systems. However, the existing approach [14, 15] requires high computation power for processing the entire point cloud, making them impractical under real-time and resource-constrained conditions. To overcome these challenges, ETDE solutions must be carefully designed and optimized to account for the unique geometric characteristics of elbows and T-junctions, ensuring both computational efficiency and real-time performance. In this paper, we propose a real-time elbow and T-junction detection and estimation (RT-ETDE) framework, designed to address the challenges of computational efficiency and real-time processing in PIG systems.