Skip to content

ZeroDivisionError when analyze videos #1818

Closed

Description

@BinZJU

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

Thank you for the powerful tools. I'm using the DLC 2.2.1[GUI], troubled with the ZeroDivisionError. I have searched the existing issues, finding a similar one [#1638 ] [https://github.com//issues/1638]. However, it is not exactly the same.
Everything goes fine until the step of Analyze Videos.
Briefly, I am tracking 2 black mice in 6 videos, each lasting for 5-10 min. 40 frames per video were extracted to generate the dataset used for annotation (SimBA 7 points). I chose the resnet_50 network to train the model for 200k iterations. The original resolution is 9001024, batch processed with SimBA. When I use the original resolution, the ZeroDivisionError showed. So I created another project after downsampling the videos to 400400. Yet, the same error was present again. It said: " line 332, in calc_assembly_mahalanobis_dist factor = self._kde.d / len(inds) ZeroDivisionError: division by zero"

If the Calibrate animal assembly or Assemble using animal identity was unchecked, the video can be successfully analyzed.

I have updated to the latest DLC version with pip install https://github.com/DeepLabCut/DeepLabCut/archive/master.zip. And make sure that the identity = true in config.yaml before training, num_idchannel: 2 in the pose_cfg.yaml, and topktoretain: 2 in the inference_cfg.yaml.
It doesn't help.

I have uploaded the yaml files, if further details are needed, please let me know.

Could you please help me out? I really appreciate it.

yaml.zip

Operating System

Windows 11 x64

DeepLabCut version

2.2.1 with GUI

DeepLabCut mode

multi animal

Device type

gpu, 3080

Steps To Reproduce

  1. Starting the GUI in Anaconda deeplabcut env
  2. Creating the project, extract frames, label, train, evaluate
  3. Analyze a single 400*400 video, shuffle = 1, videotype = avi, number of animals =2. Checked the Creat video, Calibrate, Assemble, Save csv, Save nwb, Plots to pop up, and Plot trajectories. Unchecked the Use ffprobe, Filter Predictions.
  4. The error was reproduced.

Snipaste_2022-05-03_11-11-38

Relevant log output

Processing...  F:\CLAHE\Downsample\CLAHE_Trial_11.avi
Analyzing F:\CLAHE\Downsample\CLAHE_Trial_11DLC_resnet50_Mating_DualMs_7pts_DLCMay2shuffle1_200000.h5
7it [00:00, 3499.84it/s]
Traceback (most recent call last):
  File "F:\Anaconda\envs\deeplabcut\lib\site-packages\deeplabcut\gui\analyze_videos.py", line 492, in analyze_videos
    scorername = deeplabcut.analyze_videos(
  File "F:\Anaconda\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_tensorflow\predict_videos.py", line 570, in analyze_videos
    convert_detections2tracklets(
  File "F:\Anaconda\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_tensorflow\predict_videos.py", line 1747, in convert_detections2tracklets
    ass.assemble()
  File "F:\Anaconda\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_tensorflow\lib\inferenceutils.py", line 784, in assemble
    assemblies, unique = self._assemble(data_dict, i)
  File "F:\Anaconda\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_tensorflow\lib\inferenceutils.py", line 727, in _assemble
    scores = [
  File "F:\Anaconda\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_tensorflow\lib\inferenceutils.py", line 728, in <listcomp>
    -self.calc_assembly_mahalanobis_dist(ass) for ass in assemblies
  File "F:\Anaconda\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_tensorflow\lib\inferenceutils.py", line 332, in calc_assembly_mahalanobis_dist
    factor = self._kde.d / len(inds)
ZeroDivisionError: division by zero

Anything else?

No response

Code of Conduct

Activity

  1. added
    bug
    on May 3, 2022
  2. jeylau commented on May 3, 2022

    @jeylau
    Contributor

    Hey @BinZJU, thanks for reporting the bug. I've just pushed a fix, it will be merged in for the next release. ☺️

  3. BinZJU commented on May 3, 2022

    @BinZJU
    Author

    Hey @BinZJU, thanks for reporting the bug. I've just pushed a fix, it will be merged in for the next release. ☺️

    Thank you for the prompt reply. Look forwards to the next release. BTW, will it be accessible in this month?

  4. jeylau commented on May 3, 2022

    @jeylau
    Contributor

    I suppose so! If you don't want to wait, you could try it out reinstalling deeplabcut with pip install git+https://github.com/DeepLabCut/DeepLabCut.git@fix_1818.

  5. BinZJU commented on May 3, 2022

    @BinZJU
    Author

    I suppose so! If you don't want to wait, you could try it out reinstalling deeplabcut with pip install git+https://github.com/DeepLabCut/DeepLabCut.git@fix_1818.

    Thank you so much! I'm going to give it a shot.

  6. BinZJU commented on May 3, 2022

    @BinZJU
    Author

    Thank you for your patience. I'm new to the DLC. If I understand you correctly. I just enter the deeplabcut env of anaconda, then type in pip install git+https://github.com/DeepLabCut/DeepLabCut.git@fix_1818. Finally, I restart the DLC, loading the previous project to analyze videos. But the same error showed again.

  7. MMathisLab commented on May 3, 2022

    @MMathisLab
    Member

    Hey no worries! so if you open a new terminal/ cmd then do the following:

    conda activate DEEPLABCUT 
    
    pip install git+https://github.com/DeepLabCut/DeepLabCut.git
    
    python -m deeplabcut 
  8. BinZJU commented on May 3, 2022

    @BinZJU
    Author

    Hey no worries! so if you open a new terminal/ cmd then do the following:

    conda activate DEEPLABCUT 
    
    pip install git+https://github.com/DeepLabCut/DeepLabCut.git
    
    python -m deeplabcut 

    Thanks anyway. That's exactly what I did. And I strickly followed your instructions to try it again. Yet, the same error remains there. Is it possible that there is something wrong with my config file?

  9. BinZJU commented on May 7, 2022

    @BinZJU
    Author

    Hey no worries! so if you open a new terminal/ cmd then do the following:

    conda activate DEEPLABCUT 
    
    pip install git+https://github.com/DeepLabCut/DeepLabCut.git
    
    python -m deeplabcut 

    I don't mean to waste your time, just to give you a feedback. After creating a new conda env and reinstalling DLC (plus 1818), the problem has been solved.
    Thank you very much!

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

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions