Python utilities for nature observations processing - images and bioacoustics.
Implementation includes MCP (model context protocol) server to easily connect all modules to a chatbot.
uv run python -m chirps.ml.onnx_bioacoustics demo/2034488.wavuv run python -m chirps.ml.onnx_bioacoustics --model models/perch_v2.onnx --labels models/perch_2_labels.csv --chunk_length=5 --predictions_key=label --label_format="{inat2024_fsd50k}" demo/2034488.wavuv run python -m chirps.ml.bioclip_inference demo/P7181094.jpeg uv run python -m chirps.ml.midi_markers_exporter [file_path]Example pipiline for normalizing audio and inference:
import logging
from chirps.audio.normalize import NormalizeAudio
from chirps.ml.onnx_bioacoustics import ONNXBioacousticsPredictor
def main():
file_path = 'demo/2034488.wav'
normalizer = NormalizeAudio()
normalizer.configure({"normalize_level": -3.0})
result = normalizer.process(path=file_path)
print(result)
onnx_bioacoustics = ONNXBioacousticsPredictor()
onnx_bioacoustics.configure({})
prediction = onnx_bioacoustics.process(path=result['output_path'])
print(prediction)Use kit to test the server.
Create configuration file:
cp sample.kit.yml .kit.ymlRun kit:
kitSample prompt:
classify demo/2034488.wav
It should return somthing like this along with reasoning.
The classification for demo/2034488.wav is Vulpes vulpes (Red Fox) with a confidence of approximately 0.42
Sample prompt for image identification:
identify animal in demo/P7181094.jpeg
