# WGAN-Based Realization Process of Gravel Soil for Hydraulic Property Simulation
## 2 Generation of the Training Datasets  
According to the composition characteristics of gravel soils in Guilin city, three groups of granular soil specimens, each characterized by different fine grain content features, were placed in transparent acrylic cylindrical containers measuring 350 mm in height and diameter. These specimens exhibited characteristics typical of gap-graded gravel soils, lacking particles in the ranges of 1-2 mm, 0.5-1 mm, and 0.25-0.5 mm, which basically represent the typical characteristics of gravel soil in Guilin. High-resolution 3D X-ray microimaging using the Zeiss Xradia 510 Versa system produced \(\mu\)-CT images for each group, resulting in voxel datasets sized 1004 \(\times\) 1024 \(\times\) 1014 with a resolution of 35 \(\upmu\)m/voxel. After obtaining the \(\mu\)-CT raw dataset of 1014 pieces of 2D CT-images, each sized 1004 \(\times\) 1024 pixels, the images were processed using ImageJ software (1.54f) with threshold segmentation. Different threshold values based on grayscale intensity were applied to segment gravelly soil into two main components: void or solid skeleton. Using the cropping function in Avizo (2020), regions of interest (ROIs) containing well-developed pores were selected and cropped to 700 \(\times\) 700 pixels each, resulting in 700 cropped images per dataset. These images were then overlaid to create 3D representations, which were subsequently sliced into multiple 64 \(\times\) 64 \(\times\) 64 voxel-sized 3D images. This entire process generated three distinct datasets, each comprising 1900 training sets, as illustrated in Figure 1.  
The generation of training datasets involves tedious processes such as 3D \(\mu\)-CT image processing, conversion of images to matrices, and the formation of sub-models. Converting 3D pixel images into vector graphics is an important step in the early stage of AI graphics generation. Training set generation and storage based on MATLAB constitute an effective means for image processing and training dataset production in the early stage. The following points are the main steps to produce training datasets in the form of a MATLAB-based matrix. Formation of Image Matrices: Utilize the MATLAB script to read two-dimensional slice image files from a specified directory and load them into a three-dimensional array (volume = 700 \(\times\) 700 \(\times\) 700). Determination of Sub-Model Scope: Define a step size (stepSize = 64) and a block size (blockSize = 64 \(\times\) 64 \(\times\) 64) to cut up the three-dimensional array into uniformly-sized blocks along the \(x\), \(y\), and \(z\) directions. Calculate the number of blocks (numBlocks = 1000) that can be generated based on the given step size. Extraction of Sub-Models: Iterate through each block index, extract the corresponding block from the three-dimensional array, and save it as an M file. Ensure each file name includes information about its block index. Save all extracted block files in the specified directory. Achieved Outcome: The code effectively partitions the 3D \(\mu\)-CT raw data into consistent block sizes and stores these blocks as M files, which are ready for subsequent processing and analysis. The whole process of training dataset generation is described in Figure 1. The \(\mu\)-CT image data for ML learning in the study are freely accessible in Figshare (doi.org/10.6084/m9.figshare.25665360) (CC BY 4.0) [10]. Figure 1: A scheme of image processing and training set acquisition for different groups of soil specimens. Different gravel soil samples with unique characteristics of porous distribution can be formed; _nth_ groups of 64 \(\times\) 64 \(\times\) 64 in size for the training set were selected randomly from the 700 \(\times\) 700 \(\times\) 700 primitive soil prototype. Note: *.mat file is MATLAB’s data storage format, used to save variables, arrays, and structures. Specific preprocessing steps applied to the \(\mu\)-CT scan images prior to the above steps was necessary.