Domain-RAG: Retrieval-Guided Compositional Image Generation for Cross-Domain Few-Shot Object Detection

Yanwei Fu (Fudan University, Shanghai;) · Yu Li (International Digital Economy Academy) · Danda Pani Paudel (INSAIT Sofia & ETH Zurich) · Luc V Gool (Computer Vision Lab, ETH Zurich) · Jie Chen (Hong Kong Baptist University) · Yu-Gang Jiang (Fudan University) · Yuqian Fu (Institute for Computer Science, Artificial Intelligence and Technology) · Xingyu Qiu (Fudan University) · Tianwen Qian (East China Normal University) · Xu Zheng (The Hong Kong University of Science and Technology (Guangzhou) & INSAIT, Sofia University) · Xuanjing Huang (Fudan University)
copy-paste augmentationcross-domain few-shot object detectiondata augmentationdomain alignmentdomain-aligned backgrounddomain-aware background retrievaldomain-guided background generationforeground-background compositiongenerative methodsgenerative modelhigh-quality samplesretrieval-guided compositional image generationsemantically similar imagesstate-of-the-art resultsstylistically similar imagestext-to-image generation

Cross-Domain Few-Shot Object Detection (CD-FSOD) aims to detect novel objects with only a handful of labeled samples from previously unseen domains. While data augmentation and generative methods have shown promise in few-shot learning, their effectiveness for CD-FSOD remains unclear due to the need for both visual realism and domain alignment. Existing strategies, such as copy-paste augmentation and text-to-image generation, often fail to preserve the correct object category or produce backgrounds coherent with the target domain, making them non-trivial to apply directly to CD-FSOD. To address these challenges, we propose Domain-RAG, a training-free, retrieval-guided compositional image generation framework tailored for CD-FSOD. Domain-RAG consists of three stages: domain-aware background retrieval, domain-guided background generation, and foreground-background composition. Specifically, the input image is first decomposed into foreground and background regions. We then retrieve semantically and stylistically similar images to guide a generative model in synthesizing a new background, conditioned on both the original and retrieved contexts. Finally, the preserved foreground is composed with the newly generated domain-aligned background to form the generated image. Without requiring any additional supervision or training, Domain-RAG produces high-quality, domain-consistent samples across diverse tasks, including CD-FSOD, remote sensing FSOD, and camouflaged FSOD. Extensive experiments show consistent improvements over strong baselines and establish new state-of-the-art results. Codes will be released upon acceptance.The source code and instructions are available at https://github.com/LiYu0524/Domain-RAG.