Training🔗

callcut.training provides PyTorch Lightning infrastructure for training call detection models. It includes Lightning modules, data modules, loss functions, and callbacks.

Lightning Modules🔗

The CallDetectorModule wraps any BaseDetector model for training with PyTorch Lightning. It handles the training loop, validation metrics, and optimizer configuration.

The CallDataModule handles data loading, train/val/test splitting (balanced by window count), and DataLoader creation.

CallDetectorModule(model, loss[, lr])

Lightning Module wrapping a call detector for training.

CallDataModule(recordings, extractor, *[, ...])

Lightning DataModule for call detection.

Loss Functions🔗

Loss functions for training call detection models. All loss functions inherit from BaseLoss and expect logits (raw model output before sigmoid) and binary target labels.

BaseLoss()

Abstract base class for training loss functions.

BCEWithLogitsLoss([pos_weight])

Binary cross-entropy loss with logits.

FocalLoss([alpha, gamma])

Focal loss for handling class imbalance.

DiceLoss([smooth])

Dice loss for optimizing overlap directly.

TverskyLoss([alpha, beta, smooth])

Tversky loss with adjustable false positive/negative penalties.

Callbacks🔗

Custom Lightning callbacks for training.

LoggingCallback()

Callback that logs training progress using the callcut logger.

MetricsHistoryCallback()

Callback that records training metrics history.

SaveBestModelCallback(save_path[, monitor, mode])

Callback that saves the best model weights during training.