Bridging the Gap: Enhancing the Utility of Synthetic Data via Post-Processing Techniques (BMVC 2023)
The official TensorFlow implementation of the BMVC2023 paper: Bridging the Gap: Enhancing the Utility of Synthetic Data via Post-Processing Techniques.
The CAS obtained from the classifiers trained only on generated data. The GaFi pipeline is compared with the previous state of the art, with the Synthetic Baseline and with the accuracy of the classifiers trained on real data.
![](https://private-user-images.githubusercontent.com/7725068/278266422-4eac8885-49ee-44c3-95fd-d0043b27b46f.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3ODM2NDcsIm5iZiI6MTcyNDc4MzM0NywicGF0aCI6Ii83NzI1MDY4LzI3ODI2NjQyMi00ZWFjODg4NS00OWVlLTQ0YzMtOTVmZC1kMDA0M2IyN2I0NmYuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjdUMTgyOTA3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTMwYmI5YzEwOGI2NjlmMTkwMTAxMjQ0Y2M3MjIyMDk3ZDRlZDI4ZWQ3NTM0YTdhMTFhYWZiOGFhYzYwNWIyYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ._0_J7O1XpzJvCQfJsJMH1WaVRu0yYfvs2rVWXQIgtWE)
- Clone the GitHub repository:
git clone https://github.com/sup3rgiu/GaFi-Pipeline.git
- Move inside the
docker
directory:
cd GaFi-Pipeline/docker
- Build docker image:
docker build --rm -t gafi_pipeline .
- Train the classifier on real data:
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --name GaFiPipeline -it --rm -v /path_to_GaFi-Pipeline:/exp -t gafi_pipeline python train_classifier.py --cfg_file ./configs/CIFAR10/ResNet20.yaml
- Train GAN:
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --name GaFiPipeline -it --rm -v /path_to_GaFi-Pipeline:/exp -t gafi_pipeline python train_gain.py --cfg_file ./configs/CIFAR10/BigGAN_deep.yaml
- Run full pipeline:
N.B.: adjust GAN name if needed. You can do it inside the .yaml file or as cmd argument
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --name GaFiPipeline -it --rm -v /path_to_GaFi-Pipeline:/exp -t gafi_pipeline python run_pipeline.py --cfg_file ./configs/CIFAR10/Pipeline.yaml --gan_name GAN_NAME
- Iterate through steps 2. and 3. N times, changing the seed each time to obtain N different generators:
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --name GaFiPipeline -it --rm -v /path_to_GaFi-Pipeline:/exp -t gafi_pipeline python train_gain.py --cfg_file ./configs/CIFAR10/BigGAN_deep.yaml --seed NEW_SEED
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --name GaFiPipeline -it --rm -v /path_to_GaFi-Pipeline:/exp -t gafi_pipeline python run_pipeline.py --cfg_file ./configs/CIFAR10/Pipeline.yaml --gan_name NEW_GAN_NAME
- Run the MultiGAN script to obtain a classifier trained on a synthetic dataset sampled from the N different generators:
N.B.: adjust all the GAN names inside the .yaml file or as cmd argument
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --name GaFiPipeline -it --rm -v /path_to_GaFi-Pipeline:/exp -t gafi_pipeline python run_multigan.py --cfg_file ./configs/CIFAR10/MultiGAN.yaml
All default parameters defined in the .yaml configuration files can be overridden by specifying the corresponding command-line arguments.
For example, if we want to use the default ./configs/CIFAR10/ResNet20.yaml but train in mixed precision, we can do the following:
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --name GaFiPipeline -it --rm -v /path_to_GaFi-Pipeline:/exp -t gafi_pipeline python train_classifier.py --cfg_file ./configs/CIFAR10/ResNet20.yaml --mixed_precision
Or if we want to train the classifier without using random erasing augmentation:
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --name GaFiPipeline -it --rm -v /path_to_GaFi-Pipeline:/exp -t gafi_pipeline python train_classifier.py --cfg_file ./configs/CIFAR10/ResNet20.yaml --random_erasing False
All possible arguments are defined in parser.py and can be seen by running the scripts with the -h
flag.
Should you find this repository useful, please consider citing:
@misc{lampis2023bridging,
title={Bridging the Gap: Enhancing the Utility of Synthetic Data via Post-Processing Techniques},
author={Andrea Lampis and Eugenio Lomurno and Matteo Matteucci},
year={2023},
eprint={2305.10118},
archivePrefix={arXiv},
primaryClass={cs.CV}
}