Skip to content

Repository files navigation

Coarse to Fine: Iterative Adversarial Neural Cellular Automata for Medical Image Synthesis

This repository introduces StyleGANCA, the first lightweight, general-purpose GAN based on Neural Cellular Automata (NCA) for synthetic medical image generation. By combining StyleGAN-inspired latent modulation with multi-scale NCA synthesis, StyleGANCA achieves competitive image quality using only 617k parameters, outperforming larger baselines on PathMNIST while generating synthetic data that effectively supports downstream classifier training. The paper can be found at https://arxiv.org/abs/2608.28909.

Installation

Clone the repository

git clone https://github.com/anhthi2000/Generative-Adversarial-NCA.git
cd Generative-Adversarial-NCA

Create the environment

For natten installation, make sure that torch and cuda version exactly match (https://whl.natten.org). Examplary installation:

conda create -n project python=3.10
conda activate project
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126
pip install natten==0.17.5+torch260cu126 -f https://whl.natten.org
pip install -r requirements.txt

Generator

Training

Specify training parameters and save path in config.py, src/paths.py and run.sh. Start training and evaluation:

bash run.sh

Evaluation

python evaluate.py \
    --g_type style \
    --network path/to/model.pth \
    --data bloodmnist \
    --metrics fid2048_full kid2048_full \
    --fake_data_dir /path/to/generated/images

Downstream Classifier Task

Pseudo-Labeling

python classifier/classify_generated.py \
  --image_folder /path/to/generated/images \
  --model_path /path/to/pretrained/classifier.pth \
  --data_flag pathmnist \
  --model_flag resnet18 \
  --output_file /path/to/predictions.txt

Classifier Training

python classifier/train_classifier.py \
	--data_flag bloodmnist \
	--as_rgb \
	--train_synthetic \
	--synth_data_path /path/to/generated/images \
	--synth_label_file /path/to/labels.txt  \

Evaluation

python classifier/evaluate_classifier.py \
    --model_path /path/to/classifier.pth
    --data_flag pathmnist
    --model_flag resnet18
    --as_rgb
    --split test

Baseline Training

  • DCGAN: specify configuration in config.py and run train_DCGAN.py
  • VAE: specify configurations in and run baselines/vae/train.py
  • StyleGAN: specify configurations in baselines/stylegan/configs/sample.yaml and run baselines/stylegan/train.py
  • VNCA: specify configurations in and run baselines/vnca/medmnist_training.py
  • FouerierDiffNCA: specify configurations and run baselines/fourierdiffnca_dit_unet/train2.py
  • UNet, DiT: specify configurations and run baselines/fourierdiffnca_dit_unet/diff_unet_train.py

Citation

@misc{luu2026coarsefineiterativeadversarial,
      title={Coarse to Fine: Iterative Adversarial Neural Cellular Automata for Medical Image Synthesis}, 
      author={Anh Thi Luu and Nick Lemke and Anirban Mukhopadhyay},
      year={2026},
      eprint={2608.28909},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2608.28909}, 
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages