# Self-Supervised Keypoint Learning for the Geometric Analysis of Road-Marking Templates
## 3 Methodology
### Network Architecture  
The **GeoTemplateKPNet** (Figure 3) employs a multi-head architecture based on a shared convolutional neural network (CNN) backbone, which we denote as the function \(\phi\). In our experiments, we explore different pre-trained backbone networks for \(\phi\), including ResNet-50 [29] or VGG-16 [30]. The backbone (\(\phi\)) takes an input image (\(I\in\mathbb{R}^{B\times 3\times H_{in}\times W_{in}}\)), where B is the batch size and \(H_{in},W_{in}\) are the input image's height and width, and extracts a feature representation (\(F=\phi(I)\)). The spatial dimensions of the feature map (\(F\)) depend on the specific backbone architecture and the layer from which features are extracted. To achieve a desired final heatmap resolution, features are typically extracted from an intermediate layer of the backbone, where the spatial dimensions are \(H_{b}\times W_{b}\). For instance, with a \(224\times 224\) input image, features might be extracted from a layer yielding a spatial size of \(14\times 14\) (corresponding to a total stride of \(16\) from the input). To handle the five main road-marking classes used in this work--a straight arrow, a straight arrow with a turn-left arrow, a straight arrow with a turn-right arrow, a turn-left arrow, and a turn-right arrow--the network employs \(N_{cls}=5\) class-specific prediction heads. Each head can be viewed as a function (\(\psi_{c}\)), where \(c\in\{0,\dots,N_{cls}-1\}\) is the class ID. Given an input image (\(I\)) of class \(c\), the corresponding features (\(F=\phi(I)\)) are routed to the specific head (\(\psi_{c}\)). Each head (\(\psi_{c}\)) is designed to predict \(K\) keypoints tailored to its specific class geometry. In this work, we explored different values for the number of keypoints (\(K\)) per class, specifically testing \(K\in\{3,4,5\}\). The architecture described hereafter and detailed in Table 1 corresponds to the configuration for \(K=5\), which was found to yield the best performance within this tested range (See the results in Section 4). The keypoint predictions for an input image (\(I\)) of class \(c\) are represented as a set of \(K\) heatmaps, denoted as \(H_{pred}=\psi_{c}(\phi(I))\). The spatial resolution of these heatmaps (\(H_{out}\times W_{out}\)) is determined by the backbone's feature map size (\(H_{b}\times W_{b}\)) and the head's total upsampling factor (\(U\)), such that \(H_{out}=H_{b}\times U\) and \(W_{out}=W_{b}\times U\). In our setup with \(224\times 224\) input images and features extracted at \(14\times 14\), the heads are designed to produce heatmaps with a resolution of \(56\times 56\) pixels (\(14\times 4=56\)), implying a total upsampling factor of \(U=4\). Each class-specific head (\(\psi_{c}\)) has the architecture detailed in Table 1. The heads primarily consist of transpose convolutional layers for upsampling, standard convolutional layers for feature refinement, and batch normalization and ReLU activations. Dropout layers are incorporated within the heads to provide regularization and enhance the model's generalization capability by mitigating overfitting. A dropout rate of 0.5 was applied. It is important to note that these dropout layers are active exclusively during the training phase to introduce stochasticity and prevent the co-adaptation of neurons. During the testing, the dropout layers are entirely deactivated to ensure deterministic and consistent predictions, which is standard practice in deep learning. These layers are omitted from the main architectural table for the clarity of the core structural components.