Skip to content

ZeroDivisionError: division by zero at covert to tracklets #1638

Description

@Shachafbe

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

Using DLC 2.2 (with GUI) on a multiple animals project I created using the former DLC version.
Used the same tagged frames but I run again the creation of training dataset, training and video analyzation with DLC 2.2.
All went fine and the video for checking detection was great.
Then I tried to run convert to tracklets and received the error attached.

I saw that there were similar issues but I could not find a relevant solution (I don't think that the file path is the problem- The video analysis went fine)
Many thanks in advance for the help!

Operating System

Windows 10

DeepLabCut version

DLC version 2.2

DeepLabCut mode

multi animal

Device type

gpu

Steps To Reproduce

Using the GUI: Run all steps untile covert to tracklets with yes for calibrate animal assembly and assemble with identity only.

Relevant log output

The videos are analyzed. Time to assemble animals and track 'em...
 Call 'create_video_with_all_detections' to check multi-animal detection quality before tracking.
If the tracking is not satisfactory for some videos, consider expanding the training set. You can use the function 'extract_outlier_frames' to extract a few representative outlier frames.
Using snapshot-200000 for model F:\thirdcolony\colony3new-shachaf-2021-05-25\dlc-models\iteration-0\colony3newMay25-trainset95shuffle5
Processing...  F:\thirdcolony\colony3new-shachaf-2021-05-25\videos\col3D1.mp4
Analyzing F:\thirdcolony\colony3new-shachaf-2021-05-25\videos\col3D1DLC_dlcrnetms5_colony3newMay25shuffle5_200000.h5
37it [00:00, 961.51it/s]
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
~\.conda\envs\dlc 22\lib\site-packages\deeplabcut\gui\analyze_videos.py in convert2_tracklets(self, event)
    422             calibrate=self.calibrate.GetStringSelection() == "Yes",
    423             window_size=self.winsize.GetValue(),
--> 424             identity_only=self.identity_toggle.GetStringSelection() == "Yes",
    425         )
    426

~\.conda\envs\dlc 22\lib\site-packages\deeplabcut\pose_estimation_tensorflow\predict_videos.py in convert_detections2tracklets(config, videos, videotype, shuffle, trainingsetindex, overwrite, destfolder, ignore_bodyparts, inferencecfg, modelprefix, track_method, greedy, calibrate, window_size, identity_only)
   1461                     )
   1462                     ass.calibrate(train_data_file)
-> 1463                 ass.assemble()
   1464                 ass.to_pickle(dataname.split(".h5")[0] + "_assemblies.pickle")
   1465

~\.conda\envs\dlc 22\lib\site-packages\deeplabcut\pose_estimation_tensorflow\lib\inferenceutils.py in assemble(self, chunk_size, n_processes)
    751         if chunk_size == 0 or multiprocessing.get_start_method() == "spawn":
    752             for i, data_dict in enumerate(tqdm(self)):
--> 753                 assemblies, unique = self._assemble(data_dict, i)
    754                 if assemblies:
    755                     self.assemblies[i] = assemblies

~\.conda\envs\dlc 22\lib\site-packages\deeplabcut\pose_estimation_tensorflow\lib\inferenceutils.py in _assemble(self, data_dict, ind_frame)
    695             if self._kde is not None:
    696                 scores = [
--> 697                     -self.calc_assembly_mahalanobis_dist(ass) for ass in assemblies
    698                 ]
    699             else:

~\.conda\envs\dlc 22\lib\site-packages\deeplabcut\pose_estimation_tensorflow\lib\inferenceutils.py in <listcomp>(.0)
    695             if self._kde is not None:
    696                 scores = [
--> 697                     -self.calc_assembly_mahalanobis_dist(ass) for ass in assemblies
    698                 ]
    699             else:

~\.conda\envs\dlc 22\lib\site-packages\deeplabcut\pose_estimation_tensorflow\lib\inferenceutils.py in calc_assembly_mahalanobis_dist(self, assembly, return_proba, nan_policy)
    304             inv_cov = self._kde.inv_cov[np.ix_(inds, inds)]
    305             # Correct distance to account for missing observations
--> 306             factor = self._kde.d / len(inds)
    307         else:
    308             # Alternatively, reduce contribution of missing values to the Mahalanobis

ZeroDivisionError: division by zero

Anything else?

No response

Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmaDLC

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions