DeepLabCut / napari-deeplabcut

a napari plugin for labeling and refining keypoint data within DeepLabCut projects
GNU Lesser General Public License v3.0
52 stars 23 forks source link

Issue with refining labels, keypoints don't switch to other bodyparts RuntimeError: x must be a sequence #130

Closed lillysanchez closed 5 months ago

lillysanchez commented 6 months ago

@MMathisLab @jeylau I'm seeing the exactly the same problem on the main branch. as The problem only occurs on the revise_labels step where there is no way to change key points (body parts). I've attempted to use m and f keys to select different body parts, but neither key changed the body part labels.

The same issue has arisen before, but In my case updating to napari-deeplabcut@0.2.1.3 didn't fix it.

In the 'key point controls' panel, under 'labeling mode', there is no key point selection.

Is it simply that the key point selection window is hidden?

Relevant package versions:

jeylau commented 6 months ago

Hi @lillysanchez, could you share a screenshot of what the GUI looks like? You normally find a dropdown menu with the keypoint labels at the bottom right. You could also try installing the newest version: 0.2.1.6; 0.2.1.3 was released last December, and many improvements have been made since.

SurainSaigal commented 5 months ago

@jeylau

I believe I am having the same issue as @lillysanchez. They are the same issues as originally linked to, where I'm missing the keypoint selection window in the keypoint controls, but this is only occurring in the revise_labels step. I originally ran into this issue because I had finished labeling about half of the frames in a video, saved my work, closed deeplabcut, and then reopened my project at a later time to continue labeling. At this point, I selected "label frames" and then selected the folder with the frames (which now contained the *.h5 file), and my napari window looks like this:

Screenshot 2024-05-30 at 6 32 46 PM

There are no keypoint selection controls, and I can't change which point is being labeled currently. When the window initially launches, the controls are visible for a brief second before disappearing. I am also getting the following error output in the terminal:

Traceback (most recent call last): File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/deeplabcut/gui/tabs/label_frames.py", line 59, in labelframes = launch_napari(folder) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/deeplabcut/gui/widgets.py", line 45, in launch_napari viewer.open(files, plugin="napari-deeplabcut") File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/components/viewer_model.py", line 1092, in open self._add_layers_with_plugins( File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/components/viewer_model.py", line 1318, in _add_layers_with_plugins added.extend(self._add_layer_from_data(*_data)) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/components/viewer_model.py", line 1392, in _add_layer_from_data layer = add_method(data, **(meta or {})) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/components/viewer_model.py", line 5, in add_points import os File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/_collections_abc.py", line 1073, in append self.insert(len(self), value) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/components/layerlist.py", line 167, in insert super().insert(index, new_layer) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/utils/events/containers/_selectable_list.py", line 66, in insert super().insert(index, value) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/utils/events/containers/_evented_list.py", line 195, in insert self.events.inserted(index=index, value=value) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/utils/events/event.py", line 768, in call self._invoke_callback(cb, event if pass_event else None) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/utils/events/event.py", line 806, in _invoke_callback _handle_exception( File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari/utils/events/event.py", line 795, in _invoke_callback cb() File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari_deeplabcut/_widgets.py", line 517, in _load_dataframe self._refresh_canvas(value=self._n) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/napari_deeplabcut/_widgets.py", line 529, in _refresh_canvas self.vline.set_xdata(value) File "/opt/anaconda3/envs/DEEPLABCUT/lib/python3.9/site-packages/matplotlib/lines.py", line 1289, in set_xdata raise RuntimeError('x must be a sequence') RuntimeError: x must be a sequence

If I remove the .h5 file (which also removes all previous labeled points) from the folder and relaunch the frame label window, everything is back to normal (and there are no errors in the terminal), as shown below:

Screenshot 2024-05-30 at 6 30 14 PM

There are also other differences between these two screenshots, specifically in the layer controls menu. I also tried launching napari straight from the terminal rather than from within the DLC GUI and ran into the same issue.

I am using an intel Macbook and the latest version of napari-deeplabcut. Here is my terminal output for "napari --info":

Screenshot 2024-05-30 at 6 54 11 PM