Wavelet-Supervised Glass Segmentation with No Inference-Time Spectral Cost

Glass, windows, bottles and mirrors break a basic assumption of computer vision: that an object has its own appearance. The inside of a pane of glass is mostly whatever sits behind it. Segmentation networks therefore learn to label glass interiors as "background." When the background is plain, as with a cup in front of a white wall, the refraction cues that some detectors rely on vanish entirely. The only stable evidence is at the object's outline. That evidence includes thin frames, rims, specular highlights, and the place where transmitted texture shifts.

Separately, frequency analysis tools such as wavelets have been shown to pull structural outlines apart from scene "style" like color and illumination, both in opaque-object detection and in medical segmentation. They have never been used on transparent objects. They also cost something at test time: extra transform layers, multi-band attention, and complex-number tensors. This note proposes using wavelets only to shape the training signal. The network is taught, at several scales, exactly where the mask's outline must be, and taught that its answer must not change when the background is altered away from that outline. At test time the network is the unchanged spatial base model, so the spectral idea adds no latency.

Core Claim

For objects whose interior appearance is borrowed from the background, the benefit of frequency disentanglement can be moved entirely into the loss. The loss has two parts.

The first is a multi-scale wavelet boundary loss on the predicted and ground-truth masks. A Haar wavelet transform splits an image into a coarse average plus "detail" coefficients that record changes within 2×2, 4×4, 8×8… blocks. For a binary mask, those detail coefficients are nonzero only where the outline passes through a block. Matching them supervises the boundary at scale $2^j$ without a hand-chosen boundary thickness.

The second is a background-resampling consistency term. The same wavelet detail support defines a boundary band. Pixels outside that band, including the glass interior, are restyled, flattened to a textureless surface, or texture-swapped, and the prediction is required to stay the same.

We claim this pair improves boundary quality and robustness on plain backgrounds over tuned spatial boundary losses. We also claim it closes much of the gap to architectures that apply wavelets inside the network, at zero added inference cost.

Concretely, let $M$ be the ground-truth mask, $\hat M$ the predicted probability map, and $D_j^o(\cdot)$ the Haar detail coefficients at level $j$ and orientation $o$ (horizontal, vertical, diagonal). The boundary term is

$$ \mathcal{L}_{wav} = \sum_{j=1}^{J} \lambda_j \sum_{o} \left\| D_j^o(\hat M) - D_j^o(M) \right\|_1 . $$

One caveat needs stating up front. The Haar transform is orthonormal. With squared error and uniform weights $\lambda_j$, this loss equals ordinary per-pixel squared error over all coefficients, which carries no new information. Its content therefore comes entirely from two choices: the per-scale weights $\lambda_j$, and the L1 penalty, which concentrates gradient on boundary-crossing blocks. The ablations test exactly these two choices.

The consistency term uses a perturbed image $x'$. In $x'$, every pixel outside the band $B$ is altered: the band is the union over levels $j \le J$ of the upsampled support of $D_j^o(M)$. The term is

$$ \mathcal{L}_{bg} = \mathrm{KL}\big(\mathrm{sg}[f(x)] \,\|\, f(x')\big). $$

Here $f$ is the segmentation network, and $\mathrm{sg}$ (stop-gradient) means the clean prediction is treated as a fixed target. The band width therefore follows from the wavelet scales, not from a tuned dilation.

Positioning Against Prior Work

The glass-segmentation literature motivates the problem and supplies our base networks. All of it works purely in the spatial domain:

  • EBLNet subtracts coarse boundary predictions from features and runs a graph network on top-$K$ boundary points. It reaches 90.28% mIoU on Trans10k at 24ms, but fails on fragmented glass.
  • RFENet passes information both ways between boundary and region streams. - Internal-External Boundary Attention Fusion attends separately to cues just inside and just outside the outline. It depends on a hand-tuned boundary thickness, which our loss is designed to remove.

  • TransCues adds a Sobel-based boundary loss and a reflection module to a transformer backbone.

  • Tan et al. sense background distortion directly and document collapse on plain backgrounds. Phillips et al. document the same failure for refraction cues.

We change none of these architectures. We change what they are trained to be insensitive to.

The frequency literature supplies the method and the constraint:

  • DOAT uses a wavelet split inside a detection transformer. It perturbs low-frequency "style" and scores objectness by high-frequency energy. This is the closest prior work, but it targets bounding boxes of opaque objects and keeps the wavelet module at inference.
  • Spectral U-Net replaces pooling with complex wavelets to preserve medical boundaries.
  • FAMNet shows that style sits in low and high Fourier bands. It also shows the latency cost of cross-band attention, as does Spectral Representations for CNNs, which notes that layer-wise transforms cost $O(N \log N)$ and require repeated returns to the spatial domain.
  • Pan et al. show the asymmetry we exploit: spectral losses cost training time but nothing at inference.
  • RPCNet enforces that a predicted boundary equals the gradient of the predicted mask. It does this through eight iterative inference passes. We enforce a multi-scale analogue of that consistency purely in the loss.

Finally, the open-world detection work frames our secondary diagnostic. Bansal et al., OW-DETR and OV-DQUO show that unannotated objects get trained toward the background class. Glass may suffer this doubly, because its interior literally is background.

Research Program

We implement $\mathcal{L}_{wav}$ and $\mathcal{L}_{bg}$ as drop-in additions to two base networks, EBLNet and RFENet, plus a plain SegFormer-style transformer as a control. We use the authors' training recipes where available and reimplement otherwise, reporting our reproduced numbers alongside theirs.

The perturbation family for $\mathcal{L}_{bg}$ has three members, each applied only outside the band $B$:

  • Wavelet style swap: replace the coarse wavelet band with that of another training image.
  • Flattening: replace content by a heavy low-pass version. This is our proxy for a textureless wall. It is deliberately pessimistic, because it also removes interior highlights.
  • Texture swap: take the region from a different image.

We study the choice of maximum level $J$ and the scale weights $\lambda_j$ as the main design axes. We also record training-time overhead. This should be small, since Haar transforms of a single-channel mask are cheap.

The analysis has three parts:

  • Plain-background stratification. We split test images by the wavelet detail energy of the background in a ring around each glass instance. We report accuracy per bin. This turns the "textureless failure mode" from an anecdote into a curve.
  • Evidence probe. We measure how much each model's glass prediction changes when only the interior is flattened versus when only the boundary band is blurred. A model that relies on borrowed interior texture should be sensitive to the former.
  • Held-out-category diagnostic for background-foreground ambiguity. On Trans10K-v2 we relabel two "thing" categories, eyeglass and jar, as background during training. We then measure class-agnostic transparent recall on them at test time, asking whether boundary-anchored training reduces how strongly unlabeled glass is absorbed into background.

Baselines

The naive reference is each base network trained with its original loss and schedule. It shows what the added losses buy. For context, the reported numbers are:

  • RFENet: 91.25% mIoU on Trans10k, 86.50% mIoU on GSD, 73.56% mIoU on PMD.
  • EBLNet: 90.28% mIoU on Trans10k at 24ms per image.
  • Trans2Seg: 72.15% mIoU on the 11-category Trans10K-v2.

We found no reported boundary F-score for any of these on Lacuna, so boundary metrics come from our reruns.

The strongest existing method on the main benchmarks is RFENet. We run it with its published recipe, both with and without our losses, on identical data splits and hardware. Beating it means a statistically reliable gain over our rerun across three seeds, in mIoU and boundary F-score, with unchanged parameters and latency.

The strongest competitor on the specific question is a tuned spatial boundary loss on the same base network. We implement two versions:

  • a Sobel-Dice loss as in TransCues;
  • a mask-gradient duality loss as in RPCNet, without its iterative inference passes.

Each gets the same tuning budget as our method. We sweep boundary thickness, or loss weight, over as many configurations as we spend on $J$ and $\lambda_j$. Beating it requires a gain on the plain-background bins, not only on average.

The spectral-architecture reference shows how much accuracy in-network wavelets add, and at what latency. We insert wavelet down/upsampling in the decoder as in Spectral U-Net, and separately a DOAT-style feature split with low-frequency perturbation, as in DOAT. Success for us is recovering most of its gain while matching the base model's FLOPs and latency.

The ablations isolate the key ingredients:

  • $\mathcal{L}_{wav}$ alone;
  • $\mathcal{L}_{bg}$ alone;
  • $\mathcal{L}_{wav}$ with uniform $\lambda_j$ and squared error, which reduces to per-pixel loss and so tests whether the wavelet framing matters;
  • $\mathcal{L}_{bg}$ with a fixed-dilation band instead of the wavelet-derived band;
  • the same perturbations used as plain augmentation without the consistency term.

Why not just…?

Why not just tune a spatial boundary loss? This is the most serious threat. A Sobel or mask-gradient loss with well-chosen thickness may match $\mathcal{L}_{wav}$ on average mIoU. Han et al. show that thickness tuning is a real burden, but not that it caps accuracy. The equal-budget comparison above settles it. If the two tie everywhere, including the plain-background bins, we will report that the wavelet loss mainly removes a hyperparameter, and that the robustness gains come from $\mathcal{L}_{bg}$.

Why not just augment backgrounds without a consistency loss? Image-level restyling and flattening are cheap and might teach the same invariance. The augmentation-only ablation answers this directly. We expect consistency to matter most on flattening, because augmentation alone lets the model keep a separate, texture-dependent solution for textured scenes. The evidence probe would show whether interior sensitivity actually drops.

Why not just put wavelets in the architecture? In-network decompositions are the proven route in Spectral U-Net and DOAT, and they may simply be more accurate. Multi-band processing, however, inflates latency, as FAMNet documents. Glass segmentation already prizes speed, as EBLNet's 24ms shows. We report an accuracy-versus-latency comparison. If architectures win by a margin larger than the latency they add, that is a useful negative result.

Why not just use a bigger transformer? Global attention alone left Trans2Seg at 72.15% on Trans10K-v2, and adding explicit boundary cues gave TransCues a further 4.2% mIoU. This suggests capacity is not the bottleneck. Our transformer control tests whether our losses help there too.

Proposed Experiments

The main evaluation covers Trans10k and Trans10K-v2, GDD, GSD, and MSD/PMD. We report mIoU, boundary F-score at several pixel tolerances, mean absolute error, and balanced error rate, plus parameters, FLOPs and measured latency on one GPU.

Three checks are decisive. First, on the lowest-texture background bin, the full method should beat the tuned spatial boundary loss, and the plain-augmentation ablation, by a margin exceeding seed variance. Second, inference latency and parameter count must equal the base network's exactly, while recovering most of the in-network wavelet gain. Third, in the held-out-category diagnostic, recall of relabeled eyeglass and jar instances should rise relative to the base network. If it does not, the double-suppression hypothesis for glass is not addressed by boundary anchoring, and we would say so.

A failure of the first check would mean the plain-background problem cannot be solved by training signal alone. That would argue for sensing changes such as the light-field cues discussed by Nagahara.