Repository navigation
Closed
Description
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 zeroAnything else?
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
Shachafbe commentedon Jan 13, 2022
I tried to check "no" on "assemble with identity only" and it's running fine for now but the individual identity is important for my research.
MMathisLab commentedon Jan 13, 2022
@Shachafbe did you train the network with
identity = Trueset in config.yaml ?and can you please check the exact version with ipython, import deeplabcut >
deeplabcut.__version__Shachafbe commentedon Jan 13, 2022
Thank you for the quick reply.
I did train with identity = True
The version is: '2.2.0.3'
MMathisLab commentedon Jan 13, 2022
len(inds)--> what is the # of individuals in yourconfig.yaml?Shachafbe commentedon Jan 13, 2022
The number of individuals is 5.
actually, in the beginning, I tagged frames of 5 animals. Then I saw one of them is missing a lot so I tried to remove it from the config after labeling (left with 4 individuals) but it made errors at certain steps of the training (don't remember which one) so I returned it to 5 animals and did the training again. Maybe it still changed something? I did try to change it to 4 animals to run the "convert to tracklets" now but it gave me the same error
MMathisLab commentedon Jan 13, 2022
hmm... indeed once you start labeling you can't drop individuals; when you track you pass the n_tracks (in the GUI you set the # of animals you want to track for a particular video). It does seems something is odd about your project (DLC is working otherwise and passing all function tests), given the 4-5 swap, but it's odd you are getting length=zero for individuals... check your pose_cfg.yaml and also the inference_cfg.yaml and be sure topktoretain is 5.
btw, you might consider upgrading to 2.2.0.5, the GUI workflow is nicer.
Shachafbe commentedon Jan 16, 2022
besides the individuals list in the config file and the topKtoretain parameter in the inference_cfg file is there another parameter influencing the number of animals?
The topKtoretain was 4. I change it and run only the convert to tracklet again- got the same error. What steps are using the parameters from the inference_cfg file? I will try to run them again.
MMathisLab commentedon Jan 17, 2022
@jeylau might have other ideas, but i'm not sure what else to recommend
Shachafbe commentedon Jan 17, 2022
I think somehow I mess things up when I tried to remove one animal at the beginning. I'm hoping to avoid tagging all over again, so if there is a way I can use the same tagged frames to fix it and do the training again in some way, it will be a great help.
And anyway thank you for the try!
MMathisLab commentedon Jan 17, 2022
@Shachafbe if you want to send me your configs (main, test/train fg, inference), I can try to take a look if I see anything amiss! [email protected] -- I know you're a long time user and I want to get it running for ya :)
jeylau commentedon Jan 17, 2022
Hey @Shachafbe, does it work fine if turning the calibration step off?
jeylau commentedon Jan 18, 2022
I think this will be fixed with #1641; empty assemblies are now properly caught before calculating distances.
MMathisLab commentedon Jan 18, 2022
Hey @Shachafbe can you run this, and try again?
Install the latest DeepLabCut version:
pip install https://github.com/DeepLabCut/DeepLabCut/archive/master.zipShachafbe commentedon Jan 18, 2022
Doing it now. It's a big video so might take some time I'll update soon.
Shachafbe commentedon Jan 18, 2022
It worked!
THANK YOU!!!!