Skip to content

ZeroDivisionError when analyze videos #1818

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions