DOI: 10.5281/zenodo.17132508
title: Explainable Seismic Event Discrimination: Improved Explainability with Vision Transformers - Data and Code

description: Contents

This repository contains the datasets, trained models, and code from the study Explainable Seismic Event Discrimination: Improved Explainability with Vision Transformers (Kasburg et al., 2025), published in Journal of Geophysical Research: Machine Learning and Computation. It demonstrates the use of Vision Transformers (ViTs) for discrimination of seismic events, comparing their performance and interpretability to a Convolutional Neural Network (CNN) baseline.

Data

The Ruhr Area (RA) and Vogtland/West Bohemia (VLWB) datasets include processed spectrograms (X_*.npy) with labels (Y_*.npy) and metadata CSVs. Jupyter notebooks are provided for downloading raw data, creating spectrograms, and preparing training/test splits. The arrival times and additional metadata of the seismic events are given upon request. Spectrograms were preprocessed using short-time Fourier transforms, log-scaled, min–max normalized, and cubic-power transformed.

Data sources

The Ruhr Area (RA) dataset is based on seismic recordings from the following networks:



RuhrNet (RN) – Ruhr University Bochum (since 2007), 12 stations.DOI: https://www.fdsn.org/networks/detail/RN/

FloodRisk Network (YD) – Ruhr University Bochum (established 2020), 19 stations.DOI: https://www.fdsn.org/networks/detail/YD/

German Regional Seismic Network (GRSN/GR) – Federal Institute for Geosciences and Natural Resources (since 1976), 8 stations.DOI: https://www.seismologie.bgr.de/doi/grsn/


The Vogtland/West Bohemia (VL/WB) dataset is based on seismic recordings from the following networks:



Thuringian Seismic Network (TSN) – Institute of Geosciences, Friedrich Schiller University Jena (since 2009), 34 stations.DOI: https://www.fdsn.org/networks/detail/TH/

Saxon Seismic Network (SX) – University of Leipzig (since 2001), 10 stations.DOI: https://www.fdsn.org/networks/detail/SX/

German Regional Seismic Network (GRSN/GR) – Federal Institute for Geosciences and Natural Resources (since 1976), 6 stations.DOI: https://www.seismologie.bgr.de/doi/grsn/

West Bohemia Local Seismic Network (WB) – Institute of Geophysics, Academy of Sciences of the Czech Republic (since 1991), 1 station.DOI: https://www.fdsn.org/networks/detail/WB/


Training & Evaluation

This folder contains scripts and notebooks for training models, performing saliency-guided fine-tuning, evaluating performance, and generating explainable AI (XAI) analyses.

Model training:





kfolds.py, kfolds_mixed_qbs.py – train Vision Transformer and CNN models.




ft_worst_model.py – saliency-guided fine-tuning on worst-performing models.




Training implemented in TensorFlow 2.18.0 (Python environment specified in:  tf_vit.yaml) using fixed seeds; GPU hardware: NVIDIA Tesla P100/V100.



Model outputs:





Kmodel_output_RA, Kmodel_output_VLWB, Kmodel_output_mixed_RA, Kmodel_output_mixed_VLWB – saved outputs from trained models.



Explainable AI:





Saliency maps generated using attention_rollout.ipynb, legrad.ipynb, smoothgrad_cnn.ipynb, generate_attention_rollout_saliency_maps_for_fine_tuning.ipynb, generate_legrad_saliency_maps_for_fine_tuning.ipynb, generate_smoothgrad_saliency_maps_for_fine_tuning.ipynb




Occlusion sensitivity plot generated via occlusion_analysis.ipynb.




plot_xai.ipynb – visualization of XAI saliency maps from attention_rollout.ipynb, legrad.ipynb, smoothgrad_cnn.ipynb.



Model evaluation:





evaluate_models.ipynb, evaluate_models_mixed.py, evaluate_models_on_other_dataset.ipynb – evaluate models on individual or mixed datasets.




evaluate_saliency_guided_fine_tuning.ipynb – evaluate models after saliency-guided fine-tuning.




soft_voting.ipynb, sv_mixed.py – ensemble evaluation using soft voting on event level.



Utilities

The utils/ folder contains supporting scripts:





models.py – defines ViT and CNN architectures.




training_test_split.py – creates training and test datasets from processed spectrograms and contains other helper functions.




xai.py – functions for generating and processing saliency maps and other XAI analyses.