Labeling: crashing on frame switch while all labels are hidden
Bug description
While labeling I encountered some frames where none of the desired body parts are visible so I hid all the nodes. When switching to another frame I re-enabled visibility of nodes and the whole program crashed.
Expected behaviour
I was expecting all hidden nodes to be visible again so I can continue labeling.
Actual behaviour
SLEAP crashed.
Your personal set up
- OS: Windows 10 Education 64-bit operating system, x64-based processor AMD Ryzen 5 5500U with Radeon Graphics 2.10 GHz RAM: 16.0 GB NVIDIA GeForce GTX 1650
- Version(s): SLEAP: 1.2.8 TensorFlow: 2.6.3 Numpy: 1.19.5 Python: 3.7.12
- SLEAP installation method (listed here):
- [* ] Conda from package
Environment packages
# paste output of `pip freeze` or `conda list` here
Logs
Log of two consecutive crashes
(base) C:\Users\Ive>conda activate sleap
(sleap) C:\Users\Ive>sleap-label Saving config: C:\Users\Ive/.sleap/1.2.8/preferences.yaml Restoring GUI state...
Software versions: SLEAP: 1.2.8 TensorFlow: 2.6.3 Numpy: 1.19.5 Python: 3.7.12 OS: Windows-10-10.0.19041-SP0
Happy SLEAPing! :) Traceback (most recent call last): File "C:\Users\Ive\anaconda3\envs\sleap\lib\site-packages\sleap\gui\dataviews.py", line 240, in flags item, key = self.get_from_idx(index) File "C:\Users\Ive\anaconda3\envs\sleap\lib\site-packages\sleap\gui\dataviews.py", line 224, in get_from_idx item = self.original_items[index.row()] IndexError: list index out of range
(sleap) C:\Users\Ive>sleap-label Saving config: C:\Users\Ive/.sleap/1.2.8/preferences.yaml Restoring GUI state...
Software versions: SLEAP: 1.2.8 TensorFlow: 2.6.3 Numpy: 1.19.5 Python: 3.7.12 OS: Windows-10-10.0.19041-SP0
Happy SLEAPing! :)
(sleap) C:\Users\Ive>
# paste relevant logs here, if any
Screenshots
How to reproduce
- Go to Instances
- Click new instance
- Right click on all the nodes to hide them
- Go to Labeling Suggestions
- Click next for the next frame
- Go to Instances
- Click new instance
- Press H to toggle visibility
- SLEAP crashes
This seems like it is related to #969 - when I change the conditional in https://github.com/talmolab/sleap/blob/develop/sleap/gui/widgets/video.py#L449-L466 such that user-labeled instances are always added to the scene:
if instance.instance.n_visible_points > 0 or not isinstance(instance.instance, PredictedInstance):
self.view.scene.addItem(instance)
# connect signal so we can adjust QtNodeLabel positions after zoom
self.view.updatedViewer.connect(instance.updatePoints)
then the program no longer crashes.