Abstract
Recent text-to-image generative models have exhibited an impressive ability to generate fairly realistic images from text prompts. In this work, we explore leveraging off-the-shelf text-to-image generative models to train downstream few-shot classification models using synthetic datasets. Current approaches using hand-crafted or model-generated prompts often lack diversity and relevance to specific classification tasks, making efficient training difficult. To address this, we propose DeCap, a method capable of adaptively learning proper text prompts for off-the-shelf diffusion models to generate diverse and classification-aware synthetic images. Our approach shows consistent improvements across various classification datasets and demonstrates model-agnostic potential by improving existing zero/few-shot methods across different network architectures.
Introduction: The Challenge of Synthetic Data in FSL
Few-shot learning (FSL) aims to train models on very few labeled examples. A popular strategy is to use text-to-image models like Stable Diffusion to generate synthetic data to supplement these small datasets. However, current approaches face two major hurdles:
- Lack of Diversity: Hand-crafted prompts (e.g., "a photo of a {class}") often produce repetitive images that fail to cover the visual variance of the real world.
- Classification-Agnosticism: Automatically generated prompts (using LLMs or captioning models) can be noisy. For instance, a prompt for a "dog" might accidentally include a "cat" in the description, leading to synthetic images that confuse the classifier.
The DeCap Framework
The authors propose Diversity-enhanced and Classification-aware prompt learning (DeCap), which operates in two main phases to generate high-quality synthetic training data.
1. Building a Diversity-Enhanced Prompt Pool
DeCap combines human intuition with machine generation to create a massive pool for each class. This pool includes:
- Hand-crafted templates: Variations in style, domain (e.g., sketch, painting), and camera angles.
- Model-generated descriptions: Rich, descriptive sentences generated by models like T5 (language enhancement) or BLIP (image captioning).
2. Classification-Aware Prompt Learning
To find the most effective prompts, DeCap utilizes a bi-level optimization approach. An inner loop trains a classification model on synthetic images, while an outer loop uses a Genetic Algorithm (GA) to search for the optimal subset of prompts. The "fitness" of a prompt set is determined by how well the model performs on actual, real-world few-shot samples. The use of a GA allows for efficient discrete optimization without the prohibitive cost of backpropagating through a full diffusion model.
Key Insights and Results
The method was evaluated across 12 diverse datasets, covering general objects, textures, satellite imagery, and fine-grained classification.
- Noisy Prompt Filtering: DeCap automatically filters out prompts that introduce "label noise." If a prompt includes a background object belonging to a different class, the GA typically rejects it as it hurts validation accuracy on real data.
- Task-Specific Adaptation: The optimal prompts vary by dataset. For low-resolution datasets like CIFAR-10, the GA often selects prompts mentioning "pixelated" or "blurry" styles, helping bridge the domain gap between high-resolution synthetic outputs and low-resolution real data.
- Model-Agnostic Performance: DeCap is a versatile data generation strategy. By replacing the data generation step in other state-of-the-art methods like CaFo or SuS-X with DeCap-generated images, those methods achieved significantly higher performance.
- Robustness: Models trained with DeCap data showed better resilience to adversarial attacks (PGD/BIM), suggesting that the synthetic data is more robust and representative than baseline methods.
Conclusion
DeCap addresses the limitations of static and noisy prompts in synthetic data generation for few-shot learning. By leveraging a diversity-enhanced pool and a classification-aware selection process via Genetic Algorithms, it produces high-quality training data that significantly boosts classification accuracy on real images. Future work may extend this logic to more complex tasks like object detection or semantic segmentation.
Summary updated