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.txtYou 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.shand specify the path to the ImageNet data.
bash extract.shUse the implementation of the BLIP2 caption pipeline. Refer to this paper for details.
TODO: Release Modified diffusers for direct installation
- Specify
CACHE_ROOT/MODEL_NAMEto the folder caching stable diffusion. - Check
./finetune/train_lora.shand 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.shand 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.shThis will save one version of the dataset to ./SyntheticData.
- Check
train.shand specify--data_dirwith "version" for training on the generated synthetic data. - Review
CUDA_VISIBLE_DEVICES=0,1,2and--nproc_per_node=3to specify the number of GPUs used.
bash train.shThis will save results and the model to ./experiments/.