Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux-label frames-no pictures show #142

Open
ellenalexander opened this issue Oct 10, 2024 · 4 comments
Open

linux-label frames-no pictures show #142

ellenalexander opened this issue Oct 10, 2024 · 4 comments

Comments

@ellenalexander
Copy link

there are pictures in left layer box, but why not show ?
image

@Skittles-Chen
Copy link

I have the same problem in DLC 3.0.0rc5 when I try to label new data and check some old data.

The error messages are as follows:

INFO:console:---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_qt/menus/file_menu.py:253, in FileMenu._open_folder_w_plugin(self)
251 def _open_folder_w_plugin(self):
252 """Helper method for forcing plugin choice"""
--> 253 self._win._qt_viewer._open_folder_dialog(choose_plugin=True)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_qt/qt_viewer.py:915, in QtViewer.open_folder_dialog(self, choose_plugin)
903 folder = dlg.getExistingDirectory(
904 self,
905 trans.
('Select folder...'),
(...)
911 ),
912 )
914 if folder not in {'', None}:
--> 915 self._qt_open([folder], stack=False, choose_plugin=choose_plugin)
916 update_open_history(folder)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_qt/qt_viewer.py:947, in QtViewer._qt_open(self, filenames, stack, choose_plugin, plugin, layer_type, **kwargs)
927 """Open files, potentially popping reader dialog for plugin selection.
928
929 Call ViewerModel.open and catch errors that could
(...)
944 layer type for opened layers
945 """
946 if choose_plugin:
--> 947 handle_gui_reading(
948 filenames, self, stack, plugin_override=choose_plugin, **kwargs
949 )
950 return
952 try:

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_qt/dialogs/qt_reader_dialog.py:201, in handle_gui_reading(paths, qt_viewer, stack, plugin_name, error, plugin_override, **kwargs)
199 display_name, persist = readerDialog.get_user_choices()
200 if display_name:
--> 201 open_with_dialog_choices(
202 display_name,
203 persist,
204 readerDialog._extension,
205 readers,
206 paths,
207 stack,
208 qt_viewer,
209 **kwargs,
210 )

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_qt/dialogs/qt_reader_dialog.py:294, in open_with_dialog_choices(display_name, persist, extension, readers, paths, stack, qt_viewer, **kwargs)
290 plugin_name = [
291 p_name for p_name, d_name in readers.items() if d_name == display_name
292 ][0]
293 # may throw error, but we let it this time
--> 294 qt_viewer.viewer.open(paths, stack=stack, plugin=plugin_name, **kwargs)
296 if persist:
297 if not extension.endswith(os.sep):

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/components/viewer_model.py:1092, in ViewerModel.open(self, path, stack, plugin, layer_type, **kwargs)
1089 _path = [_path] if not isinstance(_path, list) else _path
1090 if plugin:
1091 added.extend(
-> 1092 self._add_layers_with_plugins(
1093 _path,
1094 kwargs=kwargs,
1095 plugin=plugin,
1096 layer_type=layer_type,
1097 stack=_stack,
1098 )
1099 )
1100 # no plugin choice was made
1101 else:
1102 layers = self._open_or_raise_error(
1103 _path, kwargs, layer_type, _stack
1104 )

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/components/viewer_model.py:1318, in ViewerModel._add_layers_with_plugins(self, paths, stack, kwargs, plugin, layer_type)
1316 # actually add the layer
1317 with layer_source(path=filename, reader_plugin=plugin):
-> 1318 added.extend(self._add_layer_from_data(*_data))
1319 return added

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/components/viewer_model.py:1392, in ViewerModel.add_layer_from_data(self, data, meta, layer_type)
1390 try:
1391 add_method = getattr(self, 'add
' + layer_type)
-> 1392 layer = add_method(data, **(meta or {}))
1393 except TypeError as exc:
1394 if 'unexpected keyword argument' not in str(exc):

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/utils/migrations.py:59, in rename_argument.._wrapper.._update_from_dict(*args, **kwargs)
57 kwargs = kwargs.copy()
58 kwargs[to_name] = kwargs.pop(from_name)
---> 59 return func(*args, **kwargs)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/components/viewer_model.py:898, in ViewerModel.add_image(self, data, channel_axis, rgb, colormap, contrast_limits, gamma, interpolation2d, interpolation3d, rendering, depiction, iso_threshold, attenuation, name, metadata, scale, translate, rotate, shear, affine, opacity, blending, visible, multiscale, cache, plane, experimental_clipping_planes, custom_interpolation_kernel_2d)
890 raise TypeError(
891 trans._(
892 "Received sequence for argument '{argument}', did you mean to specify a 'channel_axis'? ",
(...)
895 )
896 )
897 layer = Image(data, **kwargs)
--> 898 self.layers.append(layer)
900 return layer
902 layerdata_list = split_channels(data, channel_axis, **kwargs)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/_collections_abc.py:1128, in MutableSequence.append(self, value)
1126 def append(self, value):
1127 'S.append(value) -- append value to the end of the sequence'
-> 1128 self.insert(len(self), value)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/components/layerlist.py:167, in LayerList.insert(self, index, value)
165 self._clean_cache()
166 new_layer.events.extent.connect(self._clean_cache)
--> 167 super().insert(index, new_layer)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/utils/events/containers/_selectable_list.py:66, in SelectableEventedList.insert(self, index, value)
65 def insert(self, index: int, value: _T):
---> 66 super().insert(index, value)
67 if self._activate_on_insert:
68 # Make layer selected and unselect all others
69 self.selection.active = value

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/utils/events/containers/_evented_list.py:195, in EventedList.insert(self, index, value)
193 self.events.inserting(index=index)
194 super().insert(index, value)
--> 195 self.events.inserted(index=index, value=value)
196 self._connect_child_emitters(value)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/utils/events/event.py:768, in EventEmitter.call(self, *args, **kwargs)
765 self._block_counter.update([cb])
766 continue
--> 768 self._invoke_callback(cb, event if pass_event else None)
769 if event.blocked:
770 break

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/utils/events/event.py:806, in EventEmitter._invoke_callback(self, cb, event)
804 self.disconnect(cb)
805 return
--> 806 _handle_exception(
807 self.ignore_callback_errors,
808 self.print_callback_errors,
809 self,
810 cb_event=(cb, event),
811 )

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/utils/events/event.py:793, in EventEmitter._invoke_callback(self, cb, event)
791 try:
792 if event is not None:
--> 793 cb(event)
794 else:
795 cb()

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_qt/qt_viewer.py:643, in QtViewer._on_add_layer_change(self, event)
635 """When a layer is added, set its parent and order.
636
637 Parameters
(...)
640 The napari event that triggered this method.
641 """
642 layer = event.value
--> 643 self._add_layer(layer)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_qt/qt_viewer.py:653, in QtViewer._add_layer(self, layer)
645 def _add_layer(self, layer):
646 """When a layer is added, set its parent and order.
647
648 Parameters
(...)
651 Layer to be added.
652 """
--> 653 vispy_layer = create_vispy_layer(layer)
655 # QtPoll is experimental.
656 if self._qt_poll is not None:
657 # QtPoll will call VipyBaseImage._on_poll() when the camera
658 # moves or the timer goes off.

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/vispy/utils/visual.py:97, in create_vispy_layer(layer)
95 for layer_type, visual_class in layer_to_visual.items():
96 if isinstance(layer, layer_type):
---> 97 return visual_class(layer)
99 raise TypeError(
100 trans.
(
101 'Could not find VispyLayer for layer of type {dtype}',
(...)
104 )
105 )

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_vispy/layers/image.py:90, in VispyImageLayer.init(self, layer, node, texture_format)
88 self._on_display_change()
89 self.reset()
---> 90 self._on_data_change()

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_vispy/layers/image.py:121, in VispyImageLayer._on_data_change(self)
116 if not self.layer.loaded:
117 # Do nothing if we are not yet loaded. Calling astype below could
118 # be very expensive. Lets not do it until our data has been loaded.
119 return
--> 121 self._set_node_data(self.node, self.layer._data_view)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/_vispy/layers/image.py:134, in VispyImageLayer._set_node_data(self, node, data)
132 # Check if data exceeds MAX_TEXTURE_SIZE and downsample
133 if self.MAX_TEXTURE_SIZE_2D is not None and ndisplay == 2:
--> 134 data = self.downsample_texture(data, self.MAX_TEXTURE_SIZE_2D)
135 elif self.MAX_TEXTURE_SIZE_3D is not None and ndisplay == 3:
136 data = self.downsample_texture(data, self.MAX_TEXTURE_SIZE_3D)

File ~/miniforge3/envs/DEEPLABCUT/lib/python3.10/site-packages/napari/vispy/layers/image.py:263, in VispyImageLayer.downsample_texture(self, data, MAX_TEXTURE_SIZE)
248 def downsample_texture(self, data, MAX_TEXTURE_SIZE):
249 """Downsample data based on maximum allowed texture size.
250
251 Parameters
(...)
261 Data that now fits inside texture.
262 """
--> 263 if np.any(np.greater(data.shape, MAX_TEXTURE_SIZE)):
264 if self.layer.multiscale:
265 raise ValueError(
266 trans.
(
267 "Shape of in dividual tiles in multiscale {shape} cannot exceed GL_MAX_TEXTURE_SIZE {texture_size}. Rendering is currently in {ndisplay}D mode.",
(...)
272 )
273 )

ValueError: operands could not be broadcast together with shapes (3,) (2,)

@DanielNietoC
Copy link

Same here: "ValueError: operands could not be broadcast together with shapes (3,) (2,)".

Did you manage to solve it? Thanks.

@ellenalexander
Copy link
Author

I found that close the 'deeplabcut' window and type 'napari' in terminal can solve the problem. I don't know why. Open a new napari window and chose the third one in 'plugin'(see below screenshot), then import pictures folder and config file, the panel will show the pictures and then I can label them. After training, directly 'label frame' in deeplabcut would not work for me.
My Task: Multi-animal
Deeplabcut: 2.3.10
image

@DanielNietoC
Copy link

It's annoying that the error is still present when using either GUI or Jupyter, but I was able to set the labels following your instructions. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants