
\begin{algorithm}[H]
\caption{Semantic-rarity and Boundary-aware (SRB) Modulator (cf.\ Eq.~(11)–(13))}
\label{alg:srb}
\begin{algorithmic}[1]
\Require Rendered $\hat{\mathbf{I}}$, ground truth $\mathbf{I}$, pseudo labels $S$, percentile $p$, weights $w_{\mathrm{rare}}, w_{\mathrm{edge}}, w_{\mathrm{base}}$
\Ensure $\mathcal{L}_{\mathrm{SRB}}$
\State Compute per-class pixel counts on a subset, $\mathcal{R}\leftarrow$ classes below the $p$-th percentile (excluding background)
\State $\mathcal{B}\leftarrow \{\mathbf{u}\mid S(\mathbf{u})\neq S(\mathbf{u}+\mathbf{e}_x)\ \text{or}\ S(\mathbf{u})\neq S(\mathbf{u}+\mathbf{e}_y)\}$
\For{each pixel $\mathbf{u}\in\Omega$}
  \State $w(\mathbf{u})\leftarrow 
  \begin{cases}
  w_{\mathrm{rare}}, & S(\mathbf{u})\in\mathcal{R}\\
  w_{\mathrm{edge}}, & \mathbf{u}\in\mathcal{B}\\
  w_{\mathrm{base}}, & \text{otherwise}
  \end{cases}$
\EndFor
\State $\mathcal{L}_{\mathrm{SRB}}\leftarrow \frac{1}{|\Omega|}\sum_{\mathbf{u}\in\Omega} w(\mathbf{u})\,\lVert \mathbf{I}(\mathbf{u})-\hat{\mathbf{I}}(\mathbf{u})\rVert_1$
\State \Return $\mathcal{L}_{\mathrm{SRB}}$
\end{algorithmic}
\end{algorithm}
