GithubHelp home page GithubHelp logo

cnn-for-asi's Introduction

CNN for ASI

Code for the paper:
Convolutional Neural Networks for Automated Seismic Interpretation,
A. U. Waldeland, A. C. Jensen, L. Gelius and A. H. S. Solberg
The Leading Edge, July 2018

EAGE E-lecture: Seismic interpretation with deep learning (YouTube)

This repository contains python/pytorch code for applying Convolutional Neural Networks (CNN) on seismic data. The input is a segy-file containing post-stack seismic amplitude data. The training labels are given as images of the training slices, colored to indicate the classes.

Setup to get started

CNNs requires time-demanding computations, consider using a computer with a fast NVIDIA GPU with at least 6GB ram.

  • Install the required python packages (REQUIREMENTS.txt)
  • Clone this repository
  • Download the demo data set here. This is the F3 Netherlands dataset - originally made available by OpenDTect - and available via the MalenoV Project.
  • Locate the '.segy'-file, rename it to 'data.segy' and put it in the 'F3'-folder.

How to use tensorboard (for visualization)

  • Open a terminal
  • cd to the code-folder
  • run: tensorboard --logdir='log'
  • Open a web-browser and go to localhost:6006
    More information can be found here.

Usage

  • train.py - train the CNN
  • test.py - Example of how the trained CNN can be applied to predict salt in a slice or the full cube. In addition it shows how learned attributes can be extracted.

Files

In addition, it may be useful to have a look on these files

  • texture_net.py - this is where the network is defined
  • batch.py - provide functionality to generate training batches with random augmentation
  • data.py - load/save data sets with segy-format and labeled slices as images
  • tb_logger.py - connects to the tensorboard functionality
  • utils.py - some help functions
  • test_parallel.py - An implemenation of test.py supporting multi-gpu prediction (thanks to Max Kaznady).

Using a different data set and custom training labels

If you want to use a different data set, do the following:

  • Make a new folder where you place the segy-file
  • Make a folder for the training labels
  • Save images of the slices you want to train on as 'SLICETYPE_SLICENO.png' (or jpg), where SLICETYPE is either 'inline', 'crossline', or 'timeslice' and SLICENO is the slice number.
  • Draw the classes on top of the seismic data, using a simple image editing program with the class colors. Currently up to six classes are supported, indicated by the colors: red, blue, green, cyan, magenta and yellow.

Contact

Email: [email protected]

cnn-for-asi's People

Contributors

jesperdramsch avatar markspec avatar maxkazmsft avatar stevejpurves avatar waldeland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cnn-for-asi's Issues

Visualize data

Hello,

While trying to visualize the Test logs i ran : tensorboard --logdir=log/* (i mean for every possible subfolder) since the tensorboard --outditr=log didn't work.

But even though there are logs in the log/train and the log/test folder tensorboard does not seem to be able to see them! ( i use tensorboard 1.5.1)
Any thoughts?

Thanks in advance

--Dimitris

License and article

Thank you for sharing your code!

I saw that this is missing a license, if you could please add one, otherwise it is difficult to contribute and build on top of.

Second question: When will the article be released?

Thanks!

IndexError for iline

Hello Mr Waldeland
Your code is so amazing I want to say

I using CoLab to run the code however I got this error when I try to test my model :

> ####################################################################
> 
> Loading data cube from /content/gdrive/My Drive/cnn_for_ASI/F3/data.segy with:
>   Crosslines:  300 : 1249
>   Inlines:     276 : 476
>   Timeslices:  1 : 462
>  |----------------------------------------------------------------------------------------------------| 0.0%  - h min s left
>  |====================================================================================================| 100.0%  - 0h 0min 5s 
> Interpolating down sampled results to fit input cube
> Finished interpolating
> Writing interpretation to /content/gdrive/My Drive/cnn_for_ASI/F3/salt.segy
> ---------------------------------------------------------------------------
> IndexError                                Traceback (most recent call last)
> <ipython-input-12-d73513020e49> in <module>()
>      65 in_file = join(dataset_name, 'data.segy')
>      66 out_file = join(dataset_name, 'salt.segy')
> ---> 67 writeSEGY(out_file, in_file, classified_cube)
> 
> /content/data.py in writeSEGY(out_filename, in_filename, out_cube)
>      58         # loop through inlines and insert output
>      59         for i in src.ilines:
> ---> 60             iline = out_cube[i-iline_start,:,:]
>      61             src.iline[i] = np.ascontiguousarray(iline.astype(dtype))
>      62 
> 
> IndexError: invalid index to scalar variable.
> 
> ####################################################################

the code was running fine in my local PC but I don't have good GPU so I moved to CoLab, any suggestions to fix that error ???

thank you
Ahmad Bahaa

Visualization

Dear Mr. Waldeland,

I would like to express extreme gratitude for your services in this field.

Can you please tell how to visualize a particular cross line or inline as you have done in your paper?

Your help in this matter would be highly appreciated.

Regards,
Mohammad Farzanullah

error in runing test.py

hello, Sir, sorry to bother you! As follows, I meet a error when runing test.py.
Interpolating down sampled results to fit input cube Traceback (most recent call last): File "test.py", line 64, in <module> classified_cube = interpret( network.classify, data, data_info, 'full', None, im_size, 16, use_gpu=use_gpu) File "/home/leeyang/data/cnn_asi/utils.py", line 123, in interpret class_cube[i] = interpn(pred_points, class_cube[i].astype('float').squeeze(), grid_output_cube, method='linear', fill_value=0, bounds_error=False) File "/home/leeyang/anaconda3/lib/python3.6/site-packages/scipy/interpolate/interpolate.py", line 2648, in interpn return interp(xi) File "/home/leeyang/anaconda3/lib/python3.6/site-packages/scipy/interpolate/interpolate.py", line 2481, in __call__ indices, norm_distances, out_of_bounds = self._find_indices(xi.T) File "/home/leeyang/anaconda3/lib/python3.6/site-packages/scipy/interpolate/interpolate.py", line 2529, in _find_indices norm_distances.append((x - grid[i]) / MemoryError
Have you meet such a problem?

Input Training data

Dear Anders,
Could you please explain: what is training data here?
I am a bit confused: here I see that you put one labelled png slice extracted from seismic cube and it corresponds to inline in seismic. So technically we could extract all inlines and predict salt/not salt on them. At the same time, while talk on augmentation on EAGE E-lecture you told that there are geometric transforms that are done on 65 * 65 * 65 seismic cube to increase training data. Finally, what is training data full slice labelled or small cube?
Thank you.


Sincerely,
Kirill

Doubt regarding usage

Hello Dr Waldeland,

I have been trying to work through your code on Penobscot interpretation dataset for facies classification. I had a few questions:

  1. I need to work with multi-label classification. So, I need to store a single image in train folder with all the classes drawn in that image or I need to store separate image files.
    Thank you in advance ๐Ÿ™‚

Extract cross/inlines from SEG-Y as images

Dear Mr. Anders Waldeland,

Thank you for sharing your work! I am new to using ML and DL for Seismic Interpretation. I want to try your workflow out.
Could you please explain how you managed to extract cross/inlines in form of grayscale images from SEG-Y file?
I donwloaded Penobscot dataset with all cross/inlines and masks, and want to manage my SEG-Y file in the same manner.
I have my dataset from Petrel; there is no such option. I searched the web and have not found solution.
Thank you.


Sincerely,
Kirill

Exception during training with 3 classes

We tried to use the code to train a network to identify 3 classes.

To do this using our own image data we modified the class_color_coding dict in data.py to be

# Add colors to this table to make it possible to have more classes
class_color_coding =[
    [0,0,232], #non-gully
    [250,170,30], #gullies
    [207,207,207], #undefined
] 

after doing this the network would not train successfully and an exception occurs. On debugging it appears that the code tries to locate non existent labels with a class_ind > 2

axes donot match array

Dear ..

Can you comment.. why this error is . with any data
axes don't match the array. ?

Logger cannot deal with np.array

Line 98 in train.py needs to be changed from

logger.log_scalar('training_loss', var_to_np(loss),i)

to
logger.log_scalar('training_loss', var_to_np(loss).tolist(),i)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.