GIMP Chat
http://gimpchat.com/

REMBG - an open source offline usable background removal AI
http://gimpchat.com/viewtopic.php?f=22&t=19930
Page 1 of 1

Author:  contrast_ [ Mon May 16, 2022 9:20 pm ]
Post subject:  REMBG - an open source offline usable background removal AI

https://github.com/devlovers-id/sapulatar-qt
https://github.com/danielgatis/rembg

Image

This is my magic tool that banishes the Creative Cloud.

Author:  Tas_mania [ Tue May 17, 2022 2:50 am ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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.

Author:  mahvin [ Tue May 17, 2022 8:25 am ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

You can use and call GEGL in the command line, though.

Author:  Tas_mania [ Tue May 17, 2022 5:55 pm ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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.

Author:  mahvin [ Tue May 17, 2022 10:02 pm ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

I never said it was pretty. And it's even harder, because unlike GMIC, it has absolutely NO (ZERO) documentation, to boot.

Author:  Tas_mania [ Wed May 18, 2022 3:54 am ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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' :)

Author:  Tas_mania [ Thu May 19, 2022 12:27 am ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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.

Author:  racer-x [ Thu May 19, 2022 4:46 am ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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 8337 times ]


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

Author:  nelo [ Thu May 19, 2022 9:03 am ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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.

Author:  Tas_mania [ Thu May 19, 2022 7:21 pm ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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. :)

Author:  racer-x [ Fri May 20, 2022 4:36 am ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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/

Author:  Tas_mania [ Sat May 21, 2022 3:51 am ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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.

Author:  Tas_mania [ Sat May 21, 2022 7:01 pm ]
Post subject:  Re: REMBG - an open source offline usable background removal AI

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

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/