Easy transformation and scaling of DeepLabCut Data
Background
DeepLabCut is a widely used markerless pose estimation toolbox in behavioral science. The output of DeepLabCut is coordinates in pixels for each frame for each marker. However, in most cases the coordinates first need to be translated (i.e. adapted to the coordinate-space of the behavioral maze) and scaled (e.g. to cm) to enable meaningful behavioral quantification.
Functionality
The Transform_DLC repository takes care of a specific task: It takes DeepLabCut dataframes as the input and outputs transformed and scaled DeepLabCut dataframes. Requirements for this transformation and scaling are that the behavioral maze or a reference has to be rectangular and its corners have to be tracked with DeepLabCut.
Usage
For an example usecase check out the tutorial notebook!
-
Set hyperparameter in config file: Specify the name of the horizontal and vertical basis vector markers (in a rectangular maze these are two opposing corners) and the origin (the corner that connects the two basis vector corners). Additionally, set the DeepLabCut-likelihood threshold for those markers, and the scale factors (optional, if you don´t need scaling set them to 1). For quality control set show_angle to True.
-
Instantiate the DLCTransformer class with the filepath to your DeepLabCut tracked data and the config-filepath.
-
Use .run on your instantiated class object and save the output in a variable of your choice.
Contribution
This is a Defense Circuits Lab project written by Michael Schellenberger for DLCutils.