lisbet.inference.embedding#
Embedding extraction for LISBET.
Functions
|
Compute LISBET embeddings for every record in a dataset. |
- lisbet.inference.embedding.compute_embeddings(model_path, weights_path, data_format, data_path, data_scale=None, data_filter=None, window_size=200, window_offset=0, fps_scaling=1.0, batch_size=128, output_path=None, select_coords=None, rename_coords=None)[source]#
Compute LISBET embeddings for every record in a dataset.
This function loads an embedding model and processes an entire dataset, computing embeddings 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.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, embeddings 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, embedding) tuples for each sequence.
- Return type:
list[tuple[str,ndarray]]- Raises:
ValueError – If the loaded model is not an embedding model.