Skip to main content

Scripts Reference

All executable scripts live in scripts/ and are run from the repository root.

train.py -- STDP Training

Layer-wise STDP training with WTA competition and adaptive thresholds.

python scripts/train.py --config configs/config.yaml [OPTIONS]
FlagDefaultDescription
--config, -c--YAML config file
--paper--Paper preset (igarss2023, kheradpisheh2018)
--output, -o./runsOutput directory
--name, -nauto-generatedExperiment name
--resume, -r--Resume from checkpoint
--epochs50Maximum epochs per layer
--n-classes1Number of output classes
--devicecudacuda, cpu, cuda:0
--seed42Random seed
--log-levelINFOLogging verbosity
--no-tensorboardfalseDisable TensorBoard

Outputs: checkpoints (checkpoint_best.pt, checkpoint_latest.pt, per-epoch), metrics_final.json, TensorBoard logs.


train_cv.py -- Cross-Validation

k-fold cross-validation with held-out test set.

python scripts/train_cv.py --config configs/config.yaml --n-folds 10 [OPTIONS]
FlagDefaultDescription
--config, -cconfigs/config.yamlConfig file
--data-root, -dfrom configEBSSA data root
--n-folds, -k10Number of folds
--test-ratio0.1Held-out test fraction
--seed42Split seed
--output-dir, -oruns/cvOutput directory
--threshold0.05Inference threshold
--eval-onlyfalseSkip training, evaluate existing folds

Outputs: fold_info.json, test_recordings.txt, per-fold directories, cv_results.json.


evaluate.py -- Model Evaluation

Pixel-level, object-level, or volume-based evaluation.

python scripts/evaluate.py --checkpoint best.pt --data-root /path/to/EBSSA [OPTIONS]
FlagDefaultDescription
--checkpoint, -crequiredCheckpoint path
--data-root, -d--EBSSA root
--splitvaltrain, val, test, all
--sensorallATIS, DAVIS, all
--volume-basedfalseIGARSS 2023 methodology
--object-levelfalseCentroid matching
--spatial-tolerance1TP tolerance in pixels
--no-hulkfalseDisable HULK
--no-smashfalseDisable SMASH
--output, -o--Save metrics JSON
--debugfalseDebug logging

inference.py -- Detection and Segmentation

python scripts/inference.py --checkpoint best.pt --input recording.mat [OPTIONS]
FlagDefaultDescription
--checkpoint, -crequiredCheckpoint path
--input, -i--Single .mat file
--data-root, -d--Batch mode: EBSSA root
--output, -odetections.jsonOutput JSON
--threshold0.05Inference threshold
--visualizefalseSave 2D images
--visualize-3dfalse3D trajectory plots
--deviceautocuda or cpu

Outputs: detections.json, optional detection_*.png and figure4_sample_*.png.


threshold_sweep.py -- Threshold Optimization

Sweeps inference thresholds to find optimal informedness.

python scripts/threshold_sweep.py --checkpoint best.pt --data-root /path/to/EBSSA

Tests thresholds: [0.1, 0.2, 0.3, 0.5, 0.7, 1.0, 1.5, 2.0, 3.0, 5.0]. Prints a table with sensitivity, specificity, and informedness for each, plus the best threshold.


diagnose.py -- Diagnostic Visualization

python scripts/diagnose.py --checkpoint best.pt --data-root /path/to/EBSSA --n-samples 5
FlagDefaultDescription
--checkpointhard-coded pathCheckpoint
--data-roothard-coded pathEBSSA root
--n-samples5Number of samples

Output: diagnostic_output.png -- 5-column grid per sample (input events, GT, raw spikes, overlay, classification result).


demo.py -- Quick Demonstration

python scripts/demo.py

Placeholder script for running a quick forward-pass demonstration. Currently empty; implement to showcase the full pipeline on a sample recording.