This repository contains the code used for training and evaluating the convolutional spiking neural networks (CSNNs) and baseline ANNs presented in our Interspeech 2025 paper.
This is a monorepo containing two installable Python packages:
sqp-snn: Training and evaluation of SNNs using storksqp-ann: Training and evaluation of baseline ANNs, adapted from our Interspeech 2024 SQP code
For adapting NeuroBench to stork, we adapted code from fmi-basel/neural-decoding-RSNN.
We used Python 3.10.12 for the development of the code. We recommend installing each of the two packages independently with the following steps:
-
Create and activate a new virtual environment (recommended)
python -m venv sqp-snn-env source sqp-snn-env/bin/activate -
In
spiking-sqp, navigate to package directorycd sqp-snn -
Install requirements
pip install -r requirements.txt
-
Install package:
pip install -e . -
Repeat the steps above independently for
sqp-ann
We used the Interspeech 2020 DNS Challenge dataset augmented by denoising with Dynamic NSNet2.
A link to our augmented dataset will be added here soon.
You can generate non-augmented training data by following these steps:
-
Audio data: Run the download and single-process data generation scripts from the Interspeech 2020 DNS Challenge. Change the following parameters in
noisyspeech_synthesizer.cfgto match our training data prior to augmentation:audio_length: 5total_hours: 50snr_lower: -15snr_upper: 25
-
Labels: Compute PESQ speech quality labels by inserting your dataset path in
compute_labels.pyand then running the scriptpython compute_labels.py
-
Repeat #2 for the test set
-
.env file: Create a
.envfile insqp-ann/by copying the provided examplecp sqp-ann/example.env sqp-ann/.env
-
Paths: Update
sqp-snn/src/sqp_snn/project_config.pyandsqp-ann/.envwith the correct paths for audio data and metrics files (labels) -
Reader IDs: Generate the
readers.pklfile used for reader-based validation split by running:python generate_readers_file.py
CLI note: sqp-snn uses argparse, while sqp-ann uses Hydra.
See examples below for the respective command-line argument formats.
Training time: Training a CSNN took up to 9 hours on an NVIDIA A4000 depending on the number of epochs to early stopping on convergence.
In sqp-snn/:
-
r-CSNN: Train recurrent CSNN
python train.py --model recurrent
-
ff-CSNN: Train feedforward CSNN
python train.py --model feedforward
-
Sparsity experiments: Train sequence of models with different degrees of spike-rate regularization yielding the results in Fig. 4 of the paper
bash sparsity_experiments_recurrent.sh
bash sparsity_experiments_feedforward.sh
-
Benchmarking: Measure EFLOPs and activation sparsity for a trained CSNN logged to W&B with NeuroBench by running the notebook
benchmark_snn.ipynb -
CLI: See
src/sqp_snn/args.pyfor all possible command-line arguments -
Logging: You can activate W&B logging by setting
--loggertowandband entering your W&B information insrc/sqp_snn/args.py
In sqp-ann/:
-
DNSMOS: Train a 2D CNN with the architecture of DNSMOS (this trains a CNN from scratch on PESQ-labeled data – it does not imply computing the metric called DNSMOS)
python train.py model=dnsmos
- Benchmarking:
Benchmark a trained DNSMOS model with NeuroBench by running the notebook
benchmark_dnsmos.ipynb
- Benchmarking:
Benchmark a trained DNSMOS model with NeuroBench by running the notebook
-
Quality-Net: Train a causal version of Quality-Net based on UniLSTM
python train.py model=qualitynet_realtime
- Benchmarking: LSTMs lack activation sparsity and were not supported by NeuroBench at the time of our experiments — instead, multiply–accumulate operations are counted with torchinfo by default when you launch training
-
CLI: See
sqp-ann/config/train.yamlfor possible command-line arguments -
Logging: Enable W&B logging by uncommenting
- logger_wandbinconfig/train.yaml