This repository provides the official implementation for Section VI.C. Experiment 2: Data Cleansing of the following paper.
Data Cleansing for GANs
Naoyuki Terashita, Hiroki Ohashi, Satoshi Hara
IEEE Transactions on Neural Networks and Learning Systems (TNNLS), 2025
IEEE Xplore | arXiv
The experiment evaluates the influence of training instances when fine-tuning StyleGAN (pre-trained on Flickr-Faces-HQ) to generate cat faces from the AFHQ-CAT (Animal Faces-HQ, cat category) dataset. We train LoRA parameters for both the generator and the discriminator and use FID (with Inception-V3 features) for influence estimation and evaluation. The implementation uses a practical ITD-influence estimator compatible with moving-average generator and momentum-based optimizers (e.g., Adam), as described in the paper.
- Preparing datasets – AFHQ-CAT is split into training and validation sets for AGD (adversarial gradient descent) and for computing influence / FID.
- Scoring harmfulness – Harmfulness of each training instance is scored using our methods (ITD or AID influence on FID) or baselines (Isolation Forest, random).
- Selecting instances to remove – Top (n_h) harmful instances are selected according to the chosen removal rates.
- Retraining – The model is retrained with the selected instances excluded. Two strategies are supported: full-epoch retraining (counterfactual AGD from the initial parameters) and one-epoch retraining (from one epoch before the final step).
- Evaluation – Retrained models are evaluated by FID on the test set.
Create a virtual environment (optional but recommended), then install dependencies:
pip install -r requirements.txtbash download_dataset.sh- Download
stylegan-256px-new.modelfrom Google Drive. - Place
stylegan-256px-new.modelin the./checkpointdirectory.
source venv/bin/activate
# ITD influence (FID): full-epoch and one-epoch retraining
python main.py PipelineCleansing --method-influence itd --name-metric-infl fid --scales [0.01,0.001] --on-averaged-G --mixing --local-scheduler
# AID influence (FID)
python main.py PipelineCleansing --method-influence aid --depth 1000 --scales [0.001,0.001] --on-averaged-G --mixing --local-scheduler
# Baseline – Isolation Forest
python main.py PipelineCleansing --name-metric-infl isolation_forest --scales [0.01,0.001] --on-averaged-G --mixing --local-scheduler
# Baseline – Random
python main.py PipelineCleansing --name-metric-infl random --scales [0.001,0.001] --on-averaged-G --mixing --local-schedulerAfter completing the above commands, you can visualize the results in the Jupyter notebooks. Below are the expected are the expected outcomes from the paper.
Test FID vs. data removal rate.
| Full-epoch retraining | One-epoch retraining |
|---|---|
![]() |
![]() |
Influential training instances. Top-27 harmful and helpful instances from ITD (over entire training steps), and randomly selected instances.
| Harmful instances | Helpful instances |
|---|---|
![]() |
![]() |
Generated images before and after data cleansing. For each method, the model with the best validation FID is used. For every method, we chose the model that yielded the best validation FID. Each row uses the same test latent.
No removal![]() |
Infl. on FID by ITD![]() |
Infl. on FID by AID![]() |
Isolation Forest![]() |
Random![]() |
If you find our work useful, please consider citing:
@ARTICLE{10857591,
author={Terashita, Naoyuki and Ohashi, Hiroki and Hara, Satoshi},
journal={IEEE Transactions on Neural Networks and Learning Systems},
title={Data Cleansing for GANs},
year={2025},
volume={36},
number={6},
pages={11575-11588},
doi={10.1109/TNNLS.2025.3529540}}







