AWS HPC Blog

Building deep learning models for geoscience using MATLAB and NVIDIA GPUs on Amazon EC2 (Part 1 of 2)

This is a two-part blog post. In this first part, we discuss the workflow for developing AI models using MATLAB for seismic interpretation.  In part 2, we will introduce the various compute resources leveraged from AWS and NVIDIA for developing the models.

These posts were contributed by Akhilesh Mishra, Medical Devices Industry Manager at MathWorks.

Problem Background

Geologic interpretation of survey data is an important step for the oil and gas industry for guiding exploration, drilling, production and even abandonment of underground reservoirs. Seismic images delineate volumes of rock inside the Earth with different physical and geologic characteristics summarized by the term “facies”. An important step in the interpretation of the images is identification and classification of all distinct geologic facies in a 3D seismic image, often called seismic facies identification or classification. This process is still done largely by geologists assisted by specialists in geophysical data collection, processing, imaging, and display.  However, this process is done manually, and it can take several months to a year to get a successful seismic facies interpretation of just one survey region.

With continued advances in Artificial Intelligence, applications of deep learning and machine learning for automating seismic image analysis have recently increased. Most of the current techniques for automated seismic facies labeling are using Convolutional Neural Networks (CNN) for semantic segmentation [1][2][3].  The workflow mainly involves dividing the training dataset into smaller labelled patches, preprocessing and augmenting the patches, and training a deep CNN for semantic segmentation.  Dividing the datasets into smaller patches with augmentation results in large volumes of training data, and training a CNN with this data requires a high-end compute optimized infrastructure.

This post discusses how geoscientists can prototype a high-performance novel shallow Recurrent Neural Network (RNN) based AI algorithms using MATLAB on Amazon Elastic Compute Cloud (Amazon EC2) instances, powered by NVIDIA GPUs for automatically recognizing distinct geologic facies in seismic images.  MATLAB’s deep learning tool combined with signal and image preprocessing capabilities such as wavelets analysis, together with the computational power of NVIDIA GPUs and automatic seamless scaling on AWS cloud significantly reduces the time taken to prototype, develop and deploy these algorithms, thus overcoming the challenges associated with CNN methods.  Oil companies can then plan their drilling and rigging activities more efficiently based on the outputs provided by the automated AI algorithm, saving them both time and money.

This post uses the Parihaka 3-D dataset that has been labeled by Chevron as an example, and we present a signals-based deep learning approach for automatic labeling of the facies.

To run this example, you will need:

  • MATLAB
  • Wavelet Toolbox
  • Signal Processing Toolbox
  • Parallel Computing Toolbox
  • Deep Learning Toolbox
  • Amazon EC2 P4 GPU instances

Note: Please visit https://www.mathworks.com/campaigns/products/trials.html to request free trials of these toolboxes.

Digging into the data

The seismic data is publicly available and provided by New Zealand Petroleum and Minerals (NZPM) [5]. The associated labels, made available by Chevron U.S.A. are available at [6].   The training data set was a 3D seismic image represented as a 1006 x 782 x 490 matrix of real numbers stored in the order of (Z, X, Y).  Labels corresponding to the training data are similarly arranged and consist of integers with values ranging between 1 to 6.  Figure 1 shows the 3D view of the seismic survey data of XZ, YZ and XY slices (top) and corresponding 3D labels depicting 6 regions (bottom).  Figure 2 below shows the intensity plot of the echoes and the corresponding labels for each pixel in one 2D cross-sectional view of an XZ slice.

Figure 1: 3D views XZ, YZ and XY slices through Parihaka seismic data image (TOP) and corresponding labels (BOTTOM)

Figure 1: 3D views XZ, YZ and XY slices through Parihaka seismic data image (TOP) and corresponding labels (BOTTOM)

Figure 2: 2D cross-sectional view of XY slice (LEFT), and pixel-by-pixel classification of image in 6 facies (RIGHT)

Figure 2: 2D cross-sectional view of XY slice (LEFT), and pixel-by-pixel classification of image in 6 facies (RIGHT)

The test datasets represent 3D images to be classified by the machine learning algorithm (after supervised training using the training data set and labels). The test 1 dataset was 1006 × 777 × 248 in size and test 2 dataset was 1006 x 334 x 838.

Figure 3 shows a small section of the 2D image with 1D seismic traces superimposed on the facies. Upon close inspection we can see that each signal, also referred to as a “trace”, has a distinct signature when it encounters different facies.  For instance, at the transition from “dark blue” to “green” facies in the middle of image, the signal has a burst of high echo-amplitudes rapidly oscillating, whereas the interface below that between “light blue” and “dark blue” region has slower oscillations with a lower amplitude.  Expert geologists often look for these features in the vertical sequence of pixel values to identify the key interfaces between different facies.

Figure 3: Plots of image values (red) as a function of depth, superimposed on the facies interpretation in a small section. Note that that a burst of high echo-amplitudes rapidly alternating between positive and negative values is characteristic of the transition between “blue” and “green” facies across the middle part of the image.

Figure 3: Plots of image values (red) as a function of depth, superimposed on the facies interpretation in a small section. Note that that a burst of high echo-amplitudes rapidly alternating between positive and negative values is characteristic of the transition between “blue” and “green” facies across the middle part of the image.

The Workflow

1.    Preprocessing

The traditional approach for training Recurrent Neural Network (RNN) architecture would have been to train a sequence-by-sequence classification network directly using the input traces, but in our preliminary attempts the network failed to converge.  This was primarily because the signal features are changing very rapidly with time for the entire length of the signal. Discrete wavelet transform (DWT) is best at decomposing signals that rapidly change frequency in short time durations which was leveraged to overcome this issue.

A modified version of discrete wavelet transform is Maximal Overlap DWT (MODWT)which allows us to analyze signals in progressively finer octave bands without decimating the original signal.  The components ideally decompose the variability of the data into physically meaningful and interpretable parts. Figure 4 shows the decomposition of one such trace using the Signal Multiresolution App in MATLAB. After experimenting with various decomposition levels using different discrete wavelets,  the best decomposition results were obtained with an ‘fk14’ wavelet which divided the signal into 5 levels. As evident in Figure 4, the features distinguishing the different labels get separated into different bands which can now be used in deep learning training.

Figure 4: Multiresolution decomposition of the original signal into four levels + Approximation using fk14 wavelet. This is done using Signal Multiresolution App in MATLAB

Figure 4: Multi-resolution decomposition of the original signal into four levels + Approximation using fk14 wavelet. This is done using Signal Multi-resolution App in MATLAB

2.     Model Training

After decomposing the signals, we have 5 channels for each trace.  For this survey data, the resolution in the XY plane between different traces was ~3 feet.  According to [5], the seismic features are usually highly correlated up to ~10 feet in the XY dimension beyond which the features start to change.   To capture the correlation of the nearby traces and with the goal of building a more robust deep learning model, 3×3 traces in the XY plane were grouped together to train the same label definition of the middle trace.  Figure 5 shows the flowchart of the overall algorithm and how the dataset was grouped into 3X3 grid for 5 channels for each trace.

Figure 5: Overview of the proposed algorithm (LEFT), and organizing the 3x3 seismic grid together for deep learning training

Figure 5: Overview of the proposed algorithm (LEFT), and organizing the 3×3 seismic grid together for deep learning training

At this stage the dataset was also segmented into training and validation sets. 80% of the data from decomposition of 782×590 traces was used for training and the remaining was used for network validation.

For the AI training, Gated Recurrent Units (GRU) were used to construct an 8-layer RNN for classification.  The dataset was arranged to feed into an RNN sequence by sequence in the Z direction. The deep learning layers were constructed using the Deep Network Designer app in MATLAB and analyzed using the network analysis tool.  Figure 6 shows the full architecture of the network on the Deep Network Analyzer App and its analysis.  The first layer is the Sequence Input layer with an input size of 45 (3x3x5 channels), and the final classification layer is of size 6×1 corresponding to the scores it will predict for each label class.  Figure 7 shows the training progress of the network.  The training was performed on a single NVIDIA A100 Tensor Core GPU using the MATLAB AWS Reference architecture Amazon Machine Image (AMI).

Figure 6: RNN layers

Figure 6: RNN layers

Figure 7: Training progress for deep learning network

Figure 7: Training progress for deep learning network

3.    Validation

For validation, the trained algorithm was run on the test datasets 1 of size 1006 x 777x 248, which was set aside earlier and never used for training.  The model classification results are shown in Figure 8. The model was evaluated on two primary metrics:

  1. Fraction of pixels identified correctly (highest possible score – 1)
  2. F1-score (highest possible score – 1). This score is calculated from two numbers, precision and recall, where precision is the fraction of elements identified and recall is the fraction of all specific elements correctly identified.

There were some secondary metrics also computed for the performance which applied weighting among the facies:  Highest weights (20x) for the facies 5 and 6 because of their geological importance.  Facies 5 and 6 represent the slope valley and submarine canyon, respectively.  The canyon heads are usually the sites for demersal and pelagic fishing stocks, benthic habitats, also comprising the feeding grounds for Cetaceans [8].  When such submarine canyons are filled with sand-rich sediments, they serve as prolific geological reservoirs.  As seen in Figure 8, the overall performance of the algorithm for each of the different criteria was quite high.

Figure 8: Weighted F1 score calculated for test dataset 1

Figure 8: Weighted F1 score calculated for test dataset 1

Conclusion

In this part I of the blog post, we covered how you can easily prototype and develop high performance AI algorithms for seismic facies classification.   Building these automated seismic facies labeling algorithm will save geologists several months’ time from manually interpreting large seismic volumes [3]. Using various features in MATLAB like the Signal Multiresolution app and Deep Learning Network Designer app, it was possible to easily iterate through the various combinations of wavelet decompositions and deep learning architectures which allowed us to develop a novel signal-based methodology for automatic seismic facies labeling.  It is however worth mentioning that these multiple iterations for wavelet-based feature extraction and deep learning training in the large dataset was only possible due to the massive parallelization achieved using the high-performance compute resources in the AWS cloud. In part II of this blog we will discuss in detail the various ways in which NVIDIA GPUs from Amazon EC2 were leveraged directly from MATLAB and how this proved instrumental in the development of the algorithm.

The content and opinions in this blog are those of the third-party author and AWS is not responsible for the content or accuracy of this blog.

Akhilesh Mishra

Akhilesh Mishra

Akhilesh Mishra is the global medical devices industry manager at MathWorks. In his current role, Akhilesh closely works with customers developing digital health and medical devices, academic researchers, and regulatory authorities to help them see the value of modeling and simulation and how people can leverage latest trends such as AI to build the next generation medical devices. Prior to MathWorks he was the signal processing lead in a group working on radar systems for sounding the ice sheets of Greenland and Antarctica to study global sea-level rise.

References

[1] Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE transactions on pattern analysis and machine intelligence, 40(4):834–848, 2018b.

[2] Zengyan Wang, Fangyu Li, Thiab R. Taha and Hamid R. Arabnia. Improved Automating Seismic Facies Analysis Using Deep Dilated Attention Autoencoders. Conference: 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW)

[3] Geng, Z., Wang, Y. Automated design of a convolutional neural network with multi-scale filters for cost-efficient seismic data classification. Nat Commun 11, 3311 (2020). https://doi.org/10.1038/s41467-020-17123-6

[4] https://www.gpuhackathons.org/event/seam-ai-applied-geoscience-gpu-hackathon accessed on 22nd August 2021

[5] https://www.nzpam.govt.nz/ accessed on 22nd August 2021

[6] https://public.3.basecamp.com/p/JyT276MM7krjYrMoLqLQ6xST accessed on 22nd August 2021

[7] MathWorks Wins Geoscience Hackathon Blog : https://blogs.mathworks.com/deep-learning/2021/08/03/mathworks-wins-geoscience-ai-gpu-hackathon/

[8] Kumar, P.C., Alves, T.M. & Sain, K. Submarine canyon systems focusing sub-surface fluid in the Canterbury Basin, South Island, New Zealand. Sci Rep 11, 16990 (2021). https://doi.org/10.1038/s41598-021-96574-3