Skip to content

A PyTorch implementation of GANs models for generating geological facies

Notifications You must be signed in to change notification settings

Alhasan-Abdellatif/cGANs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pytorch implementation of GANs models used for the continuous conditioning in "Generating unrepresented proportions of geological facies using Generative Adversarial Networks" https://arxiv.org/abs/2203.09639 .

Implementation includes:

SN-GANs - with both DCGAN and Residual architecture. SA-GANs - which uses self-attention mechanism on intermeidate layers of G and D.

For Conditional-GANs models, in addition to the standard concatenation methods, conditional-batch normalization (as in SN-GANs and SA-GANs) is implemented in the Generator and projection method in the discriminator.

The losses implemented are the standard adverserial and Hinge which work quite well with spectral normalization SN-GANs

Prerequisites

  • PyTorch, version 1.0.1
  • tqdm, numpy, scipy, matplotlib
  • A Training set (e.g. MNIST) should be added in the datasets folder

Notes

  • Current model runs on images of size 64x64. larger resolutions could be added in the future.

Running

(For more documentation on the paramters, see utils.py)

To run unconditional GAN on images in datasets/trainfolder and save models in results :

python train.py --data_path datasets/trainfolder --data_ext txt  --img_ch 1  --zdim 128 --spec_norm_D --x_fake_GD  --batch_size 32  --epochs  160 --smooth --save_rate 2  --ema --dev_num 1  --att  --fname results 

To run a conditional GAN with o-h-e with labels saved in train_labels.csv:

python train.py --data_path datasets/trainfolder --labels_path datasets/train_labels.csv --data_ext txt  --img_ch 1  --zdim 128 --spec_norm_D --x_fake_GD --y_real_GD --n_cl 3 --cgan --ohe  --batch_size 32  --epochs  100 --smooth --save_rate 10  --ema --dev_num 1  --att  --fname results_cond_ohe

To run a conditional GAN with continuous labels saved in train_labels.csv:

python train.py --data_path datasets/trainfolder --labels_path datasets/train_labels.csv --data_ext txt  --img_ch 1  --zdim 128 --spec_norm_D --x_fake_GD --n_cl 1 --cgan --real_cond_list 0.25 0.30 0.35 --min_label 0.25 --max_label 0.35  --batch_size 32  --epochs  100 --smooth --save_rate 10  --ema --dev_num 1  --att  --fname results_cond_cont

About

A PyTorch implementation of GANs models for generating geological facies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages