---
title: 'PGDM-Loss: Prior-Guided Masking for Depth'
url: https://www.emergentmind.com/topics/prior-guided-dynamic-mask-loss-pgdm-loss
type: topic
---

# PGDM-Loss: Prior-Guided Masking for Depth

Searching arXiv for the cited paper and closely related methods to ground the article with current identifiers.
arXiv search query: 2411.04826
Prior-Guided Dynamic Mask Loss (PGDM-Loss) denotes a loss-design perspective for self-supervised depth estimation in dynamic scenes in which priors about pixel trustworthiness are used to mask or weight photometric supervision. In the formulation made explicit by D$^3$epth, the central prior is a reprojection-error-based dynamic mask that removes pixels with jointly high reprojection error across adjacent source frames from the photometric loss; this is complemented by an inter-frame appearance-consistency prior for cost-volume construction and a spectral-entropy prior for uncertainty-aware depth fusion [2411.04826]. Within this framework, PGDM-Loss is not a separate network component but a way of organizing supervision so that regions inconsistent with the rigid-motion assumption contribute less, or not at all, to self-supervised training.

## 1. Formal setting within self-supervised monocular depth estimation

D$^3$epth is built directly on the standard self-supervised monocular scheme of Zhou et al. and Monodepth2, then modifies the loss with a dynamic mask [2411.04826]. Each training sample is a triplet of consecutive monocular images,
\[
I_{t-1},\ I_t,\ I_{t+1},
\]
with \(I_t\) as the target frame and \(I_s\), \(s\in\{t-1,t+1\}\), as source frames. Supervision is purely photometric via view synthesis, and no ground-truth depth is used.

The model employs a DepthNet and a PoseNet in a standard self-supervised pipeline. DepthNet contains a MonoDepth branch that predicts single-frame depth \(D_{\text{Mono}}\), a MultiDepth branch that predicts multi-frame depth \(D_{\text{Multi}}\) via cost volume, and a Spectral Entropy Uncertainty (SEU) module used to fuse the two predictions. The paper also follows a teacher–student distillation scheme from Xiang et al. [33], although the pose estimation network is not detailed in the provided description [2411.04826].

Target-view synthesis is defined as
\[
I_{s \rightarrow t} = I_s\left\langle \text{Proj}(D_t,\ T_{t \rightarrow s},\ K) \right\rangle,
\]
where \(K\) is the camera intrinsics, \(\text{Proj}(\cdot)\) projects pixels from the target frame into the source frame using depth and pose, and \(\langle\cdot\rangle\) denotes differentiable sampling. The photometric error is
\[
pe(\boldsymbol{I}_a,\boldsymbol{I}_b) = \frac{\alpha}{2}\left(1 - SSIM(\boldsymbol{I}_a,\boldsymbol{I}_b)\right) + (1-\alpha)\left\|\boldsymbol{I}_a - \boldsymbol{I}_b\right\|_1. \tag{1}
\]
Following Monodepth2, the baseline photometric term is the per-pixel minimum reprojection loss
\[
\mathcal{L}_{ph}(\boldsymbol{I}_t,\boldsymbol{I}_{s\to t}) = \min_{s} pe(\boldsymbol{I}_t,\boldsymbol{I}_{s\to t}), \quad s \in \{t-1,t+1\}. \tag{2}
\]

In the PGDM-Loss interpretation, this baseline is not discarded; rather, it is reweighted spatially by priors that identify where rigid-view synthesis is unreliable. The significance of the formulation is therefore not a change in the self-supervised paradigm itself, but a change in which pixels are permitted to define the photometric training signal.

## 2. Reprojection-error prior and dynamic-mask construction

The central prior in D$^3$epth is that pixels with high reprojection error in both adjacent source views are likely to correspond to dynamic objects, occlusion regions, or strong photometric violations, which are precisely the locations where self-supervised geometry from rigid motion is unreliable [2411.04826]. For each source frame \(s\in\{t-1,t+1\}\), the method computes a synthesized image and a per-pixel reprojection error:
\[
I_{s \rightarrow t} = I_s\left\langle \text{Proj}(D_t,\ T_{t \rightarrow s},\ K) \right\rangle,
\]
\[
L_{\text{reproj}}^{(s)}(u,v) = pe\big(I_t(u,v), I_{s\rightarrow t}(u,v)\big).
\]

Stacking the two source-view errors yields
\[
\mathbf{L}_{\text{reproj}} \in \mathbb{R}^{B \times C \times H \times W},\quad C=2,
\]
where the two channels correspond to \(s=t-1\) and \(s=t+1\). For each channel \(c\in\{1,2\}\), the spatial dimensions are flattened,
\[
\mathbf{L}_{c} = \text{Flatten}\big(\mathbf{L}_{\text{reproj}[:, c, :, :]}\big) \in \mathbb{R}^{B \times (H \times W)},
\]
and a quantile threshold \(q_c\) is computed,
\[
q_c = Q_\beta(\mathbf{L}_{c}),
\]
with \(\beta\) controlling the cutoff; the example given is \(\beta=0.8\), corresponding to the top 20% highest reprojection errors per source view.

Binary high-loss masks are then defined as
\[
\mathbf{M}_{c}(u,v) = \mathbb{I}\big( \mathbf{L}_{\text{reproj}[:, c, u, v]} > q_c \big). \tag{3}
\]
The dynamic mask is
\[
\mathbf{M}_{\text{dynamic}} = 1 - \big(\mathbf{M}_{1} \land \mathbf{M}_{2}\big). \tag{4}
\]

This mask is explicitly a keep-mask. A pixel is retained when at least one source view does not exhibit extremely high error, and it is excluded only when both source views are highly inconsistent. Pixelwise, \(\mathbf{M}_{\text{dynamic}}(u,v)=0\) denotes a dynamic, occluded, or otherwise outlier-like location as judged by the dual-view reprojection prior, while \(\mathbf{M}_{\text{dynamic}}(u,v)=1\) indicates that the pixel remains in photometric supervision [2411.04826].

The thresholding strategy is adaptive rather than based on a fixed absolute error. This matters because it makes the mask depend on the current reprojection-error distribution in each batch item. A plausible implication is that the mask is less sensitive to scale shifts in photometric error than a fixed-threshold alternative, although the provided description does not report a direct comparison.

## 3. Loss integration and the PGDM-Loss formulation

The total objective in D$^3$epth is
\[
\mathcal{L}_{\text{total}} = \mathcal{L}_{\text{Mono}}(D_{\text{Mono}}) +\mathcal{L}_{\text{Multi}}(D_{\text{Multi}}) +\mathcal{L}_{\text{Fuse}}(D_{\text{Fuse}}), \tag{5}
\]
where each branch-specific loss takes the form
\[
\mathcal{L}(D) = \mathcal{L}_{ph}(D)\cdot \mathbf{M}_{\text{dynamic}} + \gamma\,\mathcal{L}_{s}(D),\quad \gamma=0.001. \tag{6}
\]
The masked photometric term is written explicitly as
\[
\mathcal{L}_{ph}^{\text{masked}}(D) = \sum_{u,v} \mathbf{M}_{\text{dynamic}}(u,v)\; \min_{s} pe\big(I_t(u,v), I_{s\rightarrow t}(u,v)\big). \tag{7}
\]
The smoothness term is the standard edge-aware regularizer,
\[
\mathcal{L}_s(D)
  =   \sum_{u,v} |\partial_x D(u,v)| e^{-|\partial_x I_t(u,v)|}
  + |\partial_y D(u,v)| e^{-|\partial_y I_t(u,v)|}.   \tag{18}
\]

A defining property of this PGDM-Loss instantiation is that the smoothness term is not masked. The paper states that it still regularizes the depth even in regions not supervised photometrically [2411.04826]. Thus, the loss does not simply discard dynamic or unreliable regions altogether; it suppresses their direct photometric contribution while preserving regularization over the full field.

The practical effect is stated directly: high-error pixels in both source views are removed from photometric supervision, preventing them from pulling the network toward incorrect depths while still retaining gradients in well-behaved pixels [2411.04826]. This also clarifies a common misunderstanding. The dynamic mask is not an additional prediction head and not an explainability mask learned from scratch; it is a binary gating variable derived from reprojection statistics.

From the more general PGDM-Loss perspective provided in the source, the same pattern can be abstracted as
\[
\mathcal{L}_{\text{PGDM}} = \sum_{u,v} \underbrace{w(u,v)}_{\text{prior-guided mask}} \cdot \ell_{\text{photo}}(u,v) + \lambda\, \ell_{\text{reg}}(u,v),
\]
with \(w(u,v)\in[0,1]\) interpreted as a prior-guided weight. In D$^3$epth, the realized form is binary and driven primarily by reprojection-error quantiles [2411.04826].

## 4. Auxiliary priors beyond the loss-level dynamic mask

D$^3$epth supplements the loss-level dynamic mask with two additional priors: a cost volume auto-mask based on inter-frame appearance consistency, and a spectral-entropy prior over cost-volume reliability [2411.04826]. These are not identical to the dynamic mask, but they belong to the same broader PGDM-Loss design logic in which priors determine which evidence should influence depth estimation.

For the multi-frame branch, features from the reference and source views are used to construct a cost volume over depth or disparity hypotheses. Before cost-volume construction, the method defines a pixelwise equality mask
\[
\mathbf{M}_{\text{eq}}(u,v) = \begin{cases}
1 & \text{if } \mathbf{I}_t(u, v) = \mathbf{I}_{t-1}(u, v), \\
0 & \text{otherwise},
\end{cases} \tag{8}
\]
and then
\[
\mathbf{M}_{\text{cost}}(u,v) = 1 - \mathbf{M}_{\text{eq}}(u,v). \tag{9}
\]
After downsampling according to feature scale,
\[
\mathbf{M}_{\text{down}}(u', v') = \mathbf{M}_{\text{cost}}\left( \left\lfloor \frac{u'}{s} \right\rfloor,\, \left\lfloor \frac{v'}{s} \right\rfloor \right), \tag{10}
\]
the mask is applied elementwise to feature maps,
\[
\mathbf{F}_{\text{ref}}'(u', v') = \mathbf{F}_{\text{ref}}(u', v') \odot \mathbf{M}_{\text{down}}(u', v'), \tag{11}
\]
\[
\mathbf{F}_{\text{source}}'(u', v') = \mathbf{F}_{\text{source}}(u', v') \odot \mathbf{M}_{\text{down}}(u', v'). \tag{12}
\]

The stated prior intuition is that pixels whose appearance is unchanged between frames carry no useful parallax, for example because the camera is stationary or the region is co-moving with the camera. The method therefore ignores them in cost-volume matching by zeroing the corresponding features [2411.04826]. Importantly, this mask does not appear explicitly in the loss; it modifies the features that produce \(D_{\text{Multi}}\), and thereby influences the losses on \(D_{\text{Multi}}\) and \(D_{\text{Fuse}}\).

The third prior is spectral entropy. Let \(C\) denote a cost probability tensor. The SEU module applies a Fourier transform,
\[
\hat{C} = FFT(C), \tag{13}
\]
computes the magnitude spectrum \(M = |\hat{C}|\), normalizes it into a distribution \(P\), and defines spectral entropy as
\[
H = -\sum_k P_k \cdot \log(P_k + \epsilon). \tag{15}
\]
A small neural network maps \(H\) to an uncertainty map \(U\), which is then used for depth fusion:
\[
D_{\text{Fuse}} = (1 - U) \cdot D_{\text{multi}} + U \cdot D_{\text{mono}}. \tag{16}
\]

The interpretation given in the source is that high spectral entropy indicates a more complex or noisy pattern and hence higher uncertainty, whereas low spectral entropy indicates a more structured signal and lower uncertainty [2411.04826]. This module is trained implicitly: there is no explicit loss directly on \(H\) or \(U\); instead, gradients pass through the fused depth term because \(D_{\text{Fuse}}\) is supervised by the same masked photometric-plus-smoothness loss.

## 5. Generalization as a prior-guided masking framework

The source explicitly relates D$^3$epth to the notion of a “Prior-Guided Dynamic Mask Loss” and identifies three priors: a photometric reprojection error prior, an inter-frame appearance consistency prior for the cost volume, and a spectral entropy prior over cost-volume reliability [2411.04826]. All three are described as priors on which pixels and which depth hypotheses are trustworthy, implemented as masks or weights inside the training objective.

Under this interpretation, a generalized PGDM-Loss can combine multiple prior-guided factors,
\[
w(u,v) = f\big( w_{\text{reproj}}(u,v),\  w_{\text{appearance}}(u,v),\  w_{\text{spectral}}(u,v) \big),
\]
where the reprojection prior may follow D$^3$epth’s binary dual-view rule, the appearance prior may down-weight pixels with unchanged raw RGB values, and the spectral prior may modulate confidence in multi-frame supervision through spectral entropy. The source also notes possible alternatives, such as soft masks, learned thresholds, temporal smoothing of masks, and spatial regularization, but presents these as generalization directions rather than as implemented components of D$^3$epth [2411.04826].

Several design axes are made explicit. First, there is a binary-versus-soft choice. D$^3$epth uses a binary dynamic mask \(\mathbf{M}_{\text{dynamic}}\in\{0,1\}\) and a binary cost-volume auto-mask. The source notes that a PGDM-Loss could instead use soft masks, for example via a sigmoid of normalized reprojection error, in order to down-weight rather than fully ignore suspect pixels. Second, there is a static-versus-adaptive threshold choice. D$^3$epth uses quantile-based adaptive thresholds \(q_c=Q_\beta(\cdot)\), which depend on the current error distribution. Third, there is a consistency choice: the implemented method handles each training sample independently, whereas a more advanced PGDM-Loss could impose temporal or spatial regularity on the mask.

The source also situates D$^3$epth relative to existing strategies. Monodepth2 uses minimum reprojection plus auto-masking to handle occlusions and static pixels, but can fail in dynamic scenarios where both reprojection errors are high. D$^3$epth adds the dynamic mask as a complement: when both views are bad, the contribution is suppressed entirely [2411.04826]. The source further contrasts this with explainability masks in Zhou et al., which are learned mask networks; D$^3$epth instead uses hand-crafted priors based on reprojection, appearance consistency, and spectral entropy.

## 6. Empirical behavior, implementation details, and limitations

The implementation details reported for D$^3$epth are directly relevant to the PGDM-Loss interpretation. The architecture uses a DepthNet with a standard encoder–decoder backbone from Xiang et al. [33]. The multi-frame branch uses a cost volume constructed between \(I_t\) and an adjacent frame, with features masked by the cost-volume auto-mask. The SEU module is a small network that takes the spectral entropy map as input and outputs the uncertainty map \(U\) [2411.04826].

For the dynamic mask, the reported hyperparameter is \(\beta=0.8\), corresponding to the top 20% highest reprojection errors per source view. On KITTI, the dynamic mask is applied from epoch 0; on Cityscapes, it is applied from epoch 1 to allow initial stabilization. Training uses Adam with learning rate \(2\times 10^{-4}\) for the teacher and \(1\times 10^{-4}\) for the student, with a 10\(\times\) decay schedule, batch size 12, and 20 epochs on KITTI and 5 epochs on Cityscapes [2411.04826].

The empirical results support the claim that the dynamic-mask prior is most consequential in scenes rich in dynamics. On KITTI, dynamic objects are stated to be rare, approximately \(0.34\%\) of pixels, so improvements are modest but still SOTA or near-SOTA. On Cityscapes, D$^3$epth reduces AbsRel to \(0.097\) and raises \(\delta<1.25\) to \(0.909\), outperforming several dynamic-aware baselines [2411.04826].

The ablation study on Cityscapes isolates the contribution of the individual priors. For single-frame inference, the baseline is AbsRel \(0.105\), \(\delta_1\) \(0.891\); adding DM yields AbsRel \(0.104\), \(\delta_1\) \(0.899\); adding CAM yields AbsRel \(0.101\); adding SEU yields AbsRel \(0.102\); and the full single-frame D$^3$epth model yields AbsRel \(0.102\), \(\delta_1\) \(0.904\). For multi-frame inference, the baseline is AbsRel \(0.102\), \(\delta_1\) \(0.892\); adding DM yields AbsRel \(0.100\), \(\delta_1\) \(0.904\); adding CAM yields AbsRel \(0.100\); adding SEU yields AbsRel \(0.101\); combining DM and CAM yields AbsRel \(0.099\), \(\delta_1\) \(0.904\); and the full multi-frame D$^3$epth model yields AbsRel \(0.097\), \(\delta_1\) \(0.909\), the best result in the reported table [2411.04826]. The FFT ablation further reports AbsRel \(0.099\), \(\delta_1\) \(0.905\) without FFT and AbsRel \(0.097\), \(\delta_1\) \(0.909\) with FFT.

The advantages reported by the authors are that the dynamic mask provides a simple but robust prior-guided mask based purely on reprojection-error statistics without extra networks, and that CAM and SEU incorporate multi-frame and frequency-domain priors without inference-time overhead [2411.04826]. The limitations are equally explicit: high reprojection error is not uniquely caused by dynamics, since textureless areas, strong illumination changes, and motion blur can also produce high loss; the dynamic mask may therefore suppress some static regions that are merely difficult to reconstruct. The authors state that future work will focus on better distinguishing high-loss regions caused by dynamics from inherently hard regions.

These observations define the scope of PGDM-Loss as exemplified by D$^3$epth. Its operative principle is not that every high-error region is dynamic, but that self-supervised photometric learning in dynamic scenes benefits when such regions are treated as unreliable unless corroborated by stronger geometric or appearance-based priors [2411.04826].

Source: https://www.emergentmind.com/topics/prior-guided-dynamic-mask-loss-pgdm-loss