Deeplabcut: fail to extract_outlier_frames (pandas 1.0 compatibility issue)

Created on 5 Feb 2020  路  3Comments  路  Source: DeepLabCut/DeepLabCut

operating system: Windows 10 , env: anaconda3 created with the environment .yml file, DeepLabCut version** 2.1.5
Browser: chrome
command:

deeplabcut.extract_outlier_frames(config_path,['D:\\Haofang\\Haofang_LEAP_videos\\high_framerate_recording\\719-1\\092319\\L\\2hz-5\\processedbehavior2019-09-23T15_24_28_stim_1.avi'],outlieralgorithm='jump')

Output: Method jump found 5 putative outlier frames.
Do you want to proceed with extracting 10 of those?
If this list is very large, perhaps consider changing the paramters (start, stop, epsilon, comparisonbodyparts) or use a different method.
yes/no

Then Input: yes

Error message:

Loading video...
Duration of video [s]:  7.51 , recorded @  100.0 fps!
Overall # of frames:  751 with (cropped) frame dimensions:
Kmeans-quantization based extracting of frames from 0.0  seconds to 7.51  seconds.
Extracting and downsampling... 289  frames from the video.
289it [00:02, 113.07it/s]
Kmeans clustering ... (this might take a while)
Let's select frames indices: [627, 194, 361, 568, 402, 332, 438, 300, 367, 282]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-53fd25d5ce70> in <module>
----> 1 deeplabcut.extract_outlier_frames(config_path,['D:\\Haofang\\Haofang_LEAP_videos\\high_framerate_recording\\719-1\\092319\\L\\2hz-5\\processedbehavior2019-09-23T15_24_28_stim_1.avi'],outlieralgorithm='jump')

~\Anaconda3\envs\why\lib\site-packages\deeplabcut\refine_training_dataset\outlier_frames.py in extract_outlier_frames(config, videos, videotype, shuffle, trainingsetindex, outlieralgorithm, comparisonbodyparts, epsilon, p_bound, ARdegree, MAdegree, alpha, extractionalgorithm, automatic, cluster_resizewidth, cluster_color, opencv, savelabeled, destfolder)
    189               if askuser=='y' or askuser=='yes' or askuser=='Ja' or askuser=='ha': # multilanguage support :)
    190                   #Now extract from those Indices!
--> 191                   ExtractFramesbasedonPreselection(Indices,extractionalgorithm,Dataframe,dataname,scorer,video,cfg,config,opencv,cluster_resizewidth,cluster_color,savelabeled)
    192               else:
    193                   print("Nothing extracted, please change the parameters and start again...")

~\Anaconda3\envs\why\lib\site-packages\deeplabcut\refine_training_dataset\outlier_frames.py in ExtractFramesbasedonPreselection(Index, extractionalgorithm, Dataframe, dataname, scorer, video, cfg, config, opencv, cluster_resizewidth, cluster_color, savelabeled)
    366     if len(frames2pick)>0:
    367         #Dataframe = pd.read_hdf(os.path.join(videofolder,dataname+'.h5'))
--> 368         DF = Dataframe.ix[frames2pick]
    369         DF.index=[os.path.join('labeled-data', vname,"img"+str(index).zfill(strwidth)+".png") for index in DF.index] #exchange index number by file names.
    370

~\Anaconda3\envs\why\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
   5271             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5272                 return self[name]
-> 5273             return object.__getattribute__(self, name)
   5274
   5275     def __setattr__(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'ix'

Seems like it was able to select the frame index but wasn't able to extract them. Could you help me with this please?

Most helpful comment

I think I can help here. I just got this error as well while logged in as an admin. It sounds like pandas deprecated ".ix" in version 1.0, which is the version that would have been downloaded if you installed DLC in the past month: https://stackoverflow.com/questions/59991397/attributeerror-dataframe-object-has-no-attribute-ix.

Downgrading pandas via conda install pandas=0.25.1 seems to fix the issue though I still get a annoying deprecation warning.

All 3 comments

hi @haofanglee could you confirm you opened the terminal "as an admin?" thanks1

I think I can help here. I just got this error as well while logged in as an admin. It sounds like pandas deprecated ".ix" in version 1.0, which is the version that would have been downloaded if you installed DLC in the past month: https://stackoverflow.com/questions/59991397/attributeerror-dataframe-object-has-no-attribute-ix.

Downgrading pandas via conda install pandas=0.25.1 seems to fix the issue though I still get a annoying deprecation warning.

^ note to @jeylau we should update our pandas-related code then!

Was this page helpful?
0 / 5 - 0 ratings