Deeplabcut: Accessing processed data values of body parts (Exporting output data to csv or other formats)

Created on 14 Jun 2018  路  6Comments  路  Source: DeepLabCut/DeepLabCut

Hello,

Is there a file that is saving the coordinates of the tracked 'body parts' that I can then export and analyze elsewhere? After running all the steps I end up with a video with overlaid predicted positions of the body parts, but I was wondering if this information is stored somewhere as a CSV or some other format.

Thanks!

Most helpful comment

I just pushed an update that allows you to save the data also as csv file. Just set the variable: _storedata_as_csv_ to _True_ in _myconfig_analysis.py_ to do this.

Please also note that the MultiIndex Panda Arrays that we use for holding the pose data as well as the scorer & bodypart information can be exported in many other ways, as indicated in http://pandas.pydata.org/pandas-docs/version/0.23/api.html#id12

All 6 comments

Hi,

when you run Analyze videos, (https://github.com/AlexEMG/DeepLabCut/blob/master/Analysis-tools/AnalyzeVideos.py) the data will be stored in a pandas dataframe for each video (done in in line 184 (i.e. DataMachine.to_hdf(dataname, 'df_with_missing', format='table', mode='w') )

This file can be imported elsewhere, just like MakingLabeledVideo.py reads the video + this file to make the labeled videos.

Of course you can also import this hdf file in other programs outside of python. You can also save the same data in csv format.

I.e. exchange line 169
DataMachine.to_hdf(dataname, 'df_with_missing', format='table', mode='w')
by:
DataMachine.to_csv("myfile.csv")

Other ways to export the data can be found in http://pandas.pydata.org/pandas-docs/version/0.23/api.html#id12

Cheers,
Alex

I just pushed an update that allows you to save the data also as csv file. Just set the variable: _storedata_as_csv_ to _True_ in _myconfig_analysis.py_ to do this.

Please also note that the MultiIndex Panda Arrays that we use for holding the pose data as well as the scorer & bodypart information can be exported in many other ways, as indicated in http://pandas.pydata.org/pandas-docs/version/0.23/api.html#id12

Thank you!!

Hi @AlexEMG,

Would you please be more specific where I can access to the file "myconfig_analysis.py"? Thank you.

Hi, this thread is for DLC 1.0 I guess. So the file would be here: https://github.com/AlexEMG/DeepLabCut/releases/tag/1.11

In the new version you can export csv by:
https://forum.image.sc/t/creating-csv-files-without-re-analyzing/25231/2

and of course during analysis with:
deeplabcut.analyze_videos(config,videos,save_as_csv=True)

Thanks a lot! I got the csv file.

Was this page helpful?
0 / 5 - 0 ratings