How to use deeplabcut.analyzeskeleton

I have gotten my analyze video working now, but how do I use deeplabcut.analyzeskeleton to find the angle between the hind limb of the rabbit and the ground using the data from analyze video? I have been using the GUI, is it somehow accessible through there? Or do I have to use the terminal on my mac to use analyzeskeleton? Any help would be greatly appreciated!

@jpierce, you’ll have to use the terminal. In IPython, you could type deeplabcut.analyzeskeleton? to print the documentation. See here too. But essentially (and like most DLC functions), it will require your config.yaml, a list of videos, and certainly of interest the flag save_as_csv=True.

2 Likes

Thank you . I was also looking into this . Slowly getting a hang of DLC

@jeylau, I have been working with deeplabcut in the terminal but it says that my config file cannot be found, even when I go to the file and right-click and press “Get Info” in order to get the full file path. This is the code that I have been putting in:

deeplabcut.analyzeskeleton(’/Macintosh HD/Users/jessicapierce/trialGO1Left-Jessica Pierce -2020-09-23/G01left2-Jessica Pierce -2020-10-23/G01left2-Jessica Pierce -2020-10-23/config.yaml’, ‘Macintosh HD/Users/jessicapierce/trialG01left-Jessica Pierce -2020-09-23/G01left2-JessicaPierce -2020-10-23/G01left2-Jessica Pierce -2020-10-23/videos/G01(left)’, videotype=“mp4”, shuffle=1, trainingsetindex=0, filtered=True, save_as_csv=True, destfolder=None)

Please let me know if you can see anything wrong.

or @MWMathis, or anyone that is willing to help, I got rid of the slash at the beginning and I found that I had put an O instead of a 0 but I am still getting the error:

“Config file is not found. Please make sure that the file exists and/or that you passed the path of the config file correctly!”
FileNotFoundError: Config file is not found. Please make sure that the file exists and/or that you passed the path of the config file correctly!

Any help is appreciated!

@jpierce, the paths look wrong to me (your video path does not include its extension for example). The safest way is to right click on your file and press the Option key (the one between Control and Command), you should now see that the ‘Copy’ menu has turned into ‘Copy as path’. Try that for both the config and the video (which should be passed into the function as a list by the way) and you should be fine :slight_smile:

1 Like

Ok, so I got past the config.yaml error, but now the message that I get is

Processing /Users/jessicapierce/trialG01Left-Jessica Pierce -2020-09-23/G01left2-Jessica Pierce -2020-10-23/G01left2-Jessica Pierce -2020-10-23/videos/G01(left).mp4

No unfiltered data file found in /Users/jessicapierce/trialG01Left-Jessica Pierce -2020-09-23/G01left2-Jessica Pierce -2020-10-23/G01left2-Jessica Pierce -2020-10-23/videos for video G01(left) and scorer DLC_mobnet_100_G01left2Oct23shuffle1_21000.

Not sure what to do here, do I need to go back into the gui and do something to the video file? Any pointers help, thank you for all your help so far!

Actually I got it to work! The skeleton csv printed and everything. Thanks!!

1 Like

@jeylau I’ve been working on another specimen and when I type in all the parameters for deeplabcut.analyzeskeleton, it says “Processing…” but then I get hit with an error(I have attached a photo of what it looks like). I went into the config.yaml file to see what body part I had named in the body part 1 spot and it was the foot of the rabbit, but I’m not sure what it has affected in the process as I changed the name in the last video I analyzed before this one, so I’m not sure where to go from here. Thanks in advance!

Hey @jpierce, it looks like there is a mismatch between the names of the body parts and those used for the skeleton. Could you please verify that the skeleton does use ‘foot’ instead of ‘bodypart1’?

@jeylau, I have attached a photo below of the config.yaml file. It seems that in the skeleton section it says bodypart1, so I think that is where the error is. Let me know what you think.

Yes, you’re right, this is the cause of the error! The skeleton should connect the bodyparts you defined (whereas here it is the placeholder default skeleton). But since you had the whole analysis working previously, I’d just like to make sure that you are not recreating a new project for every new video. After having trained the model once, you can use analyze_videos and analyzeskeleton right away on other videos too (provided naturally that you still aim to track the same bodyparts) :slight_smile:

Yes, I had made a whole new project for a new video. So essentially once you do one analysis, you can just compare the rest of the videos to that same analysis? After speaking to my PI, he wanted me to change the placement of a few of the markers and add a few more so that is why I did a new project with a bit more iterations.

@jeylau, I also meant to ask that in order to fix this error would I just fix the part where it says “bodypart1” in the config.yaml file and so on to the names for the body parts that I have listed above in order for the analyze skeleton tool to work again? Thanks!

You need to change not only bodypart1 but the entire default skeleton definition. If your bodyparts are foot, heel, leg, etc, and yet try to connect bodypart1 to bodypart2 and bodypart3 to objectA, the error you report shows up because you are trying to connect keypoints that do not exist in the config and thus have not been labeled. Just make sure that all connected bodyparts in the skeleton actually are labels defined under bodyparts.

1 Like