lisbet.inference.annotation#
Behavior annotation (classification and multi-label) for LISBET.
Functions
|
Run LISBET behavior classification for every record in a dataset. |
- lisbet.inference.annotation.annotate_behavior(model_path, weights_path, data_format, data_path, data_scale=None, data_filter=None, mode='multiclass', threshold=0.5, window_size=200, window_offset=0, fps_scaling=1.0, batch_size=128, output_path=None, select_coords=None, rename_coords=None)[source]#
Run LISBET behavior classification for every record in a dataset.
This function loads a classification model and processes an entire dataset, producing behavior annotations for each sequence.
- Parameters:
model_path (
str) – Path to the model config (JSON format).weights_path (
str) – Path to the HDF5 file containing the model weights.data_format (
str) – Format of the dataset to analyze.data_path (
str) – Path to the directory containing the dataset files.data_scale (
str|None) – Scaling string or None for auto-scaling.data_filter (
str|None) – Filter to apply when loading records.mode (
str) – Classification mode, either ‘multiclass’ or ‘multilabel’.threshold (
float) – Probability threshold for multilabel classification.window_size (
int) – Size of the sliding window to apply on the input sequences.window_offset (
int) – Sliding window offset.fps_scaling (
float) – FPS scaling factor.batch_size (
int) – Batch size for inference.output_path (
str|None) – If given, predictions will be saved as CSV files in this directory.select_coords (
str|None) – Optional subset string in the format ‘INDIVIDUALS;AXES;KEYPOINTS’, where each field is a comma-separated list or ‘*’ for all. If None, all data is loaded.rename_coords (
str|None) – Optional coordinate names remapping in the format ‘INDIVIDUALS;AXES;KEYPOINTS’, where each field is a comma-separated list of maps ‘old_id:new_id’ or ‘*’ for no remapping at that level. If None, original dataset names are used.
- Returns:
A list of (sequence ID, predicted behavior) tuples for each sequence.
- Return type:
list[tuple[str,ndarray]]- Raises:
ValueError – If the loaded model is not a classification model.