Published September 16, 2025 | Version 1.0
Dataset Open

Explainable Seismic Event Discrimination: Improved Explainability with Vision Transformers - Data and Code

  • 1. ROR icon Friedrich Schiller University Jena
  • 2. ROR icon Alfred-Wegener-Institut Helmholtz-Zentrum für Polar- und Meeresforschung

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:

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

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.

Files

Explainable Seismic Event Discrimination.zip

Files (8.0 GB)

Name Size Download all
md5:6757416f64d5650ba70af054baf8bded
8.0 GB Preview Download

Additional details

Software

Programming language
Python