Earthquake Detective is an online collabarative platform to classify seismograms. This repository connects the platform with a Machine Learning backend for automatic classification and detection of earthquakes and tremors.
- Site: https://www.zooniverse.org/projects/vivitang/earthquake-detective
- Paper: https://arxiv.org/abs/2011.04740
- Download Miniconda for your OS
- Create a new conda environment as follows:
conda create -n quakedet python=3.7 pip
- Activate the new conda environment as follows:
conda activate quakedet
- Install requirements using the following command:
pip install -r requirements.txt
- Install Obspy
conda install obspy
- Install cartopy [optional, for plotting 3d plots]
conda install cartopy
- Install PyTorch by following the instructions here.
- For libmagic to correctly work, follow the instructions here.
- The classification information can be downloaded from here. Header format:
Subject_ID User_ID Time_Stamp Region_Code Station_Code Channel Label
- Processed data used in our experiments can be downloaded here.
- Reliabilty dictionary containing reliability scores for the user_ids can be downloaded from here.
- The src/generate_data.py function can be used to download the data with the help of Obspy
- To get data from specific users, use the filter_data function with the desired user_ids and optionally the required label. Example: Get data for only User 15:
filter_data(path=DATA_PATH / 'classification_data_all_users.txt', user_ids=['15'], name='u15')
- After filtering, run load_info_from_labels to get set up the data for downloading. Example:
event_info, user_info = load_info_from_labels(path=DATA_PATH /
'classification_data_u15.txt')
- Finally, call the download data function as follows:
for event_id, stations in event_info.items():
data_utils.download_data(event_id=event_id, event_et=3600, stations=stations, min_magnitude=7, folder_name='User100', save_raw=False)
- Refer to exp0.py for steps to create dataset object from the downloaded data
- Prepare your data based on the aforementioned steps our download our processed data from here and run experiments as follows:
cd src/experiments
python experiment{EXP_ID}.py
- To download data and to get processed seismograms, audio and plots run data_utils.download_data with desired settings
- To upload data to Zooniverse, run server_utils.py with desired settings
- data_utils.py - Contains functions to download and process the data.
- generate_data.py - Use this file to download data over arbitary time windows
- utils.py - Contains generic utility functions which are used throughout the project
- server_utils.py - Contains functions to upload data to Zooniverse
- zooniverse_utils.py - Contains functions to process and analyze the data downloaded from Zooniverse
- constants.py - Contains constants used throughout the project
- visualizer.py - Contains functions to visualize seismic data
- dataset.py - Contains Pytorch dataset class to load and pre-process data so that it can be used by Pytorch dataloader
- models.py - Contains code for different ML models used
- trainer.py - A generic code to train/test different models defined in models.py
- wavelet.py - Contains function to perform wavelet scattering transform
- custom_loss.py - Custom loss functions to account for reliability scores
- r_utils.py - Contains functions to calculate reliability scores
- sample_analysis.py - Contains functions to select and analyze samples based on different selection criteria's
Contains various experiments performed. View experiment files for more details.