Using ConvNetQuake to train model based on wenchuan aftershocks and automatically detect earthquakes in continuous waveform
We use ConvNetQuake to train our own model for events classification based on the wenchuan aftershocks and use it to classify earthquakes from one day continous waveform(2008-07-25) of one station (MXI).In this day there are about 43 "obvious" earthquakes and more than 170 "trival" earthquakes (see the image below).We use ConvNetQuake and STA/LTA to identify them automatically,both two methods can detect all the "obvious" earthquakes,but CNN win STA/lTA in detecting "trival" earthquakes,besides,CNN has less false recognition than STA/LTA.
For ConvNetQuake refer to: Perol., T, M. Gharbi and M. Denolle. Convolutional Neural Network for Earthquake detection and location. preprint arXiv:1702.02073, 2017.
赵明,陈石,Dave.A.Yuen,2019,基于深度学习卷积神经网络的地震波形自动分类与识别,地球物理学报,62(1),待刊
Zhao M,Chen S,Dave Yuen. 2019. Waveform classification and seismic recognition by convolution neural network. Chinese J. Geophys. (in Chinese),62(1),in press.
A video tutorial can be found at:
How to detect earthquake automatically using CNN
The continious wavaform of MXI,2008-07-25
All CNN identified slices with prob>0.1,abosolute ampitude
We also use classic STA/LTA Algorithm for a comparison:
All CNN identified slices with prob>0.1,normalized ampitude
- Download repository
- Download anaconda or miniconda,then create a new environment:
- conda create -n python2 python=2
- conda activate python2
- conda install tensorflow=1.4
- Install dependencies:
pip install -r requirements.txt.b
- Add directory to python path:
./setpath.sh
Download the data (roughly 110 Mb) and symlink to data ln -s data Downloads/data The continuous waveform data is in ./data
The data
directory contains:
XX.MXI.2008207000000.mseed
: the continious waveform datadayplot.py
: a script to plot the continious waveformmerge_dayplot.py
: a merge scriptXX.MXI_dayplot_[0-64800].png
: marked earthquakes of the dayXX.MXI_dayplot_hand_picks.png
:hand picked events
We provide a catalog ("MXI_catalog_for_train.txt") for train dataset,you can send a request to CENC or dmc and download the related waveform data. We also provided a train dataset with about 2000 events samples,please download from mz
For events:
./bin/preprocess/create_dataset_events.py --stream_dir stream/ --catalog MXI_catalog_for_dataset.csv --output_dir wenchuan_train_test/positive --save_mseed True --plot True
For noises:
./bin/preprocess/create_dataset_noise.py --stream stream/XX.MXI.mseed --catalog MXI_catalog_for_noise.csv --output_dir wenchuan_train_test/negative --max_windows=30000
However,the stream data is quite large(1.6GB),and my baidu disk is full,so it is provided upon request.We strongly recommend you use your own data stream and catalog (just follow the format like MXI_catalog_for_dataset.csv) to build datasets.
tar xzvf train_30s_MXI.tar ./bin/train --dataset train_30s_MXI --checkpoint_dir output/convnetquake --n_clusters 2
tensorboard --logdir output/convnetquake/ConvNetQuake
We also privided a model which was trained on over 20000 earthquakes slices (30s) and over 60000 slices of noises (30s)
The directory trained_model
contains:
convnetquake
: trained model
./bin/predict_from_stream.py --stream_path data --checkpoint_dir trained_model/ConvNetQuake --n_clusters 2 --window_size 30 --window_step 31 --output predict_MXI_one_day --plot --save_sac
It will generate a dir "predict_MXI_one_day",which contains:
viz
: the image of events,the name of the image contain its probility(prob) and its starttime,like "MXI_0.50053_2008-07-25T03_07_18.000000Z.png"viz_not
: the image of noise,notice the higher prob,the more likely it is an events,actually when the prob>0.1 there is a large chance it is an event.sac
: the slice data of viz
It proved using overlapping windows will get better results,however,the events will be identified more than once,you can choose the one with highest probility.To run,just uncomment "
#lists = np.arange(0,30,5)
" in predict_from_stream.py
./trigger_by_sta_lta.py --stream_path data --output out_STA_LTA_MXI --save_mseed --window_step 20
We provide a hand-picked catalog(MXI_20080725_hand_pick_PS.txt
) for users to compare with their own results.A qulified trained model should be able to find out all the earthquakes in this catalog.