Awesome
CrowdQuake: A Networked System of Low-Cost Sensors for Earthquake Detection via Deep Learning
<!---This is a Python3 implementation of Convolutional Recurrent Neural Networks for the task of binary classification of seismic detection, as described in our paper.-->Overview
Here we provide the implementation of Artificial Neural Network (ANN) and Convolutional Recurrent Neural Network (CRNN) used in our paper in ACM KDD 2020.
<!---[![](https://img.shields.io/badge/Source-Download-yellow)](https://drive.google.com/drive/folders/1lgtYs1o59uzAUAv_W9FE4xAI2_wCuB5J?usp=sharing)-->The repository is organised as follows:
requirements.txt
: All required Python libraries to run the code.Code/Processing.py
: Source code for processing the earthquake data.Code/ANN.py
: Implementation of ANN.Code/CRNN.py
: Implementation of CRNN.Code/ANN_kfold.py
: K-fold cross validation for ANN.Code/CRNN_kfold.py
: K-fold cross validation for CRNN.Code/PerformanceMetrics.py
: Calculate the Performance Metrics.
Requirements
<!---numpy==1.16.1--> <!---pandas=0.24.1--> <!---obspy==1.1.1--> <!---scikit-learn==0.21.2--> <!---tensorflow-gpu==1.14--> <!---Keras==2.2.4--> <!---matplotlib==3.0.3-->$ pip install -r requirements.txt
In addition, CUDA 10.0 and cuDNN 7.4 have been used.
Dataset
The dataset contains two classes of three-component time-series acceleration waveforms:
- Earthquake: Download from National Research Institute for Earth Science and Disaster Resilience (NIED).
Note: In our paper, we use two earthquake datasets.
- 2299 K-NET records of Japan earthquakes from Jan. 1st 1996 to May 31th 2019, each of whose x-axis component peak ground acceleration (PGA) is greater than 0.1 gravity (g).
- 8973 K-NET records of Japan earthquakes from Jan. 1st 1996 to May 31th 2019, each of whose x-axis component PGA is greater than 0.05 g.
To download the earthquake data for reproducing our results, please:
- Visit NIED (registration is required to download data).
- Select
Download
--Data Download after Search for Data
.- Set
Network
--K-NET
.- Set
Peak acceleration
--from 100 to 10000
(i.e., > 0.1 g) orfrom 50 to 10000
(i.e., > 0.05 g).- Set
Recording start time
.- Click
Submit
, then select all records inData List
.- Click
Download All Channels Data
.- Notice that, due to the constraint of the website, only headmost 1200 data will be displayed in
Data List
. Please change the range ofRecording start time
, then repeat above procedures to download all data in batches.
- Non-Earthquake: Background noise of the low-cost sensors measured in several environments and various human activities recorded by our low-cost sensors.
You can also use your own dataset, but the dataset should contain three-component time-series acceleration signals.
Models
You can choose between the following models:
- ANN: A multi-layer perceptron with three input features (IQR,ZC,and CAV) and a hidden layer of 5 neurons. See more details in our paper or MyShake paper.
- CRNN: A combination of Convolutional Neural Network (CNN) and Recurrent Neural Network (RNN). See more details in our paper.
Running the code
- Download the data as described above.
- Run
Code/Processing.py
to process the raw data. - Run
Code/ANN.py
orCodes/CRNN.py
to train and test each model. - Run
Models/ANN_kfold.py
orModels/CRNN_kfold.py
for the k-fold cross validation for each model. - Run
Code/PerformanceMetrics.py
to calculate the performance metrics.
<!---## Cite--> <!---Please cite our paper if you use this code in your own work:-->Note:
- To reproduce our results, please download the same set of data as we used in the paper.
- For different test cases, please change the settings as described in each code file.