GIMP Chat http://gimpchat.com/ |
|
AI Remove image background(use rembg) http://gimpchat.com/viewtopic.php?f=9&t=20041 |
Page 1 of 3 |
Author: | JamesH [ Mon Jul 25, 2022 7:49 am ] | ||
Post subject: | AI Remove image background(use rembg) | ||
First you need to successful install rembg Download the RemoveBG.py, open with text editor, find aiExe = "C:\\Users\\USER\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\rembg.exe" Replace with your own rembg path Python-fu->AI移除影像背景(AI Remove background) ... for linux flatpak gimp RemoveBG-Flatpak.zip find aiExe = "/home/jamesh/.local/bin/rembg" Replace with your own rembg path then run gimp like below flatpak run --socket=session-bus org.gimp.GIMP Test successful on ubuntu for linux AppImage gimp RemoveBG-AppImage.zip find aiExe = "/home/jamesh/.local/bin/rembg" Replace with your own rembg path Test successful on ubuntu 22.04
|
Author: | contrast_ [ Mon Jul 25, 2022 10:33 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
I am on Linux and cannot get this working. The path to REMBG I linked was Code: Select all /home/contrast/.local/bin/rembg |
Author: | contrast_ [ Mon Jul 25, 2022 10:50 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
If anyone gets this working on Linux I would like to know what they did and what version of REMBG they are using. |
Author: | nelo [ Mon Jul 25, 2022 12:31 pm ] |
Post subject: | Re: AI Remove image background(use rembg) |
I have my rembg installed using Anaconda. So I have to figure out how to start that env from within the python script first. I use rembg standalone .. without GIMP. |
Author: | Tas_mania [ Mon Jul 25, 2022 7:25 pm ] |
Post subject: | Re: AI Remove image background(use rembg) |
I used it on video clips converted to PNGs using ffmpeg. It is by no means perfect. It leaves cloudy areas on anything but clear, distinct images. The drive I had it on died. I found it works with both anaconda python and the installed python 3.9. Ubuntu 22.04 has updated to python3.10. Here are my notes for the installed python. (I think it does work on python 3.10) sudo apt install python3-pip pip install rembg python --version =3.10.4 sudo add-apt-repository ppa:deadsnakes/ppa -y sudo apt update sudo apt install python3.9 -y python3.9 --version =3.9.12 add REMBG to path. You also need to download 'models' that the AI uses to remove backgrounds. one of them is here. Copy the custom-model.pth file to ~/.u2net (thats in your home directory) I made simple scripts to process folders of PNGs. Code: Select all #!/bin/bash https://github.com/danielgatis/rembg Nelo's instructions for anaconda are here: https://www.gimp-forum.net/Thread-Remov ... G#pid22354 |
Author: | contrast_ [ Mon Jul 25, 2022 8:25 pm ] |
Post subject: | Re: AI Remove image background(use rembg) |
What do I put here to get it working on Linux? Code: Select all aiExe = "C:\\Users\\USER\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\rembg.exe" I tried REMBG, /home/contrast/.local/bin/rembg and /home/contrast/.local/bin/rembg i and none of them working. |
Author: | JamesH [ Mon Jul 25, 2022 8:55 pm ] |
Post subject: | Re: AI Remove image background(use rembg) |
i tested on my android phone(termux linux) with backgroundremover it does not need full path, maybe you can try it with aiExe = "rembg" |
Author: | Pocholo [ Mon Jul 25, 2022 9:22 pm ] |
Post subject: | Re: AI Remove image background(use rembg) |
This is for Windows but you may try it in other OS. This plugin really work. I found this plugin a few months ago at a website call "romove.bg" and sent me to download a GIMP plugin from; https://github.com/manu12121999/RemoveBG-GIMP I downloaded it and installed it, then I signed (you have to sign up) and you get a key code, to make the plugin work. Once you get the "key code", save it in your desktop with notepad. As long as you have this key, you can use the plugin and you can erase the background within the GIMP program. The photo is from https://www.krugerpark.co.za/africa_lion.html |
Author: | Issabella [ Tue Jul 26, 2022 12:41 am ] | ||
Post subject: | Re: AI Remove image background(use rembg) | ||
|
Author: | Rod [ Tue Jul 26, 2022 12:51 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
Thx for sharing. And,,,,, thank you manu12121999! Attachment: Star-for-manu12121999-2022-07-26_014500.jpg [ 227.04 KiB | Viewed 38762 times ] |
Author: | Jappaloe63 [ Tue Jul 26, 2022 1:11 am ] | ||
Post subject: | Re: AI Remove image background(use rembg) | ||
I've been waiting a long time for that. Great, thank you!
|
Author: | Rod [ Tue Jul 26, 2022 1:13 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
You can call me impressed. Any time you need to remove white bg from very white hair it's darn near impossible. Before rembg Attachment: before-rembg-2022-07-26_020452.jpg [ 66.13 KiB | Viewed 37891 times ] After rembg Attachment: After-rembg-2022-07-26_020552.jpg [ 75.61 KiB | Viewed 37891 times ] How the heck does it know what's bg or fg? It just runs and works like magic And i love the fact that it's non destructive utilizing a mask. |
Author: | mahvin [ Tue Jul 26, 2022 1:57 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
Peter Falkingham said it best. https://peterfalkingham.com/2021/07/19/ ... d-remover/ I need to buy a new laptop and convert this current one to Linux so I can get some serious playtime in. |
Author: | contrast_ [ Tue Jul 26, 2022 7:40 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
My main problem has to do with the fact that I use a Flatpak Gimp. Does anyone know how to edit the script and change it to support flatpak gimp's directory? |
Author: | MareroQ [ Tue Jul 26, 2022 11:29 am ] | ||
Post subject: | Re: AI Remove image background(use rembg) | ||
JamesH he wrote shortly: First you need to successful install rembg. For Windows, this is not too complicated, but with a few surprises. I will share my experience of installing rembg.exe in Windows 10_64bit. I tried to compile in msys64 - unfortunately without success (lots of bugs to analyze - although the use of msys64 seems not to be considered eg.: AttributeError: 'MSVCCompiler'). So I installed python-3.9.7-amd64.exe and then: C: \ Python39> python.exe -m pip install rembg Successfully installed: PySocks-1.7.1 PyWavelets-1.3.0 aiohttp-3.8.1 aiosignal-1.2.0 anyio-3.6.1 asgiref-3.5.2 async-timeout-4.0.2 asyncer-0.0.1 attrs-21.4.0 beautifulsoup4-4.11.1 certifi-2022.6.15 charset-normalizer-2.1.0 click-8.0.3 colorama-0.4.5 fastapi-0.72.0 filelock-3.7.1 filetype-1.0.9 flatbuffers-2.0 frozenlist-1.3.0 gdown-4.4.0 h11-0.13.0 idna-3.3 imageio-2.20.0 llvmlite-0.38.1 multidict-6.0.2 networkx-2.8.5 numba-0.55.2 numpy-1.22.3 onnxruntime-1.10.0 packaging-21.3 pillow-9.0.1 protobuf-4.21.3 pydantic-1.9.1 pymatting-1.1.5 pyparsing-3.0.9 python-multipart-0.0.5 rembg-2.0.21 requests-2.28.1 scikit-image-0.19.1 scipy-1.8.0 six-1.16.0 sniffio-1.2.0 soupsieve-2.3.2.post1 starlette-0.17.1 tifffile-2022.5.4 tqdm-4.62.3 typing-extensions-4.3.0 urllib3-1.26.11 uvicorn-0.17.0 watchdog-2.1.7 yarl-1.7.2 After correcting the path in RemoveBG.py, I ran the plugin. Another surprise: So I installed: I restarted it and surprise again: It only uses the model u2net.onnx (A pre-trained model for general use cases) - I don't know how to change it, for example: u2net_human_seg.onnx (A pre-trained model for human segmentation). The result leaves little illusion, so I agree with Tas_mania opinion: It is by no means perfect. However, there is a mask for corrections - so thanks to JamesH for thinking about it. Also, the installation method is probably not encouraging for the majority of users.
|
Author: | nelo [ Tue Jul 26, 2022 1:30 pm ] |
Post subject: | Re: AI Remove image background(use rembg) |
MareroQ wrote: It only uses the model u2net.onnx (A pre-trained model for general use cases) - I don't know how to change it, for example: u2net_human_seg.onnx (A pre-trained model for human segmentation). I guess it could be something like this (found somewhere on that site) Add a custom model Copy the custom-model.pth file to ~/.u2net and run: Code: Select all rembg -m custom-model > output.png Probably replace by the name of the model. So: Code: Select all rembg -m u2net_human_seg > output.png Maybe you have to download the model in question first and place it in that u2net folder. |
Author: | wirra [ Wed Jul 27, 2022 6:35 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
Thanks Pocholo for the Windows version. It is amazing. |
Author: | Tas_mania [ Sat Jul 30, 2022 2:15 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
I came across DIS (Dichotomous Image Segmentation). It could be a developed version of REMBG. I may try it because this team also developed the U2-Net models used by REMBG. Training neural networks appears to be a rapidly developing industry ATM. The gif above is a Gimp-reduced one from their project page. |
Author: | Pat625 [ Sat Jul 30, 2022 5:53 am ] |
Post subject: | Re: AI Remove image background(use rembg) |
You did all of that with Gimp? Really nice! |
Author: | Pocholo [ Sat Jul 30, 2022 9:45 pm ] |
Post subject: | Re: AI Remove image background(use rembg) |
wirra wrote: Thanks Pocholo for the Windows version. It is amazing. You're welcome, wirra! It's so much simpler the one I posted for simple Windows users. |
Page 1 of 3 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |