BatSpot ONNX
Bat Sound Classifier
2 min readupdated
The BatSpot model (based on ResNet18) is designed to automatically recognize bat echolocation signals from ultrasonic audio recordings at a 250 kHz sampling rate. This version is an exact ONNX conversion of the original PyTorch checkpoint without retraining, allowing it to run without PyTorch. The model covers 12 European bat species or species complexes, and also recognizes social calls and search postures. It is useful for wildlife researchers and developers of acoustic monitoring systems using ONNX Runtime.
Key features
- Recognition of 12 European bat species and species complexes from ultrasound.
- Separate classes for social calls and feeding buzzes.
- Full compatibility with ONNX Runtime to run in Python, Go, or C++.
- The provided NumPy preprocessing implementation fully mirrors the original pipeline.
What you can do
- Integrate the model into wildlife acoustic monitoring applications (for example, BirdNET-Go).
- Analyze field audio recordings of bat ultrasonic activity in WAV format.
- Create custom audio processing pipelines on ONNX Runtime without heavy PyTorch dependencies.
Example
import numpy as np, soundfile as sf, resampy, onnxruntime as ort
from reference_frontend import frontend
y, sr = sf.read("bat_recording.wav", dtype="float32", always_2d=True)
y = resampy.resample(y.mean(axis=1), sr, 250000, filter="kaiser_best")
wins = [y[i:i + 5000] for i in range(0, len(y) - 5000 + 1, 1250)]
x = np.concatenate([frontend(w) for w in wins])
sess = ort.InferenceSession("batspot_m09.onnx", providers=["CPUExecutionProvider"])
logits = sess.run(["logits"], {"spectrogram": x})[0]
Read more
DetailsBenchmarks: the maximum absolute logit difference between PyTorch and ONNX is 2.1e-5.
Requirements: mono audio strictly at 250 kHz (WAV or FLAC formats).
Limitations: geographic coverage is limited to 12 European species; silence and background noise filtering required beforehand.










Comments