Skip to content

Conversation

@ludovicbellier
Copy link
Contributor

@ludovicbellier ludovicbellier commented Dec 22, 2022

Hi DLC team!

Based on a reply of @MMathisLab on an unrelated PR, I went ahead and added num_outputs: 2 in the config.yaml file of a model trained from frames/videos of a single animal, but which I wanted to use to analyze videos containing two animals. Calling analyze_video worked fine, and the resulting HDF file contained for each body part two sets of x,y,likelihood (namely, 'x', 'y', 'likelihood', 'x2', 'y2', 'likelihood2'). However, calling create_labeled_video resulted in an indexing error ("IndexError: index N is out of bounds for axis 0 with size N", N being the number of body parts), and it came from the fact that while I had 2N sets of estimates (two per body part), there were only N colors (one per body part; further details in the code).

This PR fixes the bug described above by taking into account situations where num_outputs>1 in single animal models, in a parsimonious approach (i.e., by replacing existing lines of code so that output using num_outputs=1 doesn't change at all, and output using num_outputs>1 is now valid, as opposed to adding a new situation).

Also, while doing this debugging I constantly had to manually delete the created movie, so I implemented an overwriting flag in create_labeled_video that defaults at False. Turning it to True forces overwriting.

(besides, here's the bottom line of my attempt at estimating poses for the two animals: while the video did show two labels per body part after debugging, on many frames my animal of interest had two labels on it for the same body part, so it looks like a dead end for this strategy in my use case, and I'll have to rely on masking!)

Please don't hesitate if you need further information!
Best,
Ludovic

@MMathisLab
Copy link
Member

this looks great @ludovicbellier - we will review and merge after the break :D

@MMathisLab MMathisLab added the enhancement New feature or request label Dec 23, 2022
@MMathisLab MMathisLab requested a review from AlexEMG December 23, 2022 16:49
@MMathisLab MMathisLab requested a review from jeylau February 4, 2023 11:00
@jeylau
Copy link
Contributor

jeylau commented Feb 4, 2023

That's great @ludovicbellier, thank you very much!

@MMathisLab MMathisLab merged commit 8345235 into DeepLabCut:main Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants