Repository navigation
Description
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.
Operating System
Windows 11 x64
DeepLabCut version
2.2.1 with GUI
DeepLabCut mode
multi animal
Device type
gpu, 3080
Steps To Reproduce
- Starting the GUI in Anaconda deeplabcut env
- Creating the project, extract frames, label, train, evaluate
- 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.
- The error was reproduced.
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 zeroAnything else?
No response
Code of Conduct
- I agree to follow this project's Code of Conduct

Activity
jeylau commentedon May 3, 2022
Hey @BinZJU, thanks for reporting the bug. I've just pushed a fix, it will be merged in for the next release.☺️
BinZJU commentedon May 3, 2022
Thank you for the prompt reply. Look forwards to the next release. BTW, will it be accessible in this month?
jeylau commentedon May 3, 2022
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.BinZJU commentedon May 3, 2022
Thank you so much! I'm going to give it a shot.
BinZJU commentedon May 3, 2022
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.
MMathisLab commentedon May 3, 2022
Hey no worries! so if you open a new terminal/ cmd then do the following:
BinZJU commentedon May 3, 2022
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?
BinZJU commentedon May 7, 2022
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!