Skip to content

Commit

Permalink
fix some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirMardan committed Jul 20, 2023
1 parent 444bb69 commit 44dace8
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# First-Break Picking Using Deep Learning

This repository is used to implement first-break (FB) picking task using deep learning.
For this purpose, we used a U-net to segment the data as before and after first arrivals.
For this purpose, we use a U-net to segment the data as before and after first arrivals.

- [First-Break Picking Using Deep Learning](#first-break-picking-using-deep-learning)
- [1. Installation](#1-installation)
Expand All @@ -12,7 +12,7 @@ For this purpose, we used a U-net to segment the data as before and after first
- [2.3 Training for FB picking](#23-training-for-fb-picking)
- [2.4 Predicting the first break of one seismic shot](#24-predicting-the-first-break-of-one-seismic-shot)

In a seismic shot record, the first arrival is usually the direct wave from the source followed by refractions (Figure 1). The travel time of a seismic wave from a source to a geophone is called first break. First breaks are invaluable source of information in near surface studies. We can employ first breaks to obtain a velocity model of the near surface. In addition to the importance of first breaks for refraction inversion and understanding the characteristics of the near surface, they can be employed to perform a successful reflection seismic processing and multi-channel analysis of surface waves (MASW).
In a seismic shot record, the first arrival is usually the direct wave from the source followed by refractions (Figure 1). The travel time of a seismic wave from a source to a geophone is called first break. First breaks are invaluable sources of information in near-surface studies. We can employ first breaks to obtain a velocity model of the near-surface. In addition to the importance of first breaks for refraction inversion and understanding the characteristics of the near-surface, they can be employed to perform a successful reflection seismic processing and multi-channel analysis of surface waves (MASW).

![Alt text](./readme_files/waves.png)

Expand All @@ -23,7 +23,7 @@ pip install git+https://github.com/geo-stack/first_break_picking.git
```

## 2. First-Break Picking
We solve the first-break picking as a segmentation problem. It means, we have two segments,
We solve the first-break picking as a segmentation problem. It means that we have two segments,
1. before FB,
2. after FB.

Expand All @@ -33,7 +33,7 @@ In this way, FB can be picked as the interface between two segments.
In the next sections, we see how to prepare the dataset and the processing steps that can be done to improve the accuracy of the results.

### 2.1 Initial data files
To use this package, user needs to prepare the dataset apropriately.
To use this package, a user needs to prepare the dataset appropriately.
In one folder, we need to have the seismic data and corresponding FB (for training) in `.npy` and `.txt` format.
An example of the first-break file can be seen in the following figure.

Expand All @@ -46,15 +46,15 @@ After preparing the initial data files in `.npy` and `.txt` formats, we can perf
<a id="Figure2"></a>
![data_preprocessing](./readme_files/fb_data_preparing.png)

- We have a great data imbalance which leads to decrease of the accuracy. To deal with this problem, we crop the data (a) to generate data presented in (b). For this purpose, `save_shots_fb` gets an argument called `time_window` which gets a list with two integer value showing the beginning and the end of cropping window (in terms of sample and NOT time). Basically, the first element of this list should be `0`. For example, I use `time_window = [0, 512]`.
- In the next step, we scale the data to increase the accuracy and ease of the learning. This step leads to the image (c). To do so, user can use two arguments, `scale` and `grayscale`, which are boolean and should be set on `True`.
- For data augmentation, we divide each seismic shot to some subimages with an specific overlap (e and d). For this purpose, `save_shots_fb` get `split_nt` to specify number of columns in each subimage and `overlap` which defines the overlap of subimages in terms of percentage, between `0.0` to `1.0`. I usually use `overlap = 0.15`. For shots with 48 traces, I use `split_nt = 22`, but in case of shots with more traces, we can use larger value for `split_nt`.
- It is really important to provide `save_shots_fb` with correct value for the sampling rate as `dt`.
- We have a great data imbalance which leads to a decrease in accuracy. To deal with this problem, we crop the data (a) to generate data presented in (b). For this purpose, `save_shots_fb` gets an argument called `time_window` which gets a list with two integer values showing the beginning and the end of the cropping window (in terms of sample and NOT time). Basically, the first element of this list should be `0`. For example, I use `time_window = [0, 512]`.
- In the next step, we scale the data to increase the accuracy and ease of learning. This step leads to the image (c). To do so, user can use two arguments, `scale` and `grayscale`, which are boolean and should be set to `True`.
- For data augmentation, we divide each seismic shot into some subimages with a specific overlap (e and d). For this purpose, `save_shots_fb` gets `split_nt` to specify the number of columns in each subimage and `overlap` which defines the overlap of subimages in terms of percentage, between `0.0` to `1.0`. I usually use `overlap = 0.15`. For shots with 48 traces, I use `split_nt = 22`, but in the case of shots with more traces, we can use a larger value for `split_nt`.
- It is really important to provide `save_shots_fb` with the correct value for the sampling rate as `dt`.
- This function also gets two other arguments to specify the extension of shot and first-break files as `shot_ext` and `fb_ext`. This can be used to develop the code easily in case we want to load `.segy` or `.json` files.
- `save_shots_fb` saves the processed data at `dir_to_save`.


So, here it is how to call this function,
So, here is how to call this function,

```Python
from first_break_picking.data import save_shots_fb
Expand Down Expand Up @@ -82,22 +82,22 @@ Here is an example of saved data for a project.
![files](./readme_files/fb_preprocessed_data.png)

<div class="alert alert-block alert-warning">
<b>Warning:</b> Please be careful for choosing appropriate sampling rate.
<b>Warning:</b> Please be careful about choosing the appropriate sampling rate.
</div>

### 2.3 Training for FB picking
To train a network, we use the function `train`. This function gets some arguments which are presented here.
- `train_data_path`: Path of training dataset (can be a list of different datasets).
- `upsampled_size_row`: We upsample the data samples before sending them into the model. This variable is used to define the number of row in upsampled size (must be dividable by 16).
To train a network, we use the function `train`. This function gets some arguments that are presented here.
- `train_data_path`: Path of the training dataset (can be a list of different datasets).
- `upsampled_size_row`: We upsample the data samples before sending them into the model. This variable is used to define the number of rows in upsampled size (must be dividable by 16).
- `upsampled_size_col`: This variable is used to define the number of columns in upsampled size (must be dividable by 16).
- `batch_size`: Number of data samples that are taken into account togeher to caluclate the loss.
- `val_percentage`: Value between 0 to 1 to specify the percentage of data that is used to test the generalizability of the algorithm.
- `epochs`: Number of iteration.
- `batch_size`: Number of data samples that are taken into account together to calculate the loss.
- `val_percentage`: A value between 0 to 1 to specify the percentage of data that is used to test the generalizability of the algorithm.
- `epochs`: Number of iterations.
- `learning_rate`: This is used to define the learning rate.
- `path_to_save`: Path to a folder to save the checkpoints and loss values.
- `checkpoint_path`: In case user wants to start training a pretrained network, the path of the checkpoint should be specified here.
- `step_size_milestone`: Is used to define a learning rate scheduler. If you want to halve the learning rate at an specific number of epochs, this argument should be used.
- `show`: This is a boolean and can be used to specify if user likes to see the learning procedure. If set to `True`, a figure would be presented like the following example.
- `checkpoint_path`: In case a user wants to start training a pretrained network, the path of the checkpoint should be specified here.
- `step_size_milestone`: Is used to define a learning rate scheduler. If you want to halve the learning rate at a specific number of epochs, this argument should be used.
- `show`: This is a boolean and can be used to specify if the user likes to see the learning procedure. If set to `True`, a figure would be presented like the following example.
![files](./readme_files/fb_train.gif)

Here is an example of calling this function,
Expand Down Expand Up @@ -159,8 +159,8 @@ predictor = Predictor(
- `overlap`: Overlap of subimages of one shot.
- `upsampled_size_row`: Number of rows in upsampled image.
- `upsampled_size_col`: Number of columns in upsampled image.
- `dt`: Temporal samping rate.
- `smoothing_threshold`: An integer used to avoid the generated artifacts above the the true FB.
- `dt`: Temporal sampling rate.
- `smoothing_threshold`: An integer used to avoid the generated artifacts above the true FB.

By creating this object, we can now give the path of one seismic shot (as presented in [Figure 2a](#Figure2)) to the method `predict` and get the first break.

Expand All @@ -172,13 +172,13 @@ predictor.predict(
![data_preprocessing](./readme_files/fb_predict_one.png)

<div class="alert alert-block alert-warning">
<b>Warning:</b> If you define the sampling rate incorrrectly, you can't see its effects on the plot (Y-axis is time step), but the saved time in first-break folder will be wrong.
<b>Warning:</b> If you define the sampling rate incorrectly, you can't see its effects on the plot (Y-axis is time step), but the saved time in the first-break folder will be wrong.
</div>
<br>

<!-- ## Issues and Questions -->
**Ackowledgment:**<br>
This work, developped by [Amir Mardan](https://github.com/AmirMardan), was supported by Mitacs through the Mitacs Elevate Program.
**Acknowledgment:**<br>
This work, developed by [Amir Mardan](https://github.com/AmirMardan), was supported by Mitacs through the Mitacs Elevate Program.


[Top](#top)
Expand Down

0 comments on commit 44dace8

Please sign in to comment.