Skip to content

Repository files navigation

Introduction

This repository is under construction as a compagnon repository to an article in preparation. Here is the purpose of the study:

"Generative models have recently revolutionized image generation tasks across diverse domains, including galaxy image synthesis. This study investigates the statistical learning and consistency of three generative models: light-weight-gan (a GAN-based model), Glow (a Normalizing Flow-based model), and a diffusion model based on a U-Net denoiser, all trained on non-overlapping subsets of the SDSS DR7 dataset of 64 × 64 grayscale images. While all models produce visually realistic images with well-preserved morphological variable distributions, we focus on their ability to learn and generalize the underlying data distribution.[...]"

images samples

Concerning the galaxy image datasets and trained models and generated samples, as their sized are too large for this GitHub repository, they are available on a publicly accessible CNRS Cloud, and one can ask me to get the link.

Three generative models

One can use the following models:

  • a diffusion model based on U-Net (diffusion_model_sdss). The source of the original code is available here. The associated article is available Kadkhodaie et al. (2024)
  • a flow-based model (glow_model_sdss). The source of the Pytorch implementation used of the Glow architecture is avaliable here. Notice that the original architecture was implemented in TensorFlow here. The associated article is available at Kingma & Dhariwal (2018)
  • a GAN-based model (lightweight_gan). The source of the implementation used is available here and the official code is available here. The associated article is available at Liu et al. (2021)

In the three mentioned directories, one may find SLURM submission scripts (exemple for Jean Zay at IDRIS a French supercomputer ), some adaptations of python codes to be used in the context of the article and notebooks to reproduce figures.

A the top directory one can use two notebooks:

  • models_sample_images.ipynb to display generated galaxy samples of the three models (see below how to get the provided samples)
  • morphology_sdss_gen.ipynb to compute and display morphological variable distribution based on the statmorph python package.

The datasets:

They are available on demand, here is a brief description:

  • sdss_100000_A.tar and sdss_100000_B.tar two independant sets composed of 100,000 images each used to trained independantly 2 models of glow_model_sdss or lightweight_gan architectures. These tar-files are structured to be used by torchvision.datasets.ImageFolder. The images are stored in 64x64 grayscale PNG 8-bits. From these two datasets, then one can extract 10,000 and 1,000 images to explore the training on smaller datasets.
  • sdss_train_no_repeats_64x64.pt: a collection of 250,000 images as Pytorch tensor (float32) to be used by diffusion_model_sdss. They are issued from the same original dataset used to make the sdss_100000_(A|B).tar files.
  • The datasets may conveniently be placed at the root of the repository such that for exemple ./datasets/sdss_100000_A/...

Optimized models and generated samples

They are available on demand too, here is a brief description:

  • The diffusion_models.tar and diffusion_results.tar files to be extracted such that the diffusion_model_sdss directory looks like diffusion_model_sdss/denoisers/... and diffusion_model_sdss/results/.... The "denoisers" are the optimized models trained with corresponding datasets (A or B and 10^n with n=0,1,2,3,4,5 images). The "results" are 10,000 samples generated by models trained with 10^5, 10^4 and 10^3 images.
  • The gan_models.tar and gan_results.tar files to extracted in the lightweight_gan directory. The lightweight_gan/models/... files are optimized models trained with 10^5, 10^4 and 10^3 images and at different epochs (eg. 0,10,50,100,150) (nb. last epoch is 147 for the case 10^5). The lightweight_gan/results/... are generated samples by models optimized with 10^5, 10^4 and 10^3 images.
  • The glow_models_results.tar file group both the optimized models and generated images as well as latent variables used in the context of the "inversion test" described in the article. The extraction is to be done in the glow_model_sdss directory. The structure looks like results/results_glow_model_1000/... where 1000 is the size of the training dataset used (one gets also the same structure with 10,000 and 100,000 dataset sizes). Then, one gets two directories output_1000_2ndmod_A and output_1000_2ndmod_B focued on A & B models with the optimized models. One also gets glow_samples...pt files identified by their source "A" or "B" models, the training size repeate, and some tags lioke 4000_T1.0_2.pt which indicates the sulber of samples the temperature used and an possible index (nb. the 10^4 and 10^3 dataset cases are merging the A & B generated samples).

About

No description or website provided.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages