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

To evaluate the variability of multi-phase flow properties of porous media at the pore scale, it is necessary to acquire a number of representative samples of the void-solid structure. While modern x-ray computer tomography has made it possible to extract three-dimensional images of the pore space, assessment of the variability in the inherent material properties is often experimentally not feasible. We present a novel method to reconstruct the solid-void structure of porous media by applying a generative neural network that allows an implicit description of the probability distribution represented by three-dimensional image datasets. We show, by using an adversarial learning approach for neural networks, that this method of unsupervised learning is able to generate representative samples of porous media that honor their statistics. We successfully compare measures of pore morphology, such as the Euler characteristic, two-point statistics and directional single-phase permeability of synthetic realizations with the calculated properties of a bead pack, Berea sandstone, and Ketton limestone. Results show that GANs can be used to reconstruct high-resolution three-dimensional images of porous media at different scales that are representative of the morphology of the images used to train the neural network. The fully convolutional nature of the trained neural network allows the generation of large samples while maintaining computational efficiency. Compared to classical stochastic methods of image reconstruction, the implicit representation of the learned data distribution can be stored and reused to generate multiple realizations of the pore structure very rapidly.


I. INTRODUCTION A. Image Reconstruction
The reconstruction and the evaluation of the material properties of porous media plays a key role across many engineering disciplines.Many physical processes such as the movement of multiple phases of fluids through sedimentary rocks are controlled by individual pores at the micron and sub-micron scale [1].
In carbon capture and sequestration (CCS), the long term storage behavior is controlled by the physical and chemical interaction of super-critical CO 2 with the reservoir brine, as well as the spatial distribution and connectivity of minerals in the pore-space [2,3].The variability of the controlling properties such as the permeability of the host rock is determined by repeated experiments or numerical modeling of these processes.
Using modern computer tomographic methods, it is possible to observe porous materials and evaluate their material properties at the micrometer scale (micro-CT) under static and transient conditions at high pressures and temperatures in near real time.Performing micro-CT imaging of porous media requires specialized, expensive equipment and in the case of CCS, only a single image of the investigated rock type is typically acquired.
To evaluate the variability associated with the geometrical and mineralogical morphology of the pore-space, numerous physical experiments using the same rock type would have to be performed to obtain a distribution over larger volumes.Due to time and cost limitations inherent with the experimental acquisition of high-resolution images, this is often deemed unfeasible.Material properties governing the single and multi-phase flow behavior of porous media can be estimated from numerical solution of partial differential equations at the scale of a representative elementary volume (REV) and verified by experimental results [4].
Many sedimentary rocks consist of granular siliciclastic or carbonate materials.Boolean models use this fundamental characteristic of natural granular materials to emulate the shape of the arising pore space, due to an underlying random process that controls the distribution of the individual grains [5,6].While for the classical Boolean model, the centers of the grains are uniformly distributed in space and grains can arbitrarily overlap, more complicated models with rigid hard sphere grains and more complex grain interaction functions have been developed [7][8][9][10].The framework of Boolean models also allows extension beyond spherical particles and enables derivation of the properties of material models as arXiv:1704.03225v1[cs.CV] 11 Apr 2017 a function of the parameters of the underlying random process [11][12][13][14].
In sedimentary rocks, the arrangement of individual grains occurs due to the transport of material from a high energy source to a low energy sink.Process models, where depositional mechanisms are simulated, have been shown to reproduce realistic granular reconstructions capturing the pore space morphology of granular sedimentary rocks [15].
Spatial probabilistic models such as truncated Gaussian processes or sequential indicator simulation have been widely applied in the geosciences to model the spatial distribution of materials [16].Many of these methods rely on two-point probability functions as a measure of spatial variability, whereas recent methods in geostatistics use training images as a basis for sample reconstruction [17][18][19].These images are usually assumed to exhibit stationarity of the probability distribution of the properties of interest and rely on higher order multiple point statistics (MPS) to reconstruct stochastic random media.
With MPS, the probability distributions are represented by training images and are sampled using a limited multi-scale neighborhood that captures the variation on a large scale, as well as fine structural details on smaller scales [20].MPS based methods have been used in two and three-dimensional conditional simulation of spatial properties in reservoir-scale earth modeling applications [21].The computational complexity of these methods is highly dependent on individual algorithms as well as the size of the domains used to sample from the training images [22].Parallelized versions have been developed, reducing the computational time required to perform reconstruction using multiple point statistics [23,24].
Three-dimensional porous media have been reconstructed using a modified multiple-point statistics approach based on two-dimensional images of porous media [25][26][27].
Stochastic methods based on simulated annealing allow the incorporation of arbitrary cost functions of statistical and morphological properties used in unconditional three-dimensional image reconstruction [28,29].Recent advances have reduced the computational runtime of simulated annealing based methods for reconstruction of porous media, to the order of tens of hours per realization at the scale of 300 3 voxels [30].
In the following section, we introduce a recently developed class of unsupervised machine learning methods called generative adversarial networks (GAN) that allow simulation of probability distributions given a set of training data [31].Volumetric generative adversarial networks have previously been applied to low-resolution three-dimensional CAD model synthesis, and practical applications of 3D-GANs are few compared to their two-dimensional counterpart [32].Integration of multiresolution datasets incorporating image data across a number of length scales is possible in the GAN framework by using a Laplacian pyramid approach such as StackGAN [33].
We investigate the applicability of GANs to model three-dimensional textures of rocks based on threedimensional binary representations of porous media acquired at the micrometer scale.We compare statistical, morphological and transport properties of the simulated images with those of the training images.We evaluate the single-phase directional permeability to show that the synthetic realizations sampled from the learned representation of the input data can capture single-phase flow properties of sedimentary rocks.
Training of these neural networks involves finding a set of hyperparameters that lead to stable training [34].While this training can take on the order of tens of hours, the sampling of large volumetric domains occurs on the order of seconds on the current generation of graphical processing units (GPU).We show that in favorable cases convolutional neural networks incorporated in the GAN framework allow the generation of synthetic reconstructions of porous media that exceed the dimensions of their training images.Contrary to most existing simulation techniques the set of parameters used to generate synthetic realizations can be stored once trained allowing rapid generation of new samples to assess the variability of material properties.
While we apply GANs to a set of micro-CT images of porous media, the method can readily be applied to volumetric images of porous media obtained from other three-dimensional microscopy instruments such as nano or medical-CT instruments.
We discuss the challenges involved in training GANs for stochastic image reconstruction of porous media, as compared to other stochastic image reconstruction methods and evaluate the computational efficiency of GAN based image reconstruction.Finally, we provide empirical guidelines on the requirements of the input dataset to allow successful training of GANs on large threedimensional voxel representations of natural porous media.
All data used in this study is available in the public domain and we have made the code used for training, as well as example pre-trained models, available as additional supporting material1 .A public dataset of highresolution micro-CT images made available by the Imperial College Pore-Scale Modelling Group2 , of a spherical beadpack, Berea sandstone, and oolitic Ketton limestone will serve as benchmark cases to study the application of GANs to three-dimensional stochastic image reconstruction.The generator G is a function that is applied to a sample from a latent random space Z and creates a synthetic realization.We assume that samples drawn from the hidden latent space Z are distributed according to a normal distribution (see Sec. II).The discriminator's role is to determine whether a sample is part of the training image dataset (label 1) or from the generator (label 0).The misclassification error is computed as a binary cross-entropy criterion and the error back-propagated to improve the discriminator's ability to distinguish real and "fake" images.Then the generator is updated to improve the quality of the produced samples and "fool" the discriminator.When sufficient image quality is obtained, training is stopped, and the discriminator may be discarded.The generator can now be used to create new samples.By providing larger latent vectors than used initially for training, larger output images can be produced.

II. GENERATIVE ADVERSARIAL NETWORKS
In the following section, we present generative adversarial networks (GAN) in the context of threedimensional image generation.Generative neural networks have been developed in the context of deep learning by Goodfellow et al. as a methodology to learn a representation of a high-dimensional probability distribution from a given dataset [31].In the context of image reconstruction, we refer to this dataset as a set of training images that present representative samples of the probability distribution underlying the image space.
GANs learn an implicit representation of the probability density as opposed to explicit density models.The main drawback of explicit density models is their computational cost which grows with the dimensionality of the samples and requires sequential simulation of each voxel.For high-dimensional samples such as volumetric image data, the computational cost is O(N ) where N represents the number of voxels in the domain of interest and can easily exceed 10 9 voxels for modern high-resolution micro-CT image data.Using any of these methods would make it intractable to generate a large number of very large samples.GANs have been designed to perform fast sampling from the learned density representation and allow full parallel generation, making them an ideal candidate to generate large volumetric images [34].
GANs consist of two differentiable functions: a discriminator D and a generator G.The discriminator receives samples of the "real" dataset (Label 1) x ∼ p data and "fake" samples G(z) (Label 0) created by the generator from the hidden latent space Z (see Fig. 1 above).The latent space Z is composed of independent real random variables, typically normally or uniformly distributed, that represent the random input to the generator G.The generator G maps random variables from the latent space into the space of images.The discriminator's role is to assign a probability that a random sample is from the "real" data distribution p data .The discriminator tries to label each sample correctly, while the generator tries to "fool" the discriminator into labeling the fake images as part of the true data distribution and therefore achieving D(G(z)) close to one.
More formally we can define the loss i.e. the cost function for GANs as a minimization-maximization problem Solutions to this optimization problem have been shown to be Nash equilibria, where each player achieves a local minimum of their loss function with respect to their parameters [34].
In practice we represent G and D by convolutional neural networks that are trained by a gradient descent based optimization method.Training is performed in two steps: First the discriminator is trained to maximize while the parameters of the generator are fixed.This improves the ability of the discriminator to distinguish between real and fake images.
In a subsequent step we generate synthetic samples G(z) by drawing samples z from an N-dimensional normal distributed latent space and train the generator to minimize while keeping the discriminator fixed.By minimizing Eq. (3) the generator tries to "fool" the discriminator into believing that the samples G(z) are real data samples.In this way the generator learns to represent a distribution p g (x) that is as close as possible to the real data distribution p data (x).When convergence is reached p g (x) = p data (x) and the value of the discriminator becomes 1  2 as it cannot distinguish between the two anymore.
Initially, the discriminator D outperforms the generator significantly making the gradient used to train the generator close to zero.Therefore, instead of minimizing log(1 − D(G(z)) for the generator, it is helpful to maximize log(D(G(z)) [34].
GANs show highly unstable behavior during training and a large number of trial and error runs are required to find an optimal set of hyperparameters that allow stable training.A number of heuristics have been published which have been shown to stabilize GAN training, such as one-sided label smoothing and adding white noise to the input layer of the discriminator [35,36].
We provide a more detailed overview of the neural networks used in this study in Sec.III B and later provide suggestions on how to facilitate efficient training (see Sec. VI) for volumetric image datasets of porous media.

III. METHODOLOGY
In the following section we outline the criteria used to evaluate the quality of simulations based on the training image datasets.We treat all images under the assumption of stationarity and the existence of a representative elementary volume.

Two-Point Statistics
We characterize the second order structure of the porous media by calculating the two-point probability function of the pore phase.By assuming stationarity, this function is equivalent to the non-centered covariance [7]: which is the probability P that two points x and x + r, separated by the lag vector r, are located in the pore phase P .At the origin, S 2 (0) is equal to the porosity φ. S 2 stabilizes around φ 2 as r → ∞ (Fig. 2).Due to the anisotropic nature of many porous media, we compute S 2 (r) along the three Cartesian directions, as well as the radial average of S 2 (r).It is a well known result that the specific surface area S V of a porous medium can be expressed as a function of S 2 [37].In the case of an isotropic porous medium and in three-dimensions S V is related to S 2 by where S 2 (0) is the derivative of S 2 (r) at the origin.Furthermore, the average chord length within the pore and the grain phases are [10] which for the pore phase can be readily found from the intersection of the slope of S 2 (r) with the x-axis.
In favorable cases, it is possible to find analytical expressions of S 2 (r) from the spatial distribution and geometry of the grains.A Boolean model of overlapping spherical grains of uniform spatial distribution exhibits an exponential decay of the covariance until the lag distance is equal to the diameter of the grains where it becomes zero [7].For porous media that can be well described by a Boolean model, we can estimate the size of the elementary Boolean grain from the decay of S 2 .
Semi-analytical expressions for more complex models such as for a packing of hard spheres have been developed [38].Models of S 2 (r) for spherical packings exhibit a dampened oscillation.The shape of the estimated covariance, therefore, allows us to obtain information on the structure of the porous medium (see Fig. 2

above).
The covariance S 2 (r) was estimated for the training images and the stochastic reconstructions generated by the trained GAN model.For each GAN model, we evaluate the non-centered covariance S 2 as well as the specific surface area S V [Eq.( 5)] and compare these to the values obtained from the original training images.
In our discussion on the required training image sizes (Sec.VI), we will use the average chord length and the specific surface area as possible indicators of the necessary training image size.

Morphological Measures
It has been shown that flow properties at the porescale can be related to morphological characteristics of the void-solid interface of a porous medium [39].Hadwiger's theorem states that the size of a body in a ddimensional space can be described by a linear combination of d + 1 independent parameters characterizing the body.In three dimensions we can, therefore, define four so-called Minkowski functionals that fully characterize the size of a three-dimensional object.We compute estimates of three Minkowski functionals; the porosity φ, the specific surface area S V and the Euler characteristic χ V corresponding to the zero, first and 3 rd order functionals.
We compute the densities of the Minkowski functionals by dividing by the volume V .
The Minkowski functional of order zero is the porosity, defined as the ratio of volume of the void space to the bulk volume of the sample and is, therefore, a measure of the ability of a porous medium to store fluids.The Minkowski functional of rank one is the specific surface area S V .
where integration occurs over the void-solid interface S.
The specific surface area S V has dimensions of 1 length and its inverse allows us to define a characteristic pore size.
The specific Euler characteristic is closely related to the order three Minkowski functional and represents a dimensionless quantity defined as where r 1 and r 2 are the principal radii of curvature of the void-solid interface.To compute χ V we do not directly evaluate the integral in Eq. ( 9) but instead make use of a relationship for the Euler characteristic of arbitrary polyhedra, where V is the number of vertices, E the number of edges, F the number of faces and O the number of objects [1].This expression is the basis for efficient algorithms to compute Minkowski functionals of arbitrary geometric bodies represented as volumetric voxelized domains [40].To compute these three Minkowski functionals we have used the open-source image morphological software library MorphoLibJ [41].
While the porosity expresses the ability to store fluids in a porous medium, adsorption and dissolution processes are controlled by the specific surface area.The Euler characteristic allows the connectivity of the porous medium to be characterized, which is a critical component in the ability of fluids to flow.Reconstructions of porous media should therefore closely match the observed Minkowski functionals to represent the behavior of relevant physical processes at the pore-scale.
The direct computation of the specific surface area S V and porosity φ from images allows us to perform a comparison with the values obtained from estimates obtained by computing the empirical non-centered covariance S 2 (r) [see Eq. ( 5)].

Single-Phase Permeability
To evaluate the single-phase permeability of the porous media and their generated synthetic reconstructions we solve the Stokes equations for slow, incompressible flow assuming small inertial forces.
The Stokes equations are solved on the domain that is connected to the fluid inlet and outlet.This allows us to define an effective porosity where only the fraction of the pore space that also contributes to flow is considered A finite difference method to solve Eq. ( 11a)-(11b) on pore-space representations has been implemented as a parallel flow solver, in the free open source numerical framework OpenFOAM [4,42].

B. Neural Network Architecture
The neural network architecture used for the threedimensional image reconstruction corresponds to a volumetric version of the DCGAN network [43].The network consists of two independent fully convolutional neural networks, the generator G and the discriminator D. Upsampling from the input latent vector z is performed by volumetric transposed convolution, followed by batch normalization and a rectified linear unit (ReLU) activation function in all layers except the last [44,45].
The discriminator D receives images sampled from the latent space by the generator G(z) and images from the set of training images representing p data (x).Therefore, the size of the input layer of the discriminator corresponds to the dimensions of the input training images.The discriminator consists of volumetric convolution layers combined with LeakyReLU activation functions [46].The final convolutional layer of the discriminator is followed by a Tanh activation function.
This combination of generator and discriminator neural network architectures has previously been applied to subsets of the Imagenet and CIFAR-10 datasets [43].The hyperparameters for the generator to be used in the optimization of the neural network architecture are the number of trainable convolutional filters in each layer of the neural network N G,F , N D,F and the size of the latent vector z.
The generator and discriminator are optimized using a gradient descent based method where the parameters w are changed by taking k steps in the gradient where α is the learning rate.We have used the gradient descent based optimiser ADAM for optimization of both the generator and discriminator [47].
GANs have been shown to exhibit unstable behavior during training.The addition of Gaussian noise to the input of the discriminator provides an effective measure to prevent mode collapse and stabilize the training process [36].An additional stabilization measure called onesided label smoothing, wherein the class label of 1 for real images is replaced by a new value of 1 − has been empirically shown to improve training of GANs [35].
Both label smoothing and white noise addition to the input of the discriminator have been used in this study to stabilize the training based on the volumetric image datasets.Table I gives an overview of the neural network hyperparameters used for each evaluated sample, the hyperparameters and the stabilization measure used during training.
Images generated by the GAN were post-processed using a 3 3 median filter to remove single-pixel noise.The resulting images are grayscale images with all voxel values close to zero or one.To compare the resulting images to the binary training images, we segment the generated images using Otsu's method [48].

A. Image Data and Processing
To evaluate the applicability of GANs for reconstruction of natural porous media we use three previously acquired datasets.All images have been segmented into a three-dimensional binary voxel representation of the pore space (white) and grain structure (black) (Fig. 3).We create a training database of images by extracting subvolumes from the voxelized binary images.Ideally, these training images should represent independent domains, but due to the limited size of these images, we extract subsets that overlap.
Training image sizes were chosen based on an estimate of the average grain size for each sample.To be able to match the covariance S 2 (r) [Eq.( 4)] and image morphological characteristics, training images larger than the structuring element were necessary.We discuss this requirement in more detail in the discussion of our results (see Section VI).Due to computational limitations, training image sizes exceeding 128 3 voxels were not considered.

Beadpack
The beadpack is based on a real packing of equally sized ceramic grains in a disordered close packing [49].The image consists of 500 3 voxels with a size of 3 µm.The size of an individual sphere is 50 voxels.1727 training images were extracted of size 128 3 voxels corresponding to a spacing of 32 voxels between them in the original image.

Berea
Berea sandstone is a fluvial sandstone of medium to fine grain size (Wentworth classification) [50].The individual grains are bonded by clays.The sample analyzed in this study was acquired from an outcropping of the Berea sandstone in a quarry near Berea, Ohio.De Witt showed that the Berea sandstone was deposited in the early Carboniferous (354-323 Mya) [51].
The image of Berea sandstone consists of angular grains with no clay presence in the intergranular porespace.The image has dimensions of 400 3 voxels with a voxel size of 3 µm.
To capture the local interaction of grains we have extracted training images at 64 3 voxels which allows a number of grains to be present in one training image (see Sec. VI).Due to the small image size of 400 3 voxels, subvolumes were extracted at a spacing of 16 voxels.In all, 10647 training images were used for the image reconstruction.

Ketton
The Ketton sample is an oolitic limestone of Jurassic age (201.3-145Mya).The sample was acquired from a quarry of Lincolnshire limestone in the North-East of England.The oolites contained in the Lincolnshire formation are mainly non-ferroan calcite grains.The oolitic limestones of the Lincolnshire show a wide variety of cementation, ranging from uncemented oolite sands with no intergranular cement to heavily ferroan spar-cemented oolites with infilled microporosity [52].Microstructures in the pore space can be observed that lead to a reduction in porosity (Fig. 3).2)-( 3)] for the GAN trained on the Berea sandstone.The samples shown were computed with the same random number seed, showing the evolution of a single realization during training.Initially, image quality is very low and random noise can be observed.After 2000 generator iterations a drop in the generator loss function is observed and coarse structures can be identified in the resulting sample.Loss functions in GAN models do not reflect improvement in image quality which can be observed from samples.Learning rates [see Eq. ( 13)] were reduced after sufficient image quality was reached and training stopped based manual inspection of Minkowski functionals and two-point statistics.
The Ketton sample chosen for this study consists of large grains compared to the overall image size.The image used for the following evaluation has been downsampled from a 500 3 voxel representation to an image size of 256 3 voxels.This allows more grains to be resolved per training image extracted from the full volume.The downsampled voxel size is 15.2 µm.
Training images were extracted at a sub-volume size of 64 3 with a spacing of 8 voxels leading to a total of 15624 training images.The small spacing of the training images results from the small CT image size of 256 3 voxels.

V. RESULTS
Three GANs were trained based on the network architectures highlighted in Sec.III B. The training time for each dataset was 24 hours.Manual inspection of synthetic realizations was performed during training to ensure convergence and intermediate evaluation of the covariance and Minkowski functionals.
Figure 4 shows the training curve for the Berea sandstone dataset.Initially the generator loss function [see Eq. ( 3)] is very high and no structural components can be observed in the samples.After a large reduction in the loss function of the generator, initial structures are observed.Image reconstruction quality significantly improves with the number of generator iterations, but cannot be linked to the loss function of the generator.This can be observed from the increase in generator loss at the end of training while image quality improves significantly.
The final GAN models were subsequently evaluated in terms of their directional and radial averaged noncentered covariance S 2 (r), Minkowski functionals and the single-phase permeability.
For all datasets, 20 realizations were generated using the trained GAN model.In the following section, we present the results of the evaluation of the properties outlined in Sec.III A and compare these to the properties of the original input training image.

A. Beadpack
The evaluation of the non-centered covariance S 2 (r) for the beadpack (Fig. 5) shows a strong hole effect reflecting the spherical nature of the grains.
A GAN model was trained for 24 hours on the beadpack training image dataset.The GAN model achieves a small error in the porosity of the generated images with a tendency towards higher porosities (Fig. 7).
A bias can be observed for the specific surface area and the Euler characteristic of the microstructure (Table II).
This bias can be explained by the deviation of the grains from a perfect spherical shape in the synthetic realizations.Due to the smooth nature of the spherical particles in the training image, any deviation from this geometry will lead to an increase in the surface area.This is reflected by a higher specific surface area for the synthetic realizations.In addition we observe a reduction in connectivity, represented by a less negative Euler characteristic.
The directional covariance S 2 measured on the generated samples show excellent agreement up to the training image size of 128 3 voxels and stabilizes at φ 2 (see Fig. 8).As expected no directional variation of the covariance is observed and the sample is therefore assumed to be isotropic.
Single-phase permeability shows a close agreement in both magnitude and variance between the measured training image and the synthetic realizations (Fig. 7). Figure 6 shows a crossplot of the effective porosity φ ef f i.e. the porosity open to flow [Eq.( 12)], and the singlephase permeability exhibiting a similar trend in the distribution of values computed on training images and synthetic realizations.
We provide a comparison of all twenty realizations generated by the GAN model in cross-sections through the x-y plane of the original model and a synthetic realization in Fig. 9.
Many of the grains show a circular to ellipsoidal shape, which considering the fact that a priori the GAN model does not have any knowledge of the geometry of the grains, learning a representation of a perfect sphere can be considered challenging (see Sec. VI).The complex grain-grain interface where individual beads contact at single points can be observed for numerous grain arrangements in the generated realizations.5)-( 6)].

FIG. 6.
A comparison of the numerical estimated singlephase permeability of the beadpack for 128 3 voxel subdomains of the original image and equal sized GAN based realizations shows an overestimation of the effective porosity for the synthetic models.The mean and variance of both permeability distributions have been found to be in close agreement (see Fig. 7).TABLE II.Chord lengths lC for the pore and grain phase [Eq.( 6)] determined from the radial averaged covariance S2(r) of each training image and corresponding realizations generated by the GAN model.The specific surface area SV and porosity φ were evaluated for each of the samples using direct image morphological computation and derived from the covariance.Close agreement between estimates of the porosity and specific surface area can be observed for values determined by direct image morphological estimation and derived values obtained from the radial averaged covariance.

B. Berea
The radial averaged covariance S 2 (r) in Fig. 10, shows a near exponential decay and stabilisation occurs at a lag distance of 30 voxels for both covariance functions obtained from the Berea training image and synthetic realizations generated by the GAN model.
Additionally, Fig. 12 shows that the directional twopoint statistics characterized by the directional covariances is captured in the generated images.This is shown by comparing the small hole effect observed in the zdirection of the Berea sample with the x-direction where a near exponential decay can be observed.In both cases, the GAN model shows excellent agreement and closely follows the trend of the empirical estimates of S 2 .
The results of the direct computation of the Minkowski functionals is presented in Fig. 13 and show comparable distributions for the porosity φ, specific surface area S V and the Euler characteristic χ V of the training images and the synthetic realizations.
A comparison of the specific surface area S V obtained from the covariance and the direct computation of the Minkowski functional, show nearly equal values (Table II).
The obtained estimates of the single-phase permeability show a similar distribution covering the range of effective permeability measured on the training images.Figure 11 shows the computed values of permeability and the corresponding effective porosity.The permeability of the synthetic realizations capture the values, variability and trend obtained from the Berea training image dataset.
Figure 14 shows a comparison of twenty realizations of the GAN model trained on the Berea dataset.A smaller training image size of 64 3 voxels was used, as compared to the beadpack (128 3 voxels).This is due to the smaller size of the structuring elements observed in the training image.A smaller training image size was therefore sufficient to capture the long and short range correlation found in the Berea sample.

C. Ketton
The covariance S 2 (r) of the Ketton limestone shown in Fig. 15, shows a pronounced hole effect due to the ellipsoidal oolitic grains.Due to the hole effect observed in the radial averaged covariance (Fig. 15), we relate the Ketton sample to a hard-sphere model.Figure 17 indicates that the images generated by the GAN model trained on the Ketton image, capture the oscillatory and anisotropic behavior of the covariance observed in Ketton.The specific surface area S V derived from the generated images is in close agreement with the training data.An error of approximately 1% was achieved in the porosity of the GAN generated images compared to the original Ketton dataset (Fig. 18).
The measured specific surface area of the synthetic images shows a higher variance compared to the original training images.Nevertheless, the average values of the porosity φ and specific surface area S V derived from the non-centered covariance S 2 (r) [see Eq. ( 5)] are in good agreement with values obtained from direct image morphological estimation (see Table II).
The distribution of single-phase permeability estimates of the synthetic GAN realizations overlies the permeability values of the Ketton training images.
The Euler characteristic χ V and the permeability of the Ketton training dataset are closely matched by the synthetic images and therefore capture the connectivity observed in the oolitic Ketton limestone.
We present an overview of the 20 realizations generated by the GAN model trained on the Ketton dataset in Fig. 19.

VI. DISCUSSION
This paper presents a novel method for threedimensional stochastic image reconstruction based on generative adversarial neural networks (GAN) trained on three-dimensional segmented images.To summarize, the objectives of this contribution are threefold.Firstly, the generation of stochastic reconstructions of porous media such as sedimentary rocks exceeding the size of the acquired image datasets.Secondly, to evaluate the ability of GAN models to capture the image morphological and physical properties of micro-scale porous media.Thirdly, to establish a method of stochastic image reconstruction that allows a probabilistic treatment of pore-scale properties such as permeability without the need to acquire numerous images of a single rock type.
The first objective stems from technical limitations of micro-CT data acquisition.Images are acquired as a trade-off between sample size i.e. how many representative structures can be captured in one image versus the resolution at which these pore-scale structures are resolved.The generation of large porous domains based on high-resolution images enables this gap in scales to be bridged and micro-scale features to be incorporated in macro-scale models.
Our findings show that GANs can learn an implicit representation of the image space given a limited number of training images subsampled from larger images.These subdomains were extracted based on characteristic length scales (see Sec. III A 1) and serve as a training set for the GAN model.For the Ketton limestone, a small spacing of the extracted subdomains was required to increase the size of the training image dataset.While we did not find any evidence of an introduced bias by using correlated subdomains, we believe that these extracted training images should represent independent regions.
We have evaluated the ability to train GANs for a number of training image sizes less than and up to twice the size of the structuring elements.We have found that models trained on images smaller than the average grain size results in artifacts and distorted shapes occurring in the generated micro-structures.For the beadpack, the size of an individual sphere is 50 voxels.A training image of 64 3 voxels would typically only contain parts of an individual grain and only capture the interaction of the particles, but not the geometry of the structuring element.For the beadpack, models trained on 64 3 voxels were successful in learning a representation of the short scale micro-structure but failed to reproduce the long distance correlation.A larger training image of 128 3 voxels, as was used to model the beadpack has a much higher chance to represent the full geometry of the particles and therefore not only learn interactions, but also the shapes of grains.
We, therefore, suggest that training images extracted from large datasets must be larger than the average grain size.For models that are well described by a Boolean model, the size of the structuring element can be readily estimated from stabilization of the covariance S 2 (r).For more complex samples a different measure must be used to estimate the size of the required training image.
The chord length is one additional measure that can be obtained to characterize the grain space of porous media.While we have found that the mean chord length of the grain space l grain C is always less than or equal to our chosen training image size, l grain C increases with decreasing porosity.This contradicts the need to have the largest training domain for the beadpack sample which also has the highest porosity.A better estimate may be related to the representative elementary volume of the specific surface area which by definition is the same for the grain and pore space and is, therefore, more representative of the morphology of the porous medium [53].Based on the properties we have evaluated we could not find a measure derived from two-point statistical or image morphological properties that is closely related to the required training image size and we see a theoretical discussion of this as possible future work.
Conceptually the simplest model considered in this study, the spherical beadpack, has proven to be the most challenging as a training image for the GAN model (Sec.V A).While we observe spherical and ellipsoidal shapes in the resulting realizations (see Fig. 9), the shape is exactly defined by the spherical nature of the grains.Any deviation from this shape, which for GANs, is learned implicitly from the data itself, will lead to a misrepresentation of the effective properties.Random hard-sphere models with spherical grains will efficiently capture the nature of this dataset.Therefore we suggest a fit-for-purpose application of GANs, for training images that exhibit variability of grain sizes and shapes, which are not readily captured by a simpler model.
While for many sedimentary granular rocks representative volumetric images can be obtained, this may be more challenging for carbonate samples with complex pore-grain structures.The three training images considered in this study were all treated under the assumption of stationarity i.e. we do not expect a variation in the mean and variance of the averaged properties as a function of location.In theory, GANs are not limited to learning representations of stationary datasets.This is shown by the many successful applications for two-dimensional image and texture synthesis of non-stationary domains, such as learned image representations of human faces [54] or galaxies [55,56].Therefore a model that incorporates non-stationarity for a single rock-type would technically be possible in the GAN framework but would require the acquisition of many images of the same porous medium.
A valid representation of the microscale variability and connectivity of the pore space is critical to assess the single and multi-phase flow behavior of porous media.Therefore any stochastic reconstruction method used in the process of deriving or evaluating the variability of micro-scale properties must capture the statistical and image morphological characteristics of the reconstructed porous medium.While we have shown that for the eval-uated datasets, the GAN based image reconstructions capture the variation and characteristics of these porous media, a number of challenges arise in this task that are fundamentally different to classical stochastic methods of image reconstruction.
For porous media, many flow related properties can be related to the porosity.Classical stochastic methods are able to capture the porosity efficiently by defining a specific proportion of the grain and pore domain.The GAN based model presented in this study initially has no knowledge of the porosity.The porosity, therefore, arises as a feature of the training image data.Matching the porosity distribution of the training image dataset was found to be the main challenge in training a GAN model.An error of three percent in porosity would lead to a mismatch in the permeability of the synthetic images.It is, therefore, necessary to continuously monitor the derived properties such as the Minkowski functionals or estimates of the permeability, in the course of training the neural networks to ensure that synthetic realizations created by the GAN model are able to capture the effective properties of the micro-scale domains.
While this can be considered one of the main challenges in the application of GANs for synthetic image reconstruction, learning an implicit representation of the training data itself can be seen as a strength.Many classic stochastic methods rely on the formulation of an objective function that ensures that statistical properties are captured in the generated realizations e.g.matching S 2 (r) and the specific surface area S V of the stochastic reconstructions to a desired precision.The GAN approach does not require an explicit objective function a priori.The objective function is encoded in the discriminator and adapted in the course of training.
During adversarial training both the generator and discriminator are continuously improved.The discriminator's sole purpose is to be able to distinguish real training data from generated synthetic data.On the other hand, the generator tries to generate synthetic data that the discriminator is not able to distinguish from the training data.Due to the multi-scale representation of the convolutional neural networks, these features must be learned across the full range of length scales present in the training data, leading to a high-resolution image that captures small and large scale features of the image dataset.A number of stacked GAN models can be trained on e.g.low-resolution medical-CT data and high-resolution micro-CT allowing incorporation of spatial information across multiple length scales [33].
Once the GAN model has successfully learned to create physically representative samples of the porous medium, one possible application is to evaluate the variability in the flow properties by evaluating the properties of a large number of samples.This not only requires a physically valid representation of the porous medium but also requires a method that allows fast image reconstruction.In Sec.V we have shown that training was performed for approximately 24 hours and may vary due to the need for manual inspection of the generated samples in the training process.Figure 20 shows the CPU time required for generation of images at increasing image size.The fully convolutional nature of the GAN architecture allows very large images, exceeding the size of the original sample to be generated very efficiently and at low computational cost and runtime.
While training requires considerable time and computational resources in the form of modern graphics processors as well as optimized neural network frameworks, image reconstruction requires little computational effort and scales linearly in the total number of voxels of the generated images.This, therefore, enables the generation of ensembles of large domains based on volumetric images acquired from 3D microscopy, that capture the physical behavior of the porous medium.The learned representation of the generator consists of the weights of the convolutional filters learned in the training process and can, therefore, be stored for future use once training has finished.

VII. CONCLUSIONS
We have evaluated the application of generative adversarial neural networks (GAN) for stochastic image reconstruction of porous media based on previously acquired images of sedimentary rocks.Three image datasets were used as training images: a beadpack, a Berea sandstone, and an oolitic Ketton limestone.
By evaluating two-point statistical measures, image morphological features and computing the single-phase effective permeability we have shown that the synthetic images generated by the GAN model are able to capture the characteristic statistical and physical behavior of these porous media.
While a large computational effort is required to train the GAN model, the generation of samples from the learned representation is highly efficient and learned models are easily stored for future use.
Future work in the application of GANs to stochastic image reconstruction of porous media will include improving the quality of the image reconstruction by evaluating various generator-discriminator architectures, the use of grayscale and multi-channel training images, as well as the application of large multi-scale domains of porous media to evaluate the ensemble behavior of single and multi-phase flow properties in porous media.Recent advances in the understanding of GANs should lead to a more stable and consistent training process [57,58].

FIG. 1 .
FIG. 1. Overview of the GAN training process.Segmented volumetric images are usually split into 64 3 voxel training images.The generator G is a function that is applied to a sample from a latent random space Z and creates a synthetic realization.We assume that samples drawn from the hidden latent space Z are distributed according to a normal distribution (see Sec. II).The discriminator's role is to determine whether a sample is part of the training image dataset (label 1) or from the generator (label 0).The misclassification error is computed as a binary cross-entropy criterion and the error back-propagated to improve the discriminator's ability to distinguish real and "fake" images.Then the generator is updated to improve the quality of the produced samples and "fool" the discriminator.When sufficient image quality is obtained, training is stopped, and the discriminator may be discarded.The generator can now be used to create new samples.By providing larger latent vectors than used initially for training, larger output images can be produced.

FIG. 2 .
FIG. 2. Comparison of S2(r) for a Boolean model and a packing of hard spheres at a porosity φ = 0.5.S2 exhibits exponential decay for the Boolean model, whereas a dampened oscillation is characteristic for packings of spheres.The mean chord length can be found at the intersection of the slope of S2 at the origin with the x-axis [see Eq. (6)].

FIG. 3 .
FIG. 3. Cross-sections of the three binary images that have been reconstructed.The bordered regions indicate the size of the training images extracted from the full dataset.The beadpack consists of spheres of equal diameter (d = 50 voxels).The Berea sandstone is an angular granular sandstone that shows traces of dispersed clay.The oolitic Ketton limestone consists of ellipsoidal grains showing inter and intra-granular porosity.The voxel sizes are 3 µm for the bead pack as well as the Berea sandstone and 15.2 µm for the Ketton sample.

FIG. 4 .
FIG. 4. Value of the cost function i.e. loss of the discriminator and generator [Eq.(2)-(3)] for the GAN trained on the Berea sandstone.The samples shown were computed with the same random number seed, showing the evolution of a single realization during training.Initially, image quality is very low and random noise can be observed.After 2000 generator iterations a drop in the generator loss function is observed and coarse structures can be identified in the resulting sample.Loss functions in GAN models do not reflect improvement in image quality which can be observed from samples.Learning rates [see Eq. (13)] were reduced after sufficient image quality was reached and training stopped based manual inspection of Minkowski functionals and two-point statistics.

FIG. 5 .
FIG. 5. Radial averaged covariance S2(r) for the beadpack sample and 20 synthetic realizations generated by the GAN model.The specific surface area SV and mean chord lengths lC are derived from the slope of the covariance at the origin [see Equ.(5)-(6)].

FIG. 7 .
FIG. 7. Comparison of three Minkowski functionals for the beadpack evaluated on 200 3 voxel subdomains of the original training image and realizations of the GAN model.An error of less than 5% can be observed for the porosity and surface area.

FIG. 9 .
FIG. 9. Twenty realizations of the spherical beadpack (top) generated to evaluate the statistical, image morphological and transport properties considered in this study.Cross-sectional view of the beadpack training image dataset (bottom).

FIG. 10 .
FIG. 10.Radial averaged covariance S2(r) for Berea sandstone training images and 20 synthetic realizations generated by the GAN model.

FIG. 15 .
FIG. 15.Radial averaged covariance S2(r) for the oolitic Ketton limestone training image and 20 synthetic realizations generated by the GAN model.

FIG. 20 .
FIG. 20.Measured CPU time for generating synthetic realizations of Berea sandstone at increasing image size.100 realizations were computed at each image dimension and CPU time averaged.Computational cost increases linearly with the number of voxels in the generated image.

TABLE I .
Neural network configurations and hyperparameters used to train on voxelized image subsets.