# Self-Supervised Keypoint Learning for the Geometric Analysis of Road-Marking Templates
## 3 Methodology
### Synthetic Template Dataset  
This dataset comprises synthetic template images generated from vector graphics of the five arrow-based road-marking types considered 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. These templates are initially simple binary images (black background and white markings), with a consistent resolution of 224 \(\times\) 224 pixels.  
The choice of a synthetic template dataset was primarily driven by its significant advantages for self-supervised keypoint learning. Synthetic data enable the easy and precise generation of ground-truth masks, which are crucial for our Inside Mask Loss (\(L_{mask}\)), and allow for rigorous control over geometric transformations, facilitating robust data augmentation. This ensures that the training data consistently contain accurate and well-defined features, essential for training a model in a self-supervised manner without manual keypoint annotations.  
For training, we extensively augmented these base templates dynamically during each iteration, using various geometric and photometric transformations from the Albumentations library [28]. The augmentation consisted of several photometric transformations, including brightness, contrast, noise, random posterize, random solarize, random adjust sharpness, and random autocontrast, each applied with a probability of 0.7. Geometric  
Figure 2: Examples from the synthetic dataset used in this work. The **upper row** shows base synthetic template images, illustrating the clean, ideal forms of different road-marking templates. The **lower row** shows augmented versions of synthetic template images, demonstrating the types of geometric and photometric transformations applied during training (e.g., rotation, scaling, perspective changes, and noise). Each ‘Class ID’ refers to a specific road-marking sign type (e.g., straight arrow and left-turn arrow), and these IDs are used to select the corresponding class-specific prediction head in the network.  
transformations included ElasticTransform, rotation within the range of (\(-15\), \(15\)) degrees, scaling between \(0.5\) and \(1.0\), translation within (\(-0.05\), \(0.05\)) of the image height/width, and shear within the range of (\(-10\), \(10\)) degrees. The affine transformation was applied with a probability of \(0.8\), while the other geometric transformations (ElasticTransform, rotation, scaling, shear, and translation, excluding affine transformations) were each implemented with a probability of \(0.7\).  
We specifically excluded horizontal and vertical flips due to the potential changes in the class identity for certain road markings. This process successfully produced a diverse array of augmented template instances for training, including two thousand augmented instances for each of the five classes, resulting in a total of ten thousand images for Stage 1 pre-training. Additionally, we generated \(500\) images per class, amounting to \(2500\) images for Stage 2.  
For quantitative evaluation, a separate synthetic test set was created. This test set comprises five hundred affine-transformed images for each of the five template classes, totaling two thousand five hundred images. These transformations were applied to the base templates to simulate geometric variations and evaluate the model's ability to predict consistent keypoints under such changes, forming the basis for template-to-transformed-template alignment experiments.