• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created almost 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Reconstruction of three-dimensional porous media using generative adversarial neural networks

PorousMediaGAN

Implementation and data repository for Reconstruction of three-dimensional porous media using generative adversarial neural networks

Authors

Lukas Mosser Twitter
Olivier Dubrule
Martin J. Blunt
Department of Earth Science and Engineering, Imperial College London

Results

Cross-sectional views of the three trained models

  • Beadpack Sample
    Beadpack Comparison
  • Berea Sample
    Berea Comparison
  • Ketton Sample
    Ketton Comparison

Methodology

Process Overview

Instructions

Pre-requisites

  • To run any of the jupyter notebooks follow instructions here or install via pip.
pip install jupyter
  • In addition we make heavy use of pandas, numpy, scipy and numba
  • We recommend the use of anaconda
  • For numba instructions, you can find a tutorial and installation guideline here.
  • For the torch version of the code training and generating code please follow the instructions here
  • In addition you will need to have installed torch packages hdf5 and dpnn
luarocks install hdf5
luarocks install dpnn
  • For the pytorch version you will need to have installed h5py and tifffile
pip install h5py
pip install tifffile
  • Clone this repo
git clone https://github.com/LukasMosser/PorousMediaGAN
cd PorousMediaGAN

Pre-trained model (Pytorch version only)

We have included a pre-trained model used for the Berea sandstone example in the paper in the repository.

  • From the pytorch folder run generate.py as follows
python generator.py --seed 42 --imageSize 64 --ngf 32 --ndf 16 --nz 512 --netG [path to generator checkpoint].pth --experiment berea --imsize 9 --cuda --ngpu 1

Use the modifier --imsize to generate the size of the output images.
--imsize 1 corresponds to the training image size Replace [path to generator checkpoint].pth with the path to the provided checkpoint e.g. checkpoints\berea\berea_generator_epoch_24.pth
Generating realizations was tested on GPU and CPU and is very fast even for large reconstructions.

Training

We highly recommend a modern Nvidia GPU to perform training.
All models were trained on Nvidia K40 GPUs.
Training on a single GPU takes approximately 24 hours.
To create the training image dataset from the full CT image perform the following steps:

  • Unzipping of the CT image
cd ./data/berea/original/raw
#unzip using your preferred unzipper
unzip berea.zip
  • Use create_training_images.py to create the subvolume training images. Here an example use:
python create_training_images.py --image berea.tif --name berea --edgelength 64 --stride 32 --target_dir berea_ti

This will create the sub-volume training images as an hdf5 format which can then be used for training.

  • Train the GAN
    Use main.py to train the GAN network. Example usage:
python main.py --dataset 3D --dataroot [path to training images] --imageSize 64 --batchSize 128 --ngf 64 --ndf 16 --nz 512 --niter 1000 --lr 1e-5 --workers 2 --ngpu 2 --cuda 

Additional Training Data

High-resolution CT scan data of porous media has been made publicly available via the Department of Earth Science and Engineering, Imperial College London and can be found here

Data Analysis

We use a number of jupyter notebooks to analyse samples during and after training.

  • Use code\notebooks\Sample Postprocessing.ipynb to postprocess sampled images
    • Converts image from hdf5 to tiff file format
    • Computes porosity
  • Use code\notebooks\covariance\Compute Covariance.ipynb to compute covariances
    • To plot results use Covariance Analysis.ipynb and Covariance Graphs.ipynb as an example on how to analyse the samples.

Image Morphological parameters

We have used the image analysis software Fiji to analyse generated samples using MorpholibJ.
The images can be loaded as tiff files and analysed using MorpholibJ\Analyze\Analyze Particles 3D.

Results

We additionally provide the results used to create our publication in analysis.

  • Covariance S2(r)
  • Image Morphology
  • Permeability Results
    The Jupyter notebooks included in this repository were used to generate the graphs of the publication.

Citation

If you use our code for your own research, we would be grateful if you cite our publication ArXiv

@article{pmgan2017,
	title={Reconstruction of three-dimensional porous media using generative adversarial neural networks},
	author={Mosser, Lukas and Dubrule, Olivier and Blunt, Martin J.},
	journal={arXiv preprint arXiv:1704.03225},
	year={2017}
}

Acknowledgement

The code used for our research is based on DCGAN for the torch version and the pytorch example on how to implement a GAN.
Our dataloader has been modified from DCGAN.

O. Dubrule thanks Total for seconding him as a Visiting Professor at Imperial College.

More Repositories

1

stochastic_seismic_waveform_inversion

Official Implementation of "Stochastic seismic waveform inversion using generative adversarial networks as a geological prior"
Jupyter Notebook
45
star
2

SNIST

A Benchmark for Seismic Velocity Inversion from Synthetics
Jupyter Notebook
41
star
3

geogan

Conditioning of three-dimensional geological and pore scale generative adversarial networks
Jupyter Notebook
33
star
4

MontePetro

Monte Carlo estimation of reservoir reserves.
Python
33
star
5

DeepFlow

Pytorch implementation of "DeepFlow: History Matching in the Space of Deep Generative Models"
MATLAB
32
star
6

digital_rocks_data

Download and load digital rocks datasets
Python
27
star
7

asi-pytorch

Pytorch implementations of "Automatic Seismic Interpretation" publications and repositories
Jupyter Notebook
27
star
8

neural_rock_typing

Can machines help us understand how to distinguish rock types?
Jupyter Notebook
21
star
9

geo-deadlines

Repository of upcoming abstract submission deadlines for geoscience conferences
Jupyter Notebook
16
star
10

londonhack_pytorch

Jupyter Notebook
11
star
11

OklahomaProductionData

A repository of machine-learnable formatted oklahoma o&g production data.
Jupyter Notebook
9
star
12

geolink_dataset

Analysis notebooks for the geolink well log dataset
Jupyter Notebook
9
star
13

force_npd_llm_hackathon

Starter Pack for the Force NPD LLM Hackathon November 2023
Jupyter Notebook
7
star
14

roeth_tarantola_blog_series

Reproducing Roeth and Tarantola using Modern Tools - Blog Series
Jupyter Notebook
6
star
15

order_agnostic_diffusion_geostats

Order-Agnostic Autoregressive Diffusion Models for Geostatistical Applications
Jupyter Notebook
6
star
16

tutorial_gans_for_inverse_problems

Short tutorial on using GANs for probabilistic solutions to ill-posed inverse problems
Jupyter Notebook
6
star
17

Jupetro

A collection of oil&gas related Jupyter notebooks
Jupyter Notebook
5
star
18

ipython-notebooks

Collection of ipython notebooks I have made over the years. Includes notebooks on geoscience, petroleum engineering, data science and more.
Jupyter Notebook
3
star
19

SPE_GS_DL

Jupyter Notebook
2
star
20

MPyS

Python
1
star
21

GasOilGravityDrainage_LM

Data used in the creation of plots for the BSc. Thesis of Lukas Mosser
1
star
22

tarotGPT

Python
1
star
23

learning_rust

Rust
1
star
24

dask-nlmeans

Non-Local Means on Dask
1
star
25

pmgan

Pytorch implementation of porous media gan with automatic monitoring of properties
Python
1
star
26

pydca

Decline Curve Analysis in Python
1
star
27

MSc_Thesis

Lukas Mosser MSc Thesis repository
Jupyter Notebook
1
star
28

icml2024_finder

Find relevant sessions at ICML 2024
Python
1
star
29

PyWeka

Image Segmentation in the style of the famous ImageJ plugin "Interactive Weka Segmentation"
Jupyter Notebook
1
star