## 4 Proposed Methodology
### The Deep Learning Detections
#### 4.2.2 RT-DETR: Real-Time Detection Transformer  
RT-DETR is a real-time version of the DETR model. DETR is a transformer-based object detection model that formulates object detection as a set prediction problem, bypassing the need for anchor boxes and allowing for end-to-end training [27]. In this paper, we leverage RT-DETR (Real-Time Detection Transformer) for the real-time detection and classification of dental issues. RT-DETR uses a Vision Transformer (ViT) as its backbone. The ViT processes multiscale features by separating intra-scale interaction from cross-scale fusion. This transformer model allows us to perform high-speed and high-precision detections, making it suited for practical dental diagnostics as shown inFigure 1. The RT-DETR incorporates ViT for decoupling from image input. This allows the model to use ViT's ability to effectively capture global and local features by focusing on itself. The ViT of RT-DETR represents the integration of transformer-based vision models with state-of-the-art object recognition systems, which empowers powerful and efficient real-time recognition capabilities by enabling ViT to be used to capture spatial relationships and global conditions in images. After preparing the dataset as explained in the following subsection, we apply RT-DETR through the steps of Algorithm 1. RT-DETR is a variant of the transformer-based architecture tailored for object detection. Traditional detection methods, such as YOLO, rely on convolutional neural networks (CNNs), but transformers, originally designed for NLP tasks, have shown powerful capabilities in vision tasks as well. However, one of the limitations of early transformer-based detection methods (like DETR) is their slow inference speed. RT-DETR addresses this by optimizing transformers for real-time object detection. The core idea of using transformers in object detection is to leverage self-attention mechanisms to capture long-range dependencies between image features. Transformers excel at handling complex relationships between different parts of an image, making them ideal for learning global context for detection. The Attention Mechanism is computed as in (8)  
\[\text{Attention}(Q,K,V)=\text{softmax}\bigg{(}\frac{QK^{T}}{\sqrt{d_{k}}} \bigg{)}V \tag{8}\]  
where \(Q\) (Query), \(K\) (Key), and \(V\) (Value) are projections of the input image feature embeddings; dk is the dimension of the key vector. Similar to other detection architectures, RT-DETR uses a backbone network (often a CNN or a vision transformer variant) to extract feature maps from the input image. The feature extractor reduces the spatial dimensions of the image while retaining important details for the detection task. In the transformer encoder-decoder stage, the encoder takes the feature map from the backbone and applies a series of multi-head attention and feedforward layers to process the features. Then, the decoder generates object queries that are responsible for detecting objects in the image. Instead of sliding windows (as in CNN-based approaches), RT-DETR uses object queries to predict the bounding boxes directly from the image's global context. In the learnable object queries stage, RT-DETR, like DETR, uses a fixed number of learnable object queries, each one responsible for detecting a specific object in the image. These queries are passed through the decoder and used to predict bounding boxes and class labels. One of the critical innovations in RT-DETR is the efficiency improvements in the architecture that allow it to run in real-time, a significant improvement over early transformer-based models like DETR, which are computationallyexpensive. This efficiency comes from reducing the number of transformer layers and optimizing operations like self-attention, as well as parallelization of computations.