Analysis in jupyter notebook, problems with metadata/pickle-file

Hello,

I am trying to do some analyses using jupyter notebook, but I am running into trouble due to the “Scorer:” line in the pickle-file. In “Scorer” it says “DeepCut_resnet50_observational-learningMay7shuffle1_800000”, which in and of it self is not a problem, but using this to create a “dataframe” of the h5-file with different levels results in an inability to access the different levels (as a hierarchy, “Scorer” is at the top, followed by “bodyparts” and then “coords”) as I get this message:

AttributeError Traceback (most recent call last)
in
----> 1 Dataframe.DeepCut_resnet50_observational-learningMay7shuffle1_800000.head()

~\AppData\Local\Continuum\anaconda3\envs\DLCanalysis\lib\site-packages\pandas\core\generic.py in getattr(self, name)
5065 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5066 return self[name]
-> 5067 return object.getattribute(self, name)
5068
5069 def setattr(self, name, value):

AttributeError: ‘DataFrame’ object has no attribute ‘DeepCut_resnet50_observational’

I figure it is due to the hyphen in “observational-learning” (have to access that level first, then work my way down), but trying to directly fix that in the pickle-file just messed things up even more. Does anyone know of a work around or a safe way to edit the “Scorer” line in the pickle-file? Or do I have to create a completely new project? I was thinking changing the “Task”-line in the config.yaml file (it says “observational-learning”) and then running the analysis of the relevant video again (thus creating a new pickle-file with the corrected “Scorer”-line), but the file explicitly says “do not edit” the project definitions, so haven’t dared to do that…

I do hope this was explained in an understandable way!

I’m not sure I understand so you have an .h5 file that you want to load in ___ ? (python?) with pandas, is that correct? that should not be an issue. The pickle is jus the human-readable file, but the .h5 is for loading.

i.e. you can do the following to load it:

import pandas as pd 
df = pd.read_hdf(path_to_your_file)
df.head()

The loading of the file is no issue, but accessing some of the levels in the .h5 file is where I run into trouble. This is how the section of the notebook looks like:

The comments in between the lines (help from a friend) uses other file-names to explain the program, but the observational-learning file is mine.

So, I’m trying to access the first “level” of the data frame, the level called “DeepCut_resnet50_observational-learningMay7shuffle1_800000”, which is where I get the AttributeError, is it seems like it stops reading at the hyphen (refering to the attribute “DeepCut_resnet50_observational” instead of the entire level name)?

This looks like it’s taking your hyphen as a minus sign when selecting the level as an attribute.

Try DataFrame[“DeepCut_resnet50_observational-learningMay7shuffle1_800000”] instead.

Then I get SyntaxError on the brackets. Also tried with parentheses and both single and double quotes, same error.

My mistake, that should have been Dataframe with a lowercase “f”:

Dataframe[“DeepCut_resnet50_observational-learningMay7shuffle1_800000”]

If that still doesn’t work then I’m a bit stumped as that’s how you access multi-indexed data in pandas.

Maybe have a read of this, as it’s a pandas issue rather than a deeplabcut problem.

Alright, I’ll look further into pandas. Thanks for the help :slight_smile: