behavenet.data¶
Data handing documentation.
behavenet.data.data_generator Module¶
Classes for splitting and serving data to models.
The data generator classes contained in this module inherit from the
torch.utils.data.Dataset
class. The user-facing class is the
ConcatSessionsGenerator
, which can manage one or more datasets. Each dataset is composed
of trials, which are split into training, validation, and testing trials using the
split_trials()
. The default data generator can handle the following data types:
images: individual frames of the behavioral video
masks: binary mask for each frame
labels: i.e. DLC labels
neural activity
AE latents
AE predictions: predictions of AE latents from neural activity
ARHMM states
ARHMM predictions: predictions of ARHMM states from neural activity
Please see the online documentation at Read the Docs for detailed examples of how to use the data generators.
Functions¶
|
Split trials into train/val/test blocks. |
Classes¶
|
Dataset class for a single session with batch loading of data. |
|
Dataset class for a single session. |
|
Dataset class for multiple sessions. |
|
Dataset class for multiple sessions, which returns multiple sessions per training batch. |
behavenet.data.preprocess Module¶
Utility functions for automatically constructing hdf5 files.
Functions¶
|
Build Behavenet-style HDF5 file from video file and optional label file. |
|
Load labels and build masks from a variety of standardized source files. |
|
Update label values to reflect scale of corresponding images. |
|
Helper function to load video segments. |
behavenet.data.transforms Module¶
Tranform classes to process data.
Data generator objects can apply these transforms to batches of data upon loading.
Classes¶
|
Shuffle blocks of contiguous discrete states within each trial. |
|
Clip upper level of signal and divide by clip value. |
|
Composes several transforms together. |
Turn a categorical vector into a one-hot vector. |
|
|
Turn an array of continuous values into an array of one-hot 2D arrays. |
Compute motion energy across batch dimension. |
|
|
“Index-based subsampling of neural activity. |
|
Remove channels of neural activity whose mean value is below a threshold. |
Abstract base class for transforms. |
|
|
z-score channel activity. |
behavenet.data.utils Module¶
Utility functions for constructing inputs to data generators.
Functions¶
|
Helper function for generating signals, transforms and paths. |
|
Helper function to build data generator from hparams dict. |
|
Ensure data rng seed and trial splits are same for two models. |
|
Helper function for generating session-specific transforms and paths. |
|
Load labels from hdf5 in the same dictionary format that latents are saved. |
|
Get brain regions and their indices into neural data. |