## 3 The Materials and Methods
### Loss Function  
A comprehensive face recognition system must learn to produce highly discriminative embeddings even in the presence of noisy labels, modality imbalance, and unpredictable visual distortions. These models undergo even more significant strain when diverse input spaces such as RGB, NIR, and event streams are utilized, especially when the model is uncertainty-aware, as in HUE-Net (Figure 3). To accomplish these goals, we develop a composite loss function that simultaneously optimizes identity separability, uncertainty estimation regularization, and inter-modal spectral consistency reinforcement. Fundamental to our approach is the angular margin softmax loss, which has gained immense popularity in the recent face recognition literature due to its efficacy in augmenting inter-class separation and the compactness of intra-class embeddings. We enhance this with two auxiliary loss components, one based on Bayesian variational inference and the other on cross-modal embedding alignment, to provide strong guidance in the deterministic and stochastic sections of the network. The composite objective function can be stated as  
\[L_{T}=L_{id}+\lambda_{1}\times L_{uncertainty}+\lambda_{2}\times L_{ consistency} \tag{16}\]  
where \(L_{id}\) governs the classification performance, \(L_{uncertainty}\) regulates variational inference in the perturbed multi-branch variational module (PMB-VM), and \(L_{consistency}\) encourages stability across spectral embeddings. The coefficients \(\lambda_{1}\) and \(\lambda_{2}\) are empirically chosen to balance the relative contributions of each component. To enforce discriminative power in the identity embedding space, we adopt the ArcFace loss (also known as additive angular margin softmax):  
\[L_{id}=\frac{1}{N}{\sum_{i=1}^{N}log\frac{e^{s\times cos(\theta_{y_{i}+m})}}{e ^{s\times cos(\theta_{y_{i}+m})}+\sum_{j\
eq y_{i}}e^{s\times cos(\theta_{j})}}} \tag{17}\]  
Here, \(N\) is the batch size, \(\theta_{j}\) is the angle between the normalized embedding vector \(z_{i}\) and the normalized weight vector \(\omega_{j}\) for class \(j\), is a scaling factor, and mmm is the additive  
Figure 3: This composite loss function breakdown line chart visualizes how each component of the total loss evolves over training epochs. angular margin that enhances decision boundaries. The formulation promotes the model's ability to capture embeddings that are tightly clustered for the same identity and impose large angular separations between different identities. Since HUE-Net applies variational sampling in PMB-VM for estimating epistemic uncertainty, it is crucial to constrain the process with a probabilistic objective. Under the Bayes-by-Backprop paradigm, a Kullback-Leibler divergence component is incorporated along with the learned variational posterior \(q(\omega)=N\big{(}\mu,\sigma^{2}\big{)}\) and a prior \(p(\omega)=N(0,1)\). \[L_{uncertainty}=KL[q(\omega)||p(\omega)]=\frac{1}{2}{\sum_{i=1}^{d}}\Bigg{(}log \frac{1}{\sigma_{i}^{2}}+\frac{\sigma_{i}^{2}+\mu_{i}^{2}-1}{1}\Bigg{)} \tag{18}\]  
This regularization guarantees that the learned weights for each stochastic branch do not diverge too much from the prior, which helps mitigate overconfidence and stabilize uncertainty estimation. Also, the network encourages consistent output by requiring stochastic embeddings to be sampled multiple times during training, producing an average prediction. While ASA guarantees that the network focuses on the most relevant modalities, it is equally vital that identity embeddings do not vary across spectral domains. To achieve this, we propose a spectral consistency loss that alleviates the Euclidean distance between embeddings sourced from different spectral subspaces, such as RGB-only and NIR-only:  
\[L_{consistency}=\frac{1}{N}{\sum_{i=1}^{N}}\sum{(m,n)}\Big{\|}z_{i}^{(m)}-z_{i }^{(n)}\Big{\|}_{2}^{2} \tag{19}\]  
where \(z_{i}^{(m)}\) and \(z_{i}^{(n)}\) are the identity embeddings computed from two distinct modality subsets for the same sample.