## 4 VRFormer
### VR Detection Module: CNN for Spatial Feature Extraction  
The VR detection module serves as the perceptual core of VRFormer, designed to extract environmental features from multi-channel sensory inputs such as multi-camera imaging and LiDAR. This module employs a CNN to process high-dimensional sensory data from VR environments, detecting spatial, visual, and temporal patterns. As the foundational component of VRFormer, the CNN-based module effectively interprets multi-modal data from VR simulations and sensor inputs, including LiDAR, radar, and RGB cameras.  
CNN Architecture  
The input layers of the VR detection module play an essential role in receiving and preprocessing multi-channel sensory data from various sources. These data include RGB images \((with\ shape\ (height,width,3))\), detailed point clouds from LiDAR, and depth maps generated through radar sensors. Each sensor modality is processed separately to capture a diverse range of environmental features, with each modality represented as a distinct channel.  
The CNN architecture uses multiple convolutional layers arranged into blocks. These layers are structured to progressively detect increasingly complex features. In particular, the CNN consists of four convolutional layers: the first applies 64 filters using a 3 \(\times\) 3 kernel with a stride of 1 and padding of 1, designed for fine-grained detail capture; the second layer increases to 128 filters, maintaining the same 3 \(\times\) 3 kernel; the third layer increases to 256 filters, utilizing a 5 \(\times\) 5 kernel for detection of broader spatial patterns; and the fourth uses 512 filters with a 5 \(\times\) 5 kernel, balancing detailed and larger-scale feature detection. Empirical studies informed the kernel size selection; 3 \(\times\) 3 kernels effectively capture fine details, while 5 \(\times\) 5 kernels are suited to detecting larger patterns. The use of larger kernels is not beneficial because of diminishing returns in accuracy and an increase in computational costs.  
To optimize data handling and reduce computational load within VRDeepSafety, pooling layers are introduced between the convolutional blocks. Each convolutional layer is followed by a Rectified Linear Unit (ReLU) activation to introduce non-linearity into the model; max-pooling with 2 \(\times\) 2 windows is applied after each convolution to reduce spatial dimensions and improve computational efficiency while retaining essential features. The final output of the VR detection module is a BEV map, typically 64 \(\times\) 64, though this is adjustable based on input size within VRDeepSafety. The BEV transformation combines features from all sensor channels into a top-down view, which is essential for tasks such as object detection, lane tracking, and spatial positioning; this representation enables real-time decision-making by VRFormer, including both vehicle and pedestrian tracking.  
The specific kernel sizes of 3 \(\times\) 3 and 5 \(\times\) 5 balance the need for capturing both fine details and broader spatial features. Larger kernels were found to provide limited accuracy increases with higher computational costs. A four-layer configuration proved to be optimal for hierarchical feature extraction without unnecessary complexity. Max-pooling was specifically selected for its efficiency in retaining important features while reducing computational requirements, making it favorable to average pooling. This CNN-based configuration enables VRFormer to process multi-modal data effectively within VRDeepSafety, generating spatially precise representations ideal for complex and dynamic environments.