Papers
Topics
Authors
Recent
Search
2000 character limit reached

Standard Glass Filling Estimation

Updated 9 July 2026
  • Standard glass filling is a task that estimates a cup's content level from a single RGB image, addressing issues like transparency and occlusion.
  • The approach involves 4-way classification (0%, 50%, 90%, unknown) using a ResNet-18 backbone and adversarial pretraining to mitigate reliance on spurious features.
  • Empirical results show that adversarial training followed by fine-tuning improves robustness, achieving up to 88% accuracy across diverse container shapes.

Standard glass filling denotes the estimation of the level of content in a cup or drinking glass from a single RGB image. In the formulation studied in "Improving filling level classification with adversarial training" (Modas et al., 2021), the task is posed as a 4-way classification problem over fill levels y{0%,50%,90%,unknown}y \in \{0\%, 50\%, 90\%, \text{unknown}\}. The problem is technically nontrivial because transparencies in both the container and its content, vessel-shape variation, and partial occlusions by the holder’s hand make single-image cues ambiguous, while the availability of only a few thousand labeled examples encourages overfitting to dataset-specific artefacts rather than physically meaningful volumetric cues.

1. Problem formulation and sources of ambiguity

The task is defined on an input image x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}, with a classifier fθ(x)=yf_\theta(x) = y. The labels correspond to 0%0\%, 50%50\%, 90%90\%, and an additional "unknown" class. The "unknown" label is used for non-transparent cases, reflecting the fact that visibility of the content itself is sometimes insufficient for deterministic inference (Modas et al., 2021).

Several factors make the problem deceptively hard. The containers include both stemmed and stemless geometries, as well as straight-walled and tapered forms. The walls may be transparent, translucent, or opaque, and the content may itself be transparent, as in water, or opaque, as in rice or pasta. Frequent hand occlusion further corrupts the visual evidence. In this setting, a standard CNN often "cheats" by exploiting spurious correlations such as cup color or shadow rather than learning the true physical cues that correlate with fill level.

Adversarial examples are used to motivate the study design. Minimal perturbations δ\delta that flip the classifier’s decision expose the brittleness of standard optimization and suggest that conventional training emphasizes non-semantic, non-robust features. The central hypothesis is therefore that adversarially trained source models may transfer better to a small-data, high-ambiguity target task than conventionally trained source models.

2. Dataset construction and shape-generalization protocol

The empirical study uses the CORSMAL Containers Manipulation dataset, denoted C-CCM. It comprises approximately 10,26910{,}269 manually verified, Mask-R-CNN–cropped frames from 8 container types: 4 cups and 4 stemmed glasses, acquired under varied backgrounds and illumination conditions (Modas et al., 2021). The containers include transparent, translucent, and opaque walls; the content may be transparent or opaque.

Each frame is annotated with fill level in {0%,50%,90%}\{0\%, 50\%, 90\%\}, together with an "unknown" class for non-transparent cases. Occlusion and container transparency flags are also provided. These annotations are important because they separate geometric ambiguity from visibility ambiguity and enable evaluation under nonuniform observation conditions.

The evaluation emphasizes shape generalization rather than only in-distribution accuracy. Three train/test protocols are defined:

  • S1S_1: train on all but champagne flute; test on flute.
  • x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}0: swap beer cup vs. wine glass between train/test.
  • x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}1: train on all stemmed vessels; test on stemless cups.

This protocol makes the task less about memorizing container identities and more about transferring fill-level reasoning across unseen vessel geometries. A plausible implication is that the reported performance is intended to measure robustness to cross-shape shift rather than only recognition of familiar exemplars.

3. Transfer learning and adversarial objective

The method is structured around a source domain x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}2, with approximately x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}3 million images, and a target domain x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}4, with approximately x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}5 thousand images (Modas et al., 2021). The classifier is decomposed as

x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}6

where x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}7 is ResNet-18 up to the global pooling layer and x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}8 is the final fully connected layer.

Adversarial training on the source domain is implemented via x[0,1]H×W×3x \in [0,1]^{H \times W \times 3}9-PGD with 10 steps. For each fθ(x)=yf_\theta(x) = y0, the perturbation is defined by

fθ(x)=yf_\theta(x) = y1

and the adversarial risk is

fθ(x)=yf_\theta(x) = y2

The standard target-domain classification risk is

fθ(x)=yf_\theta(x) = y3

with cross-entropy loss fθ(x)=yf_\theta(x) = y4.

Although one could in principle optimize

fθ(x)=yf_\theta(x) = y5

the implementation is decoupled. First, the model is pre-trained on the source domain using either standard training or adversarial training. Second, the first fθ(x)=yf_\theta(x) = y6 ResNet blocks are frozen and the remaining layers are fine-tuned on the target domain using only fθ(x)=yf_\theta(x) = y7. This decoupling is operationally important because it separates robustness acquisition on a large generic source dataset from specialization on the small target dataset.

4. Network architecture, regimes, and hyperparameters

The backbone is ResNet-18 with 4 blocks plus pooling, and the classifier head is a fully connected layer producing 4 outputs (Modas et al., 2021). Optimization uses SGD with cross-entropy loss for 30 epochs and linear learning-rate decay. For training on the target domain only, the initial learning rate is fθ(x)=yf_\theta(x) = y8; for transfer learning, it is fθ(x)=yf_\theta(x) = y9. Batch sampling is class-balanced by inverse frequencies.

Six regimes are evaluated:

  • ST: standard training on 0%0\%0 only.
  • AT: adversarial training on 0%0\%1 only with 0%0\%2-PGD and 0%0\%3.
  • ST→FT: standard training on 0%0\%4, then freezing the first 0%0\%5 layers and fine-tuning on 0%0\%6.
  • ST→AFT: standard training on 0%0\%7, then freezing the first 0%0\%8 layers and adversarial fine-tuning on 0%0\%9.
  • AT→FT: adversarial training on 50%50\%0, then freezing the first 50%50\%1 layers and fine-tuning on 50%50\%2.
  • AT→AFT: adversarial training on 50%50\%3, then freezing the first 50%50\%4 layers and adversarial fine-tuning on 50%50\%5.

Ablation results identify the freezing depth as a critical variable. Fixing the first block only, 50%50\%6, maximized generalization, whereas freezing more than one block steadily degraded performance. Source-domain perturbation radius 50%50\%7 varied by split: 50%50\%8 for 50%50\%9, 90%90\%0 for 90%90\%1, and 90%90\%2 for 90%90\%3. By contrast, 90%90\%4 was fixed at 90%90\%5 for all target adversarial steps, because higher 90%90\%6 prevented convergence.

5. Empirical performance and error characteristics

The reported test accuracies are averaged over the three container types in each split (Modas et al., 2021). For 90%90\%7, the accuracies are: ST 90%90\%8, AT 90%90\%9, ST→FT δ\delta0, ST→AFT δ\delta1, AT→FT δ\delta2, and AT→AFT δ\delta3. For δ\delta4, they are: ST δ\delta5, AT δ\delta6, ST→FT δ\delta7, ST→AFT δ\delta8, AT→FT δ\delta9, and AT→AFT 10,26910{,}2690. For 10,26910{,}2691, they are: ST 10,26910{,}2692, AT 10,26910{,}2693, ST→FT 10,26910{,}2694, ST→AFT 10,26910{,}2695, AT→FT 10,26910{,}2696, and AT→AFT 10,26910{,}2697.

Across all three splits, AT→FT is the strongest regime. The reported margins over ST→FT are 10,26910{,}2698 percentage points in 10,26910{,}2699, {0%,50%,90%}\{0\%, 50\%, 90\%\}0 percentage points in {0%,50%,90%}\{0\%, 50\%, 90\%\}1, and {0%,50%,90%}\{0\%, 50\%, 90\%\}2 percentage points in {0%,50%,90%}\{0\%, 50\%, 90\%\}3. This establishes that adversarial training in the source domain, followed by standard fine-tuning in the target domain, is consistently more effective than both target-only training and standard source pretraining.

The results also show that adversarial training on the target domain alone is not beneficial in this setting. Standard AT on {0%,50%,90%}\{0\%, 50\%, 90\%\}4 alone hurts performance, and adversarial fine-tuning often underfits unless the source backbone is already robust. This is an important correction to any blanket assumption that adversarial optimization uniformly improves downstream accuracy on small, specialized vision datasets.

No per-category confusion matrices were released. However, the reported error pattern indicates that most errors occur between {0%,50%,90%}\{0\%, 50\%, 90\%\}5 and {0%,50%,90%}\{0\%, 50\%, 90\%\}6 on complex shapes, particularly under tapered-versus-straight wall ambiguity. This suggests that the dominant residual difficulty lies in discriminating intermediate from high fill levels when geometric perspective and wall shape distort direct visual estimation.

6. Interpretation, practical baseline, and significance

The interpretation offered for the performance gains is that adversarial training on the large-scale source domain forces the ResNet-18 backbone to discard non-robust, texture-biased features and focus on more semantically faithful cues such as shape edges and consistent shading (Modas et al., 2021). When such a backbone is fine-tuned on the small C-CCM dataset, these robust features generalize better to unseen vessel geometries and occlusion patterns, thereby mitigating overfitting to backgrounds, lighting, and container textures.

For practical deployment, the recommended procedure is explicit. One should start from an ImageNet-robust ResNet-18 trained with 10-step {0%,50%,90%}\{0\%, 50\%, 90\%\}7-PGD and {0%,50%,90%}\{0\%, 50\%, 90\%\}8–{0%,50%,90%}\{0\%, 50\%, 90\%\}9; freeze the first ResNet block when fine-tuning on a small fill-level dataset; fine-tune with standard cross-entropy for 30 epochs using an initial learning rate of S1S_10, linear decay, and class-balanced sampling; and use S1S_11 for any adversarial fine-tuning on the target domain, while prioritizing standard fine-tuning if convergence issues arise.

Within the scope of the reported experiments, this AT→FT recipe yielded test accuracies up to S1S_12 on held-out vessel types and was described as a solid baseline for robot vision systems that estimate liquid levels from single RGB frames. More broadly, the study positions standard glass filling as a compact but informative benchmark for transfer learning under small data, shape shift, transparency-induced ambiguity, and vulnerability to spurious visual correlations.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Standard Glass Filling.