Error when labeling & saving

I am getting an error when I start labeling the data. This started out of no where. Typically DLC runs smoothly…
Any help appreciated.

(ipython:15515): Gtk-WARNING **: 08:53:59.160: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:53:59.160: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:53:59.160: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:53:59.160: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:53:59.160: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:53:59.160: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:53:59.160: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

## (ipython:15515): Gtk-WARNING **: 08:53:59.160: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

KeyError Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘labeled-data/B/img00487.png’

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
~/anaconda3/envs/dlc-ubuntu-GPU/lib/python3.6/site-packages/deeplabcut/generate_training_dataset/multiple_individuals_labeling_toolbox.py in nextImage(self, event)
1046 # Refreshing the button counters
1047 self.buttonCounter = {i: for i in self.individual_names}
-> 1048 MainFrame.saveEachImage(self)
1049 self.iter = self.iter + 1
1050

~/anaconda3/envs/dlc-ubuntu-GPU/lib/python3.6/site-packages/deeplabcut/generate_training_dataset/multiple_individuals_labeling_toolbox.py in saveEachImage(self)
1222 self.dataFrame.loc[self.relativeimagenames[self.iter]][
1223 self.scorer, bp[-1][2], bp[0][-1], “x”
-> 1224 ] = bp[-1][0]
1225 self.dataFrame.loc[self.relativeimagenames[self.iter]][
1226 self.scorer, bp[-1][2], bp[0][-1], “y”

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in **getitem** (self, key)
1766
1767 maybe_callable = com.apply_if_callable(key, self.obj)
-> 1768 return self._getitem_axis(maybe_callable, axis=axis)
1769
1770 def _is_scalar_access(self, key: Tuple):

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1963 # fall thru to straight lookup
1964 self._validate_key(key, axis)
-> 1965 return self._get_label(key, axis=axis)
1966
1967

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in _get_label(self, label, axis)
623 raise IndexingError(“no slices here, handle elsewhere”)
624
–> 625 return self.obj._xs(label, axis=axis)
626
627 def _get_loc(self, key: int, axis: int):

~/.local/lib/python3.6/site-packages/pandas/core/generic.py in xs(self, key, axis, level, drop_level)
3535 loc, new_index = self.index.get_loc_level(key, drop_level=drop_level)
3536 else:
-> 3537 loc = self.index.get_loc(key)
3538
3539 if isinstance(loc, np.ndarray):

~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2646 return self._engine.get_loc(key)
2647 except KeyError:
-> 2648 return self._engine.get_loc(self._maybe_cast_indexer(key))
2649 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2650 if indexer.ndim > 1 or indexer.size > 1:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘labeled-data/B/img00487.png’

(ipython:15515): Gtk-WARNING **: 08:54:09.680: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:09.680: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:09.680: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:09.680: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:09.680: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:09.680: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

## (ipython:15515): Gtk-WARNING **: 08:54:09.680: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

KeyError Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘labeled-data/B/img00487.png’

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
~/anaconda3/envs/dlc-ubuntu-GPU/lib/python3.6/site-packages/deeplabcut/generate_training_dataset/multiple_individuals_labeling_toolbox.py in nextImage(self, event)
1046 # Refreshing the button counters
1047 self.buttonCounter = {i: for i in self.individual_names}
-> 1048 MainFrame.saveEachImage(self)
1049 self.iter = self.iter + 1
1050

~/anaconda3/envs/dlc-ubuntu-GPU/lib/python3.6/site-packages/deeplabcut/generate_training_dataset/multiple_individuals_labeling_toolbox.py in saveEachImage(self)
1222 self.dataFrame.loc[self.relativeimagenames[self.iter]][
1223 self.scorer, bp[-1][2], bp[0][-1], “x”
-> 1224 ] = bp[-1][0]
1225 self.dataFrame.loc[self.relativeimagenames[self.iter]][
1226 self.scorer, bp[-1][2], bp[0][-1], “y”

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in **getitem** (self, key)
1766
1767 maybe_callable = com.apply_if_callable(key, self.obj)
-> 1768 return self._getitem_axis(maybe_callable, axis=axis)
1769
1770 def _is_scalar_access(self, key: Tuple):

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1963 # fall thru to straight lookup
1964 self._validate_key(key, axis)
-> 1965 return self._get_label(key, axis=axis)
1966
1967

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in _get_label(self, label, axis)
623 raise IndexingError(“no slices here, handle elsewhere”)
624
–> 625 return self.obj._xs(label, axis=axis)
626
627 def _get_loc(self, key: int, axis: int):

~/.local/lib/python3.6/site-packages/pandas/core/generic.py in xs(self, key, axis, level, drop_level)
3535 loc, new_index = self.index.get_loc_level(key, drop_level=drop_level)
3536 else:
-> 3537 loc = self.index.get_loc(key)
3538
3539 if isinstance(loc, np.ndarray):

~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2646 return self._engine.get_loc(key)
2647 except KeyError:
-> 2648 return self._engine.get_loc(self._maybe_cast_indexer(key))
2649 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2650 if indexer.ndim > 1 or indexer.size > 1:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘labeled-data/B/img00487.png’

(ipython:15515): Gtk-WARNING **: 08:54:12.449: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:12.449: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:12.449: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:12.449: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:12.450: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:12.450: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

## (ipython:15515): Gtk-WARNING **: 08:54:12.450: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

KeyError Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘labeled-data/B/img00487.png’

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
~/anaconda3/envs/dlc-ubuntu-GPU/lib/python3.6/site-packages/deeplabcut/generate_training_dataset/multiple_individuals_labeling_toolbox.py in nextImage(self, event)
1046 # Refreshing the button counters
1047 self.buttonCounter = {i: for i in self.individual_names}
-> 1048 MainFrame.saveEachImage(self)
1049 self.iter = self.iter + 1
1050

~/anaconda3/envs/dlc-ubuntu-GPU/lib/python3.6/site-packages/deeplabcut/generate_training_dataset/multiple_individuals_labeling_toolbox.py in saveEachImage(self)
1222 self.dataFrame.loc[self.relativeimagenames[self.iter]][
1223 self.scorer, bp[-1][2], bp[0][-1], “x”
-> 1224 ] = bp[-1][0]
1225 self.dataFrame.loc[self.relativeimagenames[self.iter]][
1226 self.scorer, bp[-1][2], bp[0][-1], “y”

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in **getitem** (self, key)
1766
1767 maybe_callable = com.apply_if_callable(key, self.obj)
-> 1768 return self._getitem_axis(maybe_callable, axis=axis)
1769
1770 def _is_scalar_access(self, key: Tuple):

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1963 # fall thru to straight lookup
1964 self._validate_key(key, axis)
-> 1965 return self._get_label(key, axis=axis)
1966
1967

~/.local/lib/python3.6/site-packages/pandas/core/indexing.py in _get_label(self, label, axis)
623 raise IndexingError(“no slices here, handle elsewhere”)
624
–> 625 return self.obj._xs(label, axis=axis)
626
627 def _get_loc(self, key: int, axis: int):

~/.local/lib/python3.6/site-packages/pandas/core/generic.py in xs(self, key, axis, level, drop_level)
3535 loc, new_index = self.index.get_loc_level(key, drop_level=drop_level)
3536 else:
-> 3537 loc = self.index.get_loc(key)
3538
3539 if isinstance(loc, np.ndarray):

~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2646 return self._engine.get_loc(key)
2647 except KeyError:
-> 2648 return self._engine.get_loc(self._maybe_cast_indexer(key))
2649 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2650 if indexer.ndim > 1 or indexer.size > 1:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘labeled-data/B/img00487.png’

(ipython:15515): Gtk-WARNING **: 08:54:13.838: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:13.838: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:13.838: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:13.838: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:13.839: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:13.839: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:13.839: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkButton)

(ipython:15515): Gtk-WARNING **: 08:54:17.865: Negative content height -11 (allocation 1, extents 6x6) while allocating gadget (node button, owner GtkToggleButton)

Just a note that the “Gtk-WARNING” happens when I try to label the frames, and the “KeyError Traceback (most recent call last)” when I try to save my labeling progress.

My error is similar to this one but was not resolved when I reinstalled DLC or any of its dependencies.

Hello,
Appreciate any help on this error.

@AlexanderMathis an help on this? I just tried to reinstall DLC, but got the same results.

hi! Does this happen always, or only the second/third/nth time you click save, and subsequently try to advance to the next frame?
I have been getting a partially similar error (KeyError) which occurs the second or third time I try to save my labeling. I believe it has to do with the indexing of the CollectedData.h5 file - it uses the file names of the images in the folder, yet after saving for a second/third time, it removes all the unlabeled (in this case not yet labeled) images from the index of the h5 file and hence it cannot find the next image.
My only solution so far has been to only save once after all images in a folder are done - this is of course bad practice.
I’ve experienced this using DLC 2.2b8 on both macOS and ubuntu 18.04.

1 Like

Thank you for sharing your experience Felix. Yes, exactly, but I have 200 frames to label, so I can’t save only once. Hopefully, the DLC guys will have a fix…

yeah… I had the same problem (lots of frames, lots of animals per frame). I created a bunch of extra folders in the labeled-data folders (and corresponding ‘video’ entries in config.yaml) and split it up in batches of 10-15 frames per folder to mitigate the ‘no saving’ issue.

What a hassle! I’d rather downgrade. I’ll try if other versions have this issue too and let you know. Thanks again Felix.

Yup, solved it by rolling back to DLC 2.2b7!

I guess that means it should maybe be filed as a bit on GitHub…

1 Like