Synthetic training data has gained prominence in numerous learning tasks and scenarios, offering advantages such as dataset augmentation, generalization evaluation, and privacy preservation. Despite these benefits, the efficiency of synthetic data generated by current methodologies remains inferior when training advanced deep models exclusively, limiting its practical utility. To address this challenge, we analyze the principles underlying training data synthesis for supervised learning and elucidate a principled theoretical framework from the distribution-matching perspective that explicates the mechanisms governing synthesis efficacy. Through extensive experiments, we demonstrate the effectiveness of our synthetic data across diverse image classification tasks, both as a replacement for and augmentation to real datasets, while also benefits challenging tasks such as out-of-distribution generalization and privacy preservation.
The project has been tested with PyTorch 2.01 and CUDA 11.7.
pip3 install -r requirements.txt
You can download the generated synthetic data from Dataset Link. Please follow the instruction on Huggingface Dataset page.
Download ImageNet-1K from this link.
- Check
./extract.sh
and specify the path to the ImageNet data.
bash extract.sh
Use the implementation of the BLIP2 caption pipeline. Refer to this paper for details.
TODO: Release Modified diffusers for direct installation
- Specify
CACHE_ROOT/MODEL_NAME
to the folder caching stable diffusion. - Check
./finetune/train_lora.sh
and specify the data version in "versions" for training LoRA.
bash ./finetune/train_lora.sh
- After training, load the trained LoRA model to generate the Synthetic Dataset.
- Check
shell_generate.sh
and specify the data version (1 out of 20) in "versions" for generation. - Review the parameter
--nchunks 8
(Number of GPUs, for example, 8).
bash shell_generate.sh
This will save one version of the dataset to ./SyntheticData
.
- Check
train.sh
and specify--data_dir
with "version" for training on the generated synthetic data. - Review
CUDA_VISIBLE_DEVICES=0,1,2
and--nproc_per_node=3
to specify the number of GPUs used.
bash train.sh
This will save results and the model to ./experiments/
.