Giter VIP home page Giter VIP logo

napari-segment-anything's People

Contributors

ajinkya-kulkarni avatar jookuma avatar kephale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

napari-segment-anything's Issues

OMP: Error #15: Initializing libiomp5.dylib

Platform:
OSX Ventura 13.3 (22E252)

Conda env:

name: test_env
channels:
  - conda-forge
dependencies:
  - python=3.9
  - nomkl
  - ca-certificates
  - openssl
  - napari
  - pip:
      - filelock==3.12.0
      - mpmath==1.3.0
      - napari-segment-anything==0.1.4
      - segment-anything==1.0
      - sympy==1.12
      - torch==2.0.1
      - torchvision==0.15.2

When installing napari alongside the latest pip install git+https://github.com/jookuma/napari-segment-anything.git I get the following error when trying to open the widget.

OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

Tried to find similar issues and recomment conda install nomkl but for me does not seem to work either.

Support for editing existing labels

Hi there,

I'm just trying out your plugin and it very nicely works when no segmentations are available. I was wondering if there is any support (or further interest to implement this) for having the "SAM box" and "SAM points" layers operate on existing labels layers whenever a segmentation mask is already available and needs to be slightly corrected?

Thanks,
Christina

Discontinuity working with SAM labels

Hi there,

thanks for this great plugin. I have noticed that when I change the model, all previously created labels are deleted from the SAM labels layer. It would be great to be able to continue working on a previously created labels layer.

napari error: Could not load the Qt platform plugin "xcb" in "" even though it was found. - cannot connect to display

Hi thanks for the interesting project, I am running this from my local computer connected to a remote server. When I try to run napari, it gives the error: Could not load the Qt platform plugin "xcb" in "" even though it was found. and when in debug says cannot connect to display. I tried with both pyqt5 and pyside2. I also tried solutions https://forum.image.sc/t/cant-open-napari-with-jupyter-and-vs-code-module-napari-has-no-attribute-viewer-runtimeerror-no-qt-app-has-been-created/71353/3, https://github.com/NVlabs/instant-ngp/discussions/300 and more but could not resolve it yet. Could you please help about this. Thank you.

ValueError: Only 2D images supported. Got 3-dim image

Traceback (most recent call last):
File "C:\conda\envs\yolov5\lib\runpy.py", line 194, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\conda\envs\yolov5\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\conda\envs\yolov5\Scripts\napari.exe_main
.py", line 7, in
File "C:\conda\envs\yolov5\lib\site-packages\napari_main
.py", line 561, in main
run()
File "C:\conda\envs\yolov5\lib\site-packages\napari_main
.py", line 370, in _run
first_dock_widget = viewer.window.add_plugin_dock_widget(
File "C:\conda\envs\yolov5\lib\site-packages\napari_qt\qt_main_window.py", line 717, in add_plugin_dock_widget
wdg = _instantiate_dock_widget(
File "C:\conda\envs\yolov5\lib\site-packages\napari_qt\qt_main_window.py", line 1365, in _instantiate_dock_widget
return wdg_cls(**kwargs)
File "C:\conda\envs\yolov5\lib\site-packages\napari_segment_anything_widget.py", line 91, in init
self._model_type_widget.changed.emit(model_type)
File "src\psygnal_signal.py", line 927, in emit
File "src\psygnal_signal.py", line 974, in _run_emit_loop
psygnal._exceptions.EmitLoopError: calling <psygnal._weak_callback._WeakMethod object at 0x000001FA4574BB40> with args=('default',) caused ValueError: Only 2D images supported. Got 3-dim image..

Exited as it showed. Why is 3-dim image not supported?

MPS framework error

Hey Jordão, thanks for this plugin, I'm excited to try it!

At the moment I'm getting the below error when I press Auto. Segm.

EmitLoopError: calling <psygnal._weak_callback._WeakMethod object at 0x16e052160> with args=(False,) caused TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead..

Napari "quits unexpectedly" when trying to start the plugin

Sonoma 14.4
M3 Max

Tried running this in three different conda envs, with both the dev version and standard version. One of the envs is a completely clean env with only Napari and napari-segment-anything installed.

When I click on the plugin in the plugin dropdown, Napari shuts down with the error message in the clean env being:

/opt/homebrew/Caskroom/miniforge/base/envs/napari-sam/lib/python3.10/site-packages/napari/components/viewer_model.py:10: FutureWarning: Labels.color is deprecated since 0.4.19 and will be removed in 0.5.0, please set Labels.colormap directly with an instance of napari.utils.colormaps.DirectLabelColormap instead.!

But that warning does seem to have anything to do with the closing of Napari as far as I can tell.

How deploy it when I have downloaded

Thanks to the author for open source, but I still don't quite understand how to use this code to get the interface SAM, can you give instructions in the readme, thank you very much

error message

Hi,
I managed to run the SAM in my napari but whenever I want to open an image I get the following error message: "invalid value encountered in cast"
I there something I can change to get rid of this error?
Thanks!

Trying out MedSAM

Hi there,

I wanted to try out MedSAM in your Napari plugin, and the cheapest way was to download their model checkpoint, renaming it to sam_vit_b_01ec64.pth and replacing that file in the .cache/napari-segment-anything folder. Of course, one has to first select the vit_b model in the plugin widget such that it appears in the folder.

So this is more of a feature request. Allow users to try out other SAM checkpoints by being able to choose a model checkpoint location via the widget.

[issue] clicking error when labeling 3D image data

hi, thanks for your amazing work on this convenient plugin.
I want to use it to label some structures of knee in 3D MR images. There is no problem in handling single or very few images. However, when I import the normal series images and follow the routine, the first click will be ok, but the following click will lead to the sudden enlargement of image numbers and the labeling won't work anymore. It will be great if you figure it out. Thanks!

Export Question

Nice plugin, seems to work quite well. After getting the SAM Label layer how is this data exported to json or csv file? Is there another plugin used for that?

Suggestion - Integrate MobileSAM into the pipeline for lightweight and faster inference

Reference: https://github.com/ChaoningZhang/MobileSAM

Our project performs on par with the original SAM and keeps exactly the same pipeline as the original SAM except for a change on the image encode, therefore, it is easy to Integrate into any project.

MobileSAM is around 60 times smaller and around 50 times faster than original SAM, and it is around 7 times smaller and around 5 times faster than the concurrent FastSAM. The comparison of the whole pipeline is summarzed as follows:

image

image

Best Wishes,

Qiao

Error when closing and re-opening the plugin

Hi @JoOkuma ,

I'm getting an error when I open, close and re-open the plugin. The error is this:

        self = <Container ()>
     97 self._viewer.bind_key("X", self._cancel_annot)

File ~\Anaconda3\envs\pytorch\lib\site-packages\napari\utils\key_bindings.py:286, in bind_key(keymap={'C': <bound method SAMWidget._on_confirm_mask of <Container ()>>, 'X': <bound method SAMWidget._cancel_annot of <Container ()>>}, key='C', func=<bound method SAMWidget._on_confirm_mask of <Container ()>>, overwrite=False)
    283     key = normalize_key_combo(key)
    285 if func is not None and key in keymap and not overwrite:
--> 286     raise ValueError(
        trans = <napari.utils.translations.TranslationBundle object at 0x000002265A114730>
        key = 'C'
    287         trans._(
    288             'key combination {key} already used! specify \'overwrite=True\' to bypass this check',
    289             deferred=True,
    290             key=key,
    291         )
    292     )
    294 unbound = keymap.pop(key, None)
    296 if func is not None:

ValueError: key combination C already used! specify 'overwrite=True' to bypass this check

To reproduce:

Open the plugin in napari, close it again, and re-open it.

Fix

The error message points to this line in the code. Adding an overwrite=True to this line fixes it.

PR coming :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.