build_hdf5

behavenet.data.preprocess.build_hdf5(save_file, video_file, label_file=None, pose_algo=None, batch_size=128, xpix=None, ypix=None, label_likelihood_thresh=0.9, zscore=True)[source]

Build Behavenet-style HDF5 file from video file and optional label file.

This function provides a basic example for how to convert raw video and label files into the processed version required by Behavenet. In doing so no additional assumptions are made about a possible trial structure; equally-sized batches are created. For more complex data, users will need to adapt this function to suit their own needs.

Parameters:
  • save_file (str) – absolute file path of new HDF5 file; the directory does not need to be created beforehand

  • video_file (str) – absolute file path of the video (.mp4, .avi)

  • label_file (str, optional) – absolute file path of the labels; current formats include DLC/DGP csv or h5 files

  • pose_algo (str, optional) – ‘dlc’ | ‘dgp’

  • batch_size (int, optional) – uniform batch size of data

  • xpix (int, optional) – if not None, video frames will be reshaped before storing in the HDF5

  • ypix (int, optional) – if not None, video frames will be reshaped before storing in the HDF5

  • label_likelihood_thresh (float, optional) – likelihood threshold used to define masks; any labels/timepoints with a likelihood below this value will be set to NaN

  • zscore (bool, optional) – individually z-score each label before saving in the HDF5