DLC2Kinematics
DLC2Kinematics copied to clipboard
Issues with Compute Velocity
Hi @MMathisLab and team!
There is a strong chance I'm missing a step somewhere, but I can't figure out what I'm doing wrong. I'm trying to do the basic compute velocity etc, using the demo jupyter notebook as a guide. However, even though I don't get any error messages or similar, nothing seems to happen when I try to compute velocity - it just gives me an output of the body part x and y, and the likliehood. I've tried both with my own data and with the example demo data and run into the same issues.
Example code using the 2D demo data (since the data I'm trying to analyze is also 2D data)
DLC_2D_file1 = 'C:/Users/alb722/Desktop/DEMO/reachingDEMO_2D.h5' config = 'C:/Users/alb722/Desktop/DEMO/config.yaml' df, bodyparts, scorer = dlc2kinematics.load_data(DLC_2D_file1)
def_vel = dlc2kinematics.compute_velocity(df, bodyparts = ['Right_backofhand'], filter_window=3, order=1) def_vel.head(3) scorer DeepCut_resnet50_MackenzieJan21shuffle1_1030000 bodyparts Right_backofhand coords x y likelihood 42150 -0.036558 -0.071750 1.0 42151 -0.036558 -0.071750 1.0 42152 0.090482 -0.069784 1.0
% matplotlib inline import matplotlib.pyplot as plt dlc2kinematics.plot_velocity(df[scorer]['Right_backofhand'], df_vel)
NameError Traceback (most recent call last) Input In [10], in <cell line: 1>() ----> 1 dlc2kinematics.plot_velocity(df[scorer]['Right_backofhand'], df_vel)
NameError: name 'df_vel' is not defined
I'm assuming that the plotting doesn't work, because for some reason velocity didn't actually get calculated. Any suggestions? Did I miss a step somewhere?
Thanks in advance!
Welcome! Thank you for your contribution!
Name missmatch. Variable named def_vel
but df_vel
called.
@KonradDanielewski good catch, thanks! However, the data def_vel data frame when called doesn't display any velocity data. Is that normal? How can I access the raw velocity values, if I want to export them to somewhere else, for example. The tutorial didn't include example of what gets called when you do "def_vel.head(3)", so I have nothing to compare to.
What you printed there in the initial post is the velocity for x and y (per frame). It's calculated as a 1 order derivative from savitzky-golay filter (smoothened data)
ahh gotcha, I didn't realize that. Thanks!