Inference-first repo. Supported workflow: load the pretrained checkpoint and segment a directory of spectrogram images.
Create or update the permanent squeakout micromamba environment:
micromamba env create -f environment.yml
micromamba env update -n squeakout -f environment.yml
micromamba run -n squeakout python -m ipykernel install --user --name squeakout --display-name "Python (squeakout)"Notebook entrypoint: segmentation.ipynb
CLI entrypoint:
micromamba run -n squeakout python -m squeakout ./dataset/testLegacy compatibility shims:
from squeakout import SqueakOut_autoencoderfrom utils import create_montage
These are supported for old notebooks and scripts. Prefer the package API for new code.
Python API:
from pathlib import Path
from squeakout import load_model, resolve_device, segment_directory
device = resolve_device()
model = load_model(Path("./squeakout_weights.ckpt"), device=device)
results = segment_directory(
Path("./dataset/test"),
mask_root=Path("./outputs/segmentation"),
montage_root=Path("./outputs/montages"),
model=model,
device=device,
)
print(f"saved {len(results)} masks")Tests:
micromamba run -n squeakout pytestBibTex citation
@article{Santana2024SqueakOut,
title={SqueakOut: Autoencoder-based segmentation of mouse ultrasonic vocalizations},
author={Gustavo M. Santana and Marcelo O. Dietrich},
journal={bioRxiv},
year={2024},
doi={https://doi.org/10.1101/2024.04.19.590368},
url={https://www.biorxiv.org/content/10.1101/2024.04.19.590368v1}
}