Abstract
Few-Shot Learning (FSL) in the food domain is significantly challenged by high intra-class variability and visually noisy backgrounds. We present Stochastic-based Patch Filtering (SPFF), a framework that leverages multinomial sampling to select discriminative image patches. By introducing controlled randomness into the patch selection process, SPFF acts as a regularizer, preventing overfitting and focusing on relevant foreground features. Our approach achieves state-of-the-art performance on the Food-101, VireoFood-172, and UECFood-256 benchmarks, outperforming existing metric-based methods by significant margins.
Introduction
Few-Shot Learning (FSL) aims to recognize new categories using only a handful of examples. In the context of food classification, this task is exceptionally difficult. A single dish can vary wildly based on presentation, lighting, or camera angle, while background elements like plates, cutlery, and tablecloths act as "noise" that can distract a model.
Traditional FSL models often struggle with two primary issues: overfitting, where the model memorizes specific training instances rather than generalizable features, and distraction, where the model focuses on irrelevant background details. While previous attempts have used deterministic "top-K" filtering to remove unimportant patches, these methods often lack the flexibility to generalize to the diverse variations found in real-world food imagery.
Methodology: The SPFF Framework
The authors introduce Stochastic-based Patch Filtering (SPFF) to address these limitations. The pipeline utilizes a Vision Transformer (ViT-S/16) backbone to decompose an image into 196 distinct patches.
The core innovation lies in the Stochastic Filter. Rather than selecting the most similar patches deterministically, the model calculates cosine similarity between each patch and a global class-aware embedding. These scores are converted into a probability distribution via a Softmax function. Using multinomial sampling, the model selects a subset of patches to retain. This "controlled randomness" forces the model to learn from a wider variety of discriminative areas during training, preventing it from becoming overly dependent on a single set of features.
Experimental Results
SPFF was evaluated on three major benchmarks: Food-101, VireoFood-172, and UECFood-256. These datasets are characterized by high inter-class overlap and significant intra-class variability.
As shown in the results table, SPFF consistently outperformed existing state-of-the-art (SoA) methods:
- Food-101: Achieved 83.32% accuracy in 5-way 5-shot tasks, a nearly 3% improvement over the previous best.
- UECFood-256: Demonstrated the most dramatic gains, reaching 88.71% in 5-shot tasks, compared to the previous SoA of 69.08%.
- 1-Shot Robustness: Even with a single example, the model remained highly effective, outperforming competitors by margins ranging from 2% to 19%.
Key Insights and Discussion
Stochasticity as a Regularizer
The primary finding is that randomness serves as a powerful regularizer. By stochastically selecting patches, the model is discouraged from overfitting to specific "perfect" patches that may not be present in unseen images. This encourages the extraction of more robust, category-level features.
The "Goldilocks" Zone for Patch Selection
Ablation studies revealed that selecting approximately 98 patches (50% of the image) is optimal. Retaining too few patches results in the loss of essential discriminative details, while retaining too many reintroduces background noise that degrades classification accuracy.
Conclusion
SPFF represents a significant step forward in few-shot food classification. By replacing rigid deterministic filtering with a stochastic sampling approach, the model successfully navigates the noise inherent in food imagery. Future work will explore adaptive patch selection, allowing the model to dynamically determine the optimal number of patches to retain based on specific image content, and testing the framework's efficacy in other complex domains such as medical or satellite imaging.
Summary updated