Problem plotting trajectory of analyzed video

Hi,

I’m using Google Colab to run my project and I was able to obtain a satisfactory pixel error (below) after evaluating the trained model:
image

I wanted to analyze a video but I get the following error:

Loading /content/drive/My Drive/Marmoset/Activity_Emilio-Kwan-2020-12-02/analysis_new/2018-12-18_Emilio.mpg and data.
No unfiltered data file found in /content/drive/My Drive/Marmoset/Activity_Emilio-Kwan-2020-12-02/analysis_new for video 2018-12-18_Emilio and scorer DLC_resnet50_Activity_EmilioDec2shuffle1_267500 and skeleton tracker.
No detection data found in /content/drive/My Drive/Marmoset/Activity_Emilio-Kwan-2020-12-02/analysis_new for video 2018-12-18_Emilio, scorer DLC_resnet50_Activity_EmilioDec2shuffle1_267500, and tracker skeleton
Make sure /content/drive/My Drive/Marmoset/Activity_Emilio-Kwan-2020-12-02/analysis_new/2018-12-18_Emilio.mpg was previously analyzed, and that detections were successively converted to tracklets using “deeplabcut.convert_detections2tracklets()” and “deeplabcut.convert_raw_tracks_to_h5()”.
Plots could not be created! Videos were not evaluated with the current scorer DLC_resnet50_Activity_EmilioDec2shuffle1_267500.

I’m confused as to why I get this error message as I analyzed the video. I also don’t think I have the incorrect path to the video file, I specified the new path for the video for analysis. Unless it has to be in the same folder as the training videos?

Can anyone advise on how to rectify this error. Thanks!

Hi,

If it’s multianimal project you have to convert tracklets first.

Hi,

I’m only tracking a single animal, so I don’t need to convert tracklets. Is there a way I can specify this?

When you created the project, did you select “multi-animal project”? That’s when the determination is made.

Whatever line you are calling to get the error above thinks that you are running a multi-animal project. So, if you did not select multi-animal project, make sure you are running the line for single animal projects.
My guess is that this isn’t on the analyze video call, but rather the plot_trajectories call. If that’s the case, and you have a single-animal project, make sure you don’t include a flag for track_method=skeleton because that is for multi-animal projects only.

You’re not the first person to hit this error, either. Just make sure that if you created a single animal project, you use COLAB_YOURDATA_TrainNetwork_VideoAnalysis.ipynb as your template. But if you created a multi-animal project, you should use COLAB_maDLC_TrainNetwork_VideoAnalysis.ipynb as your template.

No, I didn’t select “multi-animal project” when I created the project using my Windows PC.

I looked back at the code and it looks like for the video analysis step, I incorrectly added the tracklet specification when it was not needed. It looked like I was able to run the analyze video command but when I check the directory of the analyzed video, I don’t see a .hd5 file.

I suppose this is why I can’t verify the frames for outliers or proceed to plot trajectories? I get the following message when I try to plot trajectories:

No filtered data file found in /content/drive/My Drive/Marmoset/Activity_Emilio-Kwan-2020-12-02/analysis_new for video 2018-12-18_Emilio and scorer DLC_resnet50_Activity_EmilioDec2shuffle1_267500.

Not sure if this is relevant but I also don’t see any .hd5 files in the videos used for labeling/training.

You wouldn’t see anything there unless you analyzed those videos. By they way, you should analyze those videos first. If your model can’t track the videos it trained on, you should add to your training set before doing too much else.

I’d need more info to help, and without knowing your computer/programming background, I apologize if some of the following seems rudimentary.

  1. What is the exact line of code you are running when you get the error? And what are the variables (i.e. if you are running deeplabcut.analyze_videos(config, vids), what have you set config and vids to?

  2. When you are looking on your computer at the folder containing the video, where you say no hd5 file is saved, you are looking at a folder in your Google Drive folder, not a local folder, correct?

  3. Is any file created in that video folder other than the video after analyze videos? Anything beginning with the name of the video with any extension?

  4. Please confirm that your config.yaml file has a line that says multianimalproject: false. That should be right near the top. You should also not see individuals:, or multianimalbodyparts:.

To answer a previous question about whether I used the right project, I used the Colab_TrainNetwork_VideoAnalysis.ipynb as my template, which seems like the single animal project?

I reran the training using a new Colab notebook but this time, I’m stuck at the analyzing video step. It seems like it’s a specifying path issue but I’ve verified the code and I can’t figure out what’s the error.

No worries, my computer/programming background is still very elementary so your clarifications do help.

  1. This is the code I’m running:
    deeplabcut.analyze_videos(path_config_file,[‘content/drive/My Drive/DeepLabCut/Activity_Emilio-Kwan-2020-12-02/videoanalysis/’], videotype = ‘mpg’, save_as_csv=True)

And the corresponding error:

I didn’t modify the path to the config file, it’s the same as the training. The video to be analyzed is in a different directory than the training videos (/videos), so the only difference in path is the last folder. I tried keeping the path to the same directory as the training videos or as videofile_path but I still get the same error.

  1. Yes, there’s nothing in the Google Drive folder.

  2. No, there wasn’t any file in the video folder (with the analyzed video or training videos).

  3. Yes, it’s false for multi-animal.
    image

Not sure if this helps but I’ve attached my config.yaml file, in case there’s an issue there.
config.yaml (1.9 KB)

The no file found error is coming because you have save_as_csv=True, and it can’t find an h5 file to convert to csv.

The reason it isn’t saving an h5 file is probably because the video is corrupt. The video loader (opencv) is not particularly robust against metadata corruptions, so even though your video may open in a media player, it can’t be fully loaded for DLC analysis.

See answers here for some reencoding options that work for most people. Since ffpmeg is installed with DLC, you already have the necessary tools.

Also, I believe the latest deeplabcut has some more informative warning messages about this problem.

Hi @eris! Have you tried passing a list of videos rather than a list of folders? Either one normally works but that would allow you to move forward. Note that by default video names with _full. or _labeled. are ignored; is it your case?