What data are stored in .h5 and .pickle?

I can already get nearly accurate tracking results. I used DeepLabCut to train the model, and I find that the filters in Anipose makes my tracking results more accurate. But I currently only used 2D tracking in Anipose and got a .h5 and a .pickle file. However, I hope to get a csv file of animal body label prediction for a video to help with subsequent data analysis.

So I want to know what data is stored in the .h5 and .pickle files obtained after analyzing the video? Can I convert these two files into the .csv file that I want to get the forecast data?

Thanks a lot for any reply!

It’s just the way the data is stored, content is the same. You can convert h5 to csv, but using h5 with pandas is more straightforward, you just load it and it becomes multindex from the start.

Hello, thanks for your reply. This is my first time use files in .h5 format. I tried to open the generated .h5 file with the extension of jupyterlab, but I cannot see the data I want to see, for example, I want to see the (x,y) pixel coordinates of each predicted point.

After I understand the storage structure of the hdf5 file, I found that I cannot know which part of the .h5 file generated after analyzing the video is the coordinate of the predicted point I hope to get?


@ZiyiZhang0912, safest is perhaps to use pandas

import pandas as pd

df = pd.read_hdf('path_to_your_h5_file')

This will preserve the header and you will know exactly your point coordinates.
You could also write that DataFrame to a CSV file with:

thank you very much. I have understood the reading and writing of hdf5 files.

1 Like

It is also possible to read them with Matlab.

display information for the file :

>> h5disp( <filename> )

read the file :

>> h5read( <filename>, <data set name>)

While I was able to access the data with Matlab, it’s kind of awkward.

I couldn’t read them with the Linux program “hdfview” for some reason.

I also tried throwing the command line switch that produces CSV files in one of the functions (docker instance for GPU), but that didn’t produce a CSV.

Now I will try the suggested functions above and also check out Python. :+1:t2: