Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plugin to integrate Gimp with Meta Segment Anything
#16
(11-08-2023, 09:42 AM)LeafAtWood Wrote:
(11-07-2023, 03:49 AM)LeafAtWood Wrote: Thanks khemadeva for the plugin, though I am having trouble registering it with my GIMP 2.10 on macOS 10.15.7. I have run your install validation script (/path/to/python3/python ./seganybridge.py vit_h /path/to/checkpoint/model/sam_vit_h_4b8939.pth) and got a Success. I have put the seganybridge.py and seganyplugin.py in the /Users/me/Library/Application Support/GIMP/2.10/plug-ins repository. I also changed the mode so that these files are executable (chmod 777). Made sure I restarted GIMP. I also made sure SAM was properly installled by running the script amg.py from the SAM github and generated the segmentation masks. So seems my only trouble is registering your plugin with GIMP. Do you have any idea why it is not registering with GIMP and would you know of any way to check/debug the registration process ?

I have relayed the news on my Deep_in_Depth twitter channel : https://twitter.com/Deep_In_Depth/status...9651147837

Fixed the "registration issue" by just adding the following line to the top of each file seganybridge.py and seganyplugin.py
#!/usr/bin/env python

There also seem to be a problem with the default plug-ins path on macOS: /Users/me/Library/Application Support/GIMP/2.10/plug-ins   due to the space in the path 

When the seganyplugin.py calls the seganybridge.py it looks like this:
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 /Users/efe/Library/Application Support/GIMP/2.10/plug-ins/seganybridge.py vit_h /Users/me/DeepInDepth/SAM/sam_vit_h_4b8939.pth /var/folders/38/hws16c9j0qbfm9_r3t900slw0000gn/T/__seg__7Szrd4.png Auto Multiple /var/folders/38/hws16c9j0qbfm9_r3t900slw0000gn/T/__seg__mask__ True

should be:
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3[i] "/Users/efe/Library/Application Support/GIMP/2.10/plug-ins/seganybridge.py" [/i]vit_h /Users/me/DeepInDepth/SAM/sam_vit_h_4b8939.pth /var/folders/38/hws16c9j0qbfm9_r3t900slw0000gn/T/__seg__7Szrd4.png Auto Multiple /var/folders/38/hws16c9j0qbfm9_r3t900slw0000gn/T/__seg__mask__ True

Even with that change the seganybridge.py does not start. Bizarre!
Hello @LeafAtWood I have modified the script on github to accept spaces in the directory, please use the new script. Here are a couple other things to note 1) Make sure the segment-anything folder you created with git clone is in the PYTHONPATH 2) Check the python version from Python-Fu console, it should be 2.7.x. The script will run with only python2 since, to my knowledge, GIMP 2.10 has not yet upgraded to python3. Please let me know if you still face any issues.
Reply


Messages In This Thread
RE: Plugin to integrate Gimp with Meta Segment Anything - by khemadeva - 11-20-2023, 05:45 AM

Forum Jump: