neuralib.tracking.deeplabcut.core

neuralib.tracking.deeplabcut.core.Joint

alias of str

typeddict neuralib.tracking.deeplabcut.core.DeepLabCutMeta[source]

typing.TypedDict.

Required Keys:
  • start (float)

  • stop (float)

  • run_duration (float)

  • Scorer (str)

  • model_config (DeepLabCutModelConfig)

  • fps (float)

  • batch_size (int)

  • frame_dimensions (tuple[int, int])

  • nframes (int)

  • iteration (int)

  • training_set_fraction (float)

  • cropping (bool)

  • cropping_parameters (list[tuple[float, float, float, float]])

typeddict neuralib.tracking.deeplabcut.core.DeepLabCutModelConfig[source]

typing.TypedDict.

Required Keys:
  • stride (float)

  • weigh_part_predictions (bool)

  • weigh_negatives (bool)

  • fg_fraction (float)

  • mean_pixel (list[float])

  • shuffle (bool)

  • snapshot_prefix (str)

  • log_dir (str)

  • global_scale (float)

  • location_refinement (bool)

  • locref_stdev (float)

  • locref_loss_weight (float)

  • locref_huber_loss (bool)

  • optimizer (str)

  • intermediate_supervision (bool)

  • intermediate_supervision_layer (int)

  • regularize (bool)

  • weight_decay (float)

  • crop_pad (int)

  • scoremap_dir (str)

  • batch_size (int)

  • dataset_type (str)

  • deterministic (bool)

  • mirror (bool)

  • pairwise_huber_loss (bool)

  • weigh_only_present_joints (bool)

  • partaffinityfield_predict (bool)

  • pairwise_predict (bool)

  • all_joints (list[list[int]])

  • all_joints_names (list[str])

  • dataset (str)

  • init_weights (str)

  • net_type (str)

  • num_joints (int)

  • num_outputs (int)

class neuralib.tracking.deeplabcut.core.DeepLabCutResult[source]
__init__(dat, meta, filtered, time=None)[source]
Parameters:
  • dat (DataFrame) – Deeplabcut results as polars dataframe

  • meta (DeepLabCutMeta) – Deeplabcut meta typeddict

  • filtered (bool) – If the Deeplabcut results is filtered or not

  • time (ndarray | None) – 1D time array for each tracked frames. If None, then assume stable DAQ and calculated from meta.

property is_filtered: bool
property meta: DeepLabCutMeta
property joints: list[str]

list of labelled joints

property fps: float
property nframes: int
property time: ndarray
with_global_lh_filter(lh)[source]

With global likelihood filter :param lh: likelihood threshold :return: DeepLabCutResult

Parameters:

lh (float)

Return type:

Self

neuralib.tracking.deeplabcut.core.load_dlc_result(file, meta_file, time=None)[source]

Load DeepLabCut result from file

Parameters:
  • file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – DeepLabCut result filepath. supports both .h5 and .csv

  • meta_file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – DeepLabCut meta filepath. should be the .pickle. TODO Cannot it be inferred according to file?

  • time (ndarray | None) – time array for each sample point. If None, then assume stable DAQ for using total frames and fps info in meta

Returns:

DeepLabCutResult

Return type:

DeepLabCutResult