Visitar URL original
Individuals are mislabeled when analyzing the video · Issue #2877 · DeepLabCut/DeepLabCut · GitHub
Skip to content

Individuals are mislabeled when analyzing the video #2877

Closed

Description

@alagithub

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

Trained the DLC with 5 mice naming each mouse as (M1-M5). When I am analyzing the video with 5 mice its naming the individuals as M1-M5. But if I am analyzing the videos with 2-4 mice, they are being named as (ind1,ind2). Can you please tell us how to resolve this issue.

Operating System

Windows 10

DeepLabCut version

2.3.9

DeepLabCut mode

multi animal

Device type

gpu NVDIA RTX A5000

Steps To Reproduce

No response

Relevant log output

Anything else?

No response

Code of Conduct

Activity

  1. n-poulsen commented on Feb 17, 2025

    @n-poulsen
    Contributor

    @alagithub currently if the number of individuals you specify in the config.yaml is different to the number of tracks asked to be tracked (through the n_tracks parameter in analyze_videos), the names will be updated. So to keep the original names, as of now you'll need to update your project config.yaml before running analyze_videos.

    As this isn't ideal, I'll fix this issue so it is handled better when the number of individuals to track is smaller than the number of animals named in the config.yaml.

  2. n-poulsen commented on Feb 17, 2025

    @n-poulsen
    Contributor

    @alagithub This has been fixed in #2884 - if you update DeepLabCut to the latest version on GitHub (2.3.11) the individual names should be set correctly as M1-M5 when using fewer than 5 mice. To upgrade your DeepLabCut version to the latest version, you can run in your DEEPLABCUT conda environment (as described in the docs):

    pip uninstall deeplabcut
    pip install --upgrade "git+https://github.com/deeplabcut/deeplabcut.git#egg=deeplabcut"

    You can also use the new animal_names parameter when calling analyze_videos with a greater number of individuals than defined in your project config.yaml, e.g. to analyze with 6 mice you could set:

    import deeplabcut
    
    deeplabcut.analyze_videos(config, videos, shuffle=1, animal_names=["M1", "M2", "M3", "M4", "M5", "M6"])

    Note that the individual names in the predictions file will only be those set in the project config.yaml if the number of mice your are setting when analyzing the videos is smaller or equal to the number of mice defined in the config.yaml (we'll take the first n labels when looking for n mice in the videos).

    If you want the labels to match the ones in your config.yaml file without updating the code, you'll need to edit the config.yaml before you run video analysis every time so it matches the number of mice you're looking for. Let me know if you have any other issues or questions!

  3. alagithub commented on Feb 18, 2025

    @alagithub
    Author

    Thank you for the fix. When I am actually running the 5 Mice trained on trace 2 mice, its giving me a user warning UserWarning: No optimal solution found. Employing black magic…
    warnings.warn(“No optimal solution found. Employing black magic…”). The program is not moving forward after that. This doesn't happen when I am analyzing the video with 5 mice. Can you please let me know how to work around this.

  4. n-poulsen commented on Feb 18, 2025

    @n-poulsen
    Contributor

    Is the quality of the predictions still good? This is a warning when tracklet stitching does not find a perfect solution; but if the tracks that are output are good you can ignore the warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions