It is currently Mon Jul 01, 2024 10:30 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: REMBG - an open source offline usable background removal AI
PostPosted: Mon May 16, 2022 9:20 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
https://github.com/devlovers-id/sapulatar-qt
https://github.com/danielgatis/rembg

Image

This is my magic tool that banishes the Creative Cloud.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Tue May 17, 2022 2:50 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
This looks interesting. Convert a short clip of a human being walking into a folder of PNGs using ffmpeg. Then use REMBG on every PNG. Then apply a 'make people metal' filter on each PNG so it looks like a robot walking.

Oh that's right you can't because GEGL-graph is not a command line app and its also pretty buggy.


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Tue May 17, 2022 8:25 am  (#3) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
You can use and call GEGL in the command line, though.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Tue May 17, 2022 5:55 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
Quote:
You can use and call GEGL in the command line, though.


gegl --list-all (the list of filters)
gegl --info gegl:crop (the operations for each filter)
https://gegl.org/operations/ (the online list)

Unfortunately many of the filters and operations don't work in gegl graph. The online list often doesn't work in both gegl graph or gegl cli.
So using gegl cli is like assembly programing.

G'MIC cli is not easy to use but GEGL cli is very hard to use. I have processed a video clip with gegl cli.


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Tue May 17, 2022 10:02 pm  (#5) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
I never said it was pretty. And it's even harder, because unlike GMIC, it has absolutely NO (ZERO) documentation, to boot.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Wed May 18, 2022 3:54 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
If anyone is interested gegl lens works pretty good in gegl graph.
Try this:
apply-lens refraction-index=1.4 keep-surroundings=true

Turn the refraction index up or down and change 'keep-surroundings' to false.
I just used it on over 600 frames and all good. It seems to need no alpha channel but as mahvin said 'no manual' :)


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Thu May 19, 2022 12:27 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
Installed REMBG and I can say it's not trivial. It uses many python packages to assemble a python-torch-artificial-intelligence stack. Luckily I had a spare hdd and some experience with neural networks.

On Ubuntu 'jammy' I had to install an earlier python 3.9. Then you need a 'model' file from a google drive and the developers git page has a command to remove the background from a png and it doesn't work.
Anyway it can be made to work. This is my first attempt with a difficult image.

Image

Image

That's pretty cool I think. I didn't use the gui 'sapulatar-qt' because I don't think I need it. I will try this on a png vid series.


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Thu May 19, 2022 4:46 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
I've been playing with rembg as well. It's not perfect, but pretty darn good just the same...

Attachment:
in.jpg
in.jpg [ 253.41 KiB | Viewed 8319 times ]


Attachment:
out.png
out.png [ 708.23 KiB | Viewed 8319 times ]


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Thu May 19, 2022 9:03 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
A while ago I've posted my rembg setup on gimp-forum.net using anaconda here
https://www.gimp-forum.net/Thread-Remov ... 4#pid22354.
It's done on a linux mint machine. Still runs fine, have to use the nouveau graphics driver though as the nvidia one throws errors. But I can live with that.

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Thu May 19, 2022 7:21 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
Hi racer-x. That rembg worked very well on the bird. I like the way it included a branch in the foreground.

Hi nelo. Interesting what you did with anaconda. Here is a simple script that does all the PNGs in a folder and puts them in a subfolder.

#!/bin/bash
mkdir ./done
rembg --p ./ ./done/


Save as 'REMBGfolder.sh' make it exe and run like this: ./REMBGfolder.sh

rembg gives a nice progress bar when running the script. On this box it tells me it's using python 3.10 but it still works OK. Some edges are a bit fuzzy and it misses content here and there but it's possible to enhance the images first. It's surprisingly fast as well. :)


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Fri May 20, 2022 4:36 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
Thanks Tas for posting the batch script. It doesn't work here as it is written, but this edited one does.
#!/bin/bash
mkdir ./done
rembg p ./ ./done/


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Sat May 21, 2022 3:51 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
Hi racer, the P (path) seems different on different systems. I experimented a bit today. I installed anaconda following nelo's excellent instructions. Its good to have a python in your local directory and turn it on and off. I went back to the original because it works the same. This system seems to be using python 3.10 and its backward compatible. (so far)

I tried a different 'model' that I got from here. Looks like the models are quite targetted. I tried the 'human segment' model that is probably good for human forms but not so good for hair. There are also 'portrait' and 'cloth' models that I haven't used. They all go in /.u2net/

This is the batch script I used for the models.

#!/bin/bash
mkdir ./done
rembg -m u2net_human_seg -p ./ ./done/


You will have to change the 'p' to suit your system.


Top
 Post subject: Re: REMBG - an open source offline usable background removal AI
PostPosted: Sat May 21, 2022 7:01 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1365
Trying to choose a model file that suits the content. This surfer girl clip is matched with the human segment model file. I did over 600 frames and not all are top quality but here is what it can do.

Image

Image


Top
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) tgen texture generator - open source offline usable web app

1

No new posts Attachment(s) AI Remove image background(use rembg)

49

No new posts Attachment(s) GEGL Simple Background Removal Tool (by color range)

1

No new posts Sandboxie, soon, will be going Open Source.

7

No new posts I'm bored of open source graphic design

0



* Login  



Powered by phpBB3 © phpBB Group