In this paper, we present a novel paradigm to enhance the ability of object detector, e.g., expanding categories or improving detection performance, by training on synthetic dataset generated from diffusion models. Specifically, we integrate an instance-level grounding head into a pre-trained, generative diffusion model, to augment it with the ability of localising instances in the generated images. The grounding head is trained to align the text embedding of category names with the regional visual feature of the diffusion model, using supervision from an off-the-shelf object detector, and a novel self-training scheme on (novel) categories not covered by the detector. We conduct thorough experiments to show that, this enhanced version of diffusion model, termed as InstaGen, can serve as a data synthesizer, to enhance object detectors by training on its generated samples, demonstrating superior performance over existing state-of-the-art methods in open-vocabulary (+4.5 AP) and data-sparse (+1.2 ∼ 5.2 AP) scenarios.
updates
# Step 1. Create a conda environment and activate it
conda create --name instagen python=3.8 -y
conda activate instagen
# Step 2. Install the requirements for SDM fine-tuning
cd InstaGen/
pip install -r requirements.txt
# Step 3. Install mmdetection
cd mmdetection/
pip install -U openmim
mim install mmengine
mim install "mmcv>=2.0.0"
pip install -v -e .
We present a simple demo of utilizing InstaGen to generate images and the bounding boxes with the original model weights of SDM.
sh instagen_scripts/demo_instagen.sh
sh instagen_scripts/finetune_sdm.sh
sh instagen_scripts/generate_image.sh
sh instagen_scripts/generate_base_ann.sh
sh instagen_scripts/generate_class_embedding.sh
sh instagen_scripts/train_instagen.sh
sh instagen_scripts/infer_instagen.sh
sh instagen_scripts/generate_novel_ann.sh
sh instagen_scripts/train_detector.sh
sh instagen_scripts/infer_detector.sh
For your convenience, we provide the synthetic dataset and the trained models in the open-vocabulary COCO benchmark.
Model | AP50all | AP50base | AP50novel | Download |
---|---|---|---|---|
Fine-tuned SDM | -- | -- | -- | |
InstaGen | -- | -- | -- | |
Faster RCNN | 52.2 | 55.7 | 42.4 |
Thanks Stable Diffusion, Stable Diffusion Finetuning, Grounded Diffusion and MMDetection team for the wonderful open source project!
If you find InstaGen useful in your research, please consider citing:
@inproceedings{feng2024instagen,
title={InstaGen: Enhancing Object Detection by Training on Synthetic Dataset},
author={Feng, Chengjian and Zhong, Yujie and Jie, Zequn and Xie, Weidi and Ma, Lin},
booktitle={Proceedings of the IEEE / CVF Computer Vision and Pattern Recognition},
year={2024}
}