Open basicvisual opened 3 years ago
Hi there
Thank you for your interest in this package. here are the answers:
Best, Lukas
Also, if you are interested in using the machine learning part of it you might have to define new functions (i.e. such as our CreateSkeletonData_OFT() ) for your personal skeleton description so they contain distances/angles/areas/accelerations that are defined with your points and the corresponding names. best is to copy paste an already existing function and redefine all these features so they fit your personal skeleton.
Thank you , could you briefly explain the conversion from pixel/s
to physical unit m/s
? How did you do it and what is the conversion factor and is it the same for any video format ?
Just out of curiosity , was there a reason for implementing the analysis on R instead of python ?
The conversion is a simple linear conversion and only works if: a) the tracked subject is equidistant to the camera all the time (i.e. as in a top recording where it is moving in a non-tilted plane) and b) the distance of at least a tracked point pair in this setup is static and known in metric units (i.e. an edge of the arena which does not change and we can measure the length in whatever unit we want to transform to). The process is described in the documentation. by using the CalibrateTrackingData() function the measured distance between a point pair can be added and the coordinates will be transformed from pixel space to the new unit space. however, if the recording is more complex and has depth a new calibration function would have to be devised so the current package can not solve this.
The reason for sticking with R is that it ha excellent data analysis and plotting packages that we were familiar with.
Thank you , I am more focused on used case , that is an object moving from left to right . Camera point is fixed. You mentioned that you knew the area of where the object was moving is that right , for taking into consideration ?
Ok, now i understand why you went for R implementation . Its just that I am personally not familiar with R . I guess this package can be used as a black box ? Do you have some suggestions if one can convert R scripts in python scripts ?
In case you're still interested, I've successfully used rpy2 to run multi-file OFT and EPM analyses in a Python Colab notebook (their actual R runtime can't mount a Drive at the moment). The results can then easily be assigned from R to Pandas dataframes using "line magic". Create a folder with both DLCAnalyzer_Functions_final.R and a new Python notebook in it and try:
%load_ext rpy2.ipython
import rpy2.robjects.packages as rpackages
utils = rpackages.importr('utils')
utils.chooseCRANmirror(ind=1) # select the first mirror in the list
packnames = ('sp', 'imputeTS', 'ggplot2', 'ggmap', 'data.table', 'cowplot', 'corrplot')
from rpy2.robjects.vectors import StrVector
names_to_install = [x for x in packnames if not rpackages.isinstalled(x)] if len(names_to_install) > 0: utils.install_packages(StrVector(names_to_install))
(Cell break)
%%R
library(sp) #tested with v1.3-2 library(imputeTS) #tested with v3.0 library(ggplot2) #tested with v3.1.0 library(ggmap) #tested with v3.0.0 library(data.table) #tested with v1.12.8 library(cowplot) #tested with v0.9.4 library(corrplot) #tested with v0.84
And proceed according to the normal instructions with the caveat of adding %%R at the top of your cells. Not really a conversion to Python, but the upshot is that you can use these great functions from @lukasvonziegler alongside/within your normal Python workflow. The R code itself is understandable without necessarily "knowing" R.
Hi @lukasvonziegler , first of all thank you for the post analysis scripts for Deeplabcut. I had two questions
/B