Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plugin to integrate Gimp with Meta Segment Anything
#1
I have created a plugin, which allows users to isolate objects within a raster image inside GIMP using Meta Segment Anything.
Please feel free to download and use if you find it useful.

Here are the links:

Github Repo

Video Tutorial
Reply
#2
I read the installing instructions and I Installed Python3, copied both .py files in the gimp plugins folder and got these errors. I don't know what/where I have to find something in the 'Checkpoint Path' . Any suggestions? Thanks in advance.
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpbokeh_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpbevel_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpaction-lines_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\Python3\python.exe
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:336: GtkWarning: Could not find the icon 'K:\Setup.exe,0'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
        http://icon-theme.freedesktop.org/releases
  pythonFileBtn = gtk.FileChooserButton('Select File')
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:387: Warning: value "0" of type 'guint' is invalid or out of range for property 'n-rows' of type 'guint'
  table = gtk.Table(0, 0, False)
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:387: Warning: value "0" of type 'guint' is invalid or out of range for property 'n-columns' of type 'guint'
  table = gtk.Table(0, 0, False)
Reply
#3
(10-07-2023, 12:20 PM)denzjos Wrote: I read the installing instructions and I Installed Python3, copied both .py files in the gimp plugins folder and got these errors. I don't know what/where I have to find something in the 'Checkpoint Path' . Any suggestions? Thanks in advance.
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpbokeh_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpbevel_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpaction-lines_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\Python3\python.exe
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:336: GtkWarning: Could not find the icon 'K:\Setup.exe,0'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
        http://icon-theme.freedesktop.org/releases
  pythonFileBtn = gtk.FileChooserButton('Select File')
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:387: Warning: value "0" of type 'guint' is invalid or out of range for property 'n-rows' of type 'guint'
  table = gtk.Table(0, 0, False)
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:387: Warning: value "0" of type 'guint' is invalid or out of range for property 'n-columns' of type 'guint'
  table = gtk.Table(0, 0, False)

You can Ignore the "Two different plugins tried to register.." warning message (I also get them, they occur because of duplicate gegl functions). Also the GtkWarning doesn't seem serious. Were you able to install Segment Anything local instance properly? There is a section in the video to test this instance. You need to run the bridge script (seganybridge.py) to check if the Segment Anything setup is working on your machine. Please have a look at the video tutorial (https://youtu.be/xyuSe0SaMHk). Also check the video description for link to Segment Anything github repo and the exact command to test the local instance. Please let me know if you still face any issue with installation.
Reply
#4
(10-07-2023, 12:56 PM)khemadeva Wrote:
(10-07-2023, 12:20 PM)denzjos Wrote: I read the installing instructions and I Installed Python3, copied both .py files in the gimp plugins folder and got these errors. I don't know what/where I have to find something in the 'Checkpoint Path' . Any suggestions? Thanks in advance.
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpbokeh_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpbevel_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\GIMP 2\lib\gimp\2.0\python/gimpfu.py:868: Warning: Two different plugins tried to register 'GeglOpaction-lines_c'.
  gimp.main(None, None, _query, _run)
D:\Program Files\Python3\python.exe
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:336: GtkWarning: Could not find the icon 'K:\Setup.exe,0'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
        http://icon-theme.freedesktop.org/releases
  pythonFileBtn = gtk.FileChooserButton('Select File')
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:387: Warning: value "0" of type 'guint' is invalid or out of range for property 'n-rows' of type 'guint'
  table = gtk.Table(0, 0, False)
C:\Users\name\AppData\Roaming\GIMP\2.10\plug-ins\seganyplugin.py:387: Warning: value "0" of type 'guint' is invalid or out of range for property 'n-columns' of type 'guint'
  table = gtk.Table(0, 0, False)

You can Ignore the "Two different plugins tried to register.." warning message (I also get them, they occur because of duplicate gegl functions). Also the GtkWarning doesn't seem serious. Were you able to install Segment Anything local instance properly? There is a section in the video to test this instance. You need to run the bridge script (seganybridge.py) to check if the Segment Anything setup is working on your machine. Please have a look at the video tutorial (https://youtu.be/xyuSe0SaMHk). Also check the video description for link to Segment Anything github repo and the exact command to test the local instance. Please let me know if you still face any issue with installation.

@khemadeva, thank you for your answer. I read the installing readme.md files and looked a few times at the video but I can't install the other files mentioned in the video properly on my windows OS computer.  I could be wrong, but if I look to the installing details, I think this plugin is something only for linux operating systems. Maybe someone with a windows OS find way use this plugin. Thank's
Reply
#5
Ninjas

I was just going to share this information on this forum, but I arrived too late. :-)

Anyway, I'll post it anyway.  Rolleyes

===============================================================================


I found it interesting but the installation part was too complicated for me.
Still, I share it here for those who might find this plugin for selection/cutting using Gimp interesting.

https://youtu.be/xyuSe0SaMHk?si=hK5_Z0CRatgG5EQI - Free Plugin: GIMP Integration With Meta Segment Anything
                               .....
Samj PortableGimp 2.10.28 - Win-10 /64.
Reply
#6
(10-07-2023, 05:11 PM)denzjos Wrote: @khemadeva, thank you for your answer. I read the installing readme.md files and looked a few times at the video but I can't install the other files mentioned in the video properly on my windows OS computer.  I could be wrong, but if I look to the installing details, I think this plugin is something only for linux operating systems. Maybe someone with a windows OS find way use this plugin. Thank's

Hello @denzjos
This plugin is supposed to work with all the OS's which GIMP can be installed on. However, I have tested it with Linux only because that's the only OS I have access to currently. But the code is written in a generic way, there are no Linux specific calls. 
I can help you with the installation. You need to first install Meta Segment Anything, which is a tool from meta. 

As mentioned in the video, the Segment Anything github page is: https://github.com/facebookresearch/segment-anything. Check for the Installation section on the page. 

As prerequisites, you just need to install pytorch and torchvision for Windows (https://pytorch.org/get-started/locally/) and then:
pip install git+https://github.com/facebookresearch/segment-anything.git

Download the checkpoint files from https://github.com/facebookresearch/segm...heckpoints

Once you are done with this you can follow instructions from the video to test the Segment Anything installation and plugin installation.
Do let me know if you face any issues or stuck at any step.

(10-07-2023, 11:25 PM)Krikor Wrote: Ninjas

I was just going to share this information on this forum, but I arrived too late. :-)

Anyway, I'll post it anyway.  Rolleyes

===============================================================================


I found it interesting but the installation part was too complicated for me.
Still, I share it here for those who might find this plugin for selection/cutting using Gimp interesting.

https://youtu.be/xyuSe0SaMHk?si=hK5_Z0CRatgG5EQI - Free Plugin: GIMP Integration With Meta Segment Anything

Thanks @Krikor

Please check my response denzjos. The installation is not as complicated as it seems. You might want to give it a try. I can help you if you are stuck at any step.
Reply
#7
@khemadeva, I have a problem with this below to install it in windows. I unzipped the file and I tried to install it with python3 and it seems that nothing happens.
   
Reply
#8
(10-08-2023, 06:42 AM)khemadeva Wrote:
(10-07-2023, 05:11 PM)denzjos Wrote: @khemadeva, thank you for your answer. I read the installing readme.md files and looked a few times at the video but I can't install the other files mentioned in the video properly on my windows OS computer.  I could be wrong, but if I look to the installing details, I think this plugin is something only for linux operating systems. Maybe someone with a windows OS find way use this plugin. Thank's

Hello @denzjos
This plugin is supposed to work with all the OS's which GIMP can be installed on. However, I have tested it with Linux only because that's the only OS I have access to currently. But the code is written in a generic way, there are no Linux specific calls. 
I can help you with the installation. You need to first install Meta Segment Anything, which is a tool from meta. 

As mentioned in the video, the Segment Anything github page is: https://github.com/facebookresearch/segment-anything. Check for the Installation section on the page. 

As prerequisites, you just need to install pytorch and torchvision for Windows (https://pytorch.org/get-started/locally/) and then:
pip install git+https://github.com/facebookresearch/segment-anything.git

Download the checkpoint files from https://github.com/facebookresearch/segm...heckpoints

Once you are done with this you can follow instructions from the video to test the Segment Anything installation and plugin installation.
Do let me know if you face any issues or stuck at any step.

(10-07-2023, 11:25 PM)Krikor Wrote: Ninjas

I was just going to share this information on this forum, but I arrived too late. :-)

Anyway, I'll post it anyway.  Rolleyes

===============================================================================


I found it interesting but the installation part was too complicated for me.
Still, I share it here for those who might find this plugin for selection/cutting using Gimp interesting.

https://youtu.be/xyuSe0SaMHk?si=hK5_Z0CRatgG5EQI - Free Plugin: GIMP Integration With Meta Segment Anything

Thanks @Krikor

Please check my response denzjos. The installation is not as complicated as it seems. You might want to give it a try. I can help you if you are stuck at any step.

There are no "shebang" in your python files, how does the OS know how to run the files? Especially since one is for V2 and the other for v3?

In addition be wary of print instructions. When the process runs on Windows, there is nothing to read stdout, so this output accumulates in a buffer and when it reach some threshold (4K?), the print instruction waits for some space in the buffer, which never happens, so your code hangs.
Reply
#9
(10-08-2023, 09:07 AM)denzjos Wrote: @khemadeva, I have a problem with this below to install it in windows. I unzipped the file and I tried to install it with python3 and it seems that nothing happens.

Hi @denzjos

Please refer to the install instructions of Segment Anything. You are not supposed to run setup.py but execute the following commands:

cd segment-anything
pip install -e .

But before installing segment anything you need to first install pytorch and torchvision.

Please check https://pytorch.org/get-started/locally/
Here you will get the instructions to install pytorch and torchvision on windowns.

Hi @ofnuts

Thanks for your inputs. The shebang won't be required in this case as GIMP executes the script using the built-in python interpreter. Similarly the bridge script is executed internally using the python interpreter selected by the user in the plugin dialog.

Will see check the alternatives for print. I wanted to show some kind of indication that the tool is working becasue the operation may take longer to complete in some cases.
Reply
#10
Installed CUDA (coffee time.............). Got this error after trying to install PyTorch on the windows command line : Can't find pip3. Please control if you used the right name and try again.
   
Reply


Forum Jump: