rembg icon indicating copy to clipboard operation
rembg copied to clipboard

[FEATURE] Remove PNG images sequence? (bulk)

Open AlonDan opened this issue 3 years ago • 5 comments

Currently I could only succeed remove 1 image per time: JPG or PNG

If there is already such feature I may missed via latest updates, please explain how to use / what are the parameters? If it's not there yet, please consider to add it + explain how to use, it will be great to try!

Maybe BULK based on ALL FILES in directory path So it won't care about the naming of the files, even it's not a sequence images it will be nice to just export multiple images at once.

Thanks ahead!

AlonDan avatar Sep 06 '22 21:09 AlonDan

Usage: rembg p [OPTIONS] INPUT OUTPUT

  for a folder as input

Options:
  -m, --model [u2net|u2netp|u2net_human_seg|u2net_cloth_seg]
                                  model name  [default: u2net]
  -a, --alpha-matting             use alpha matting
  -af, --alpha-matting-foreground-threshold INTEGER
                                  trimap fg threshold  [default: 240]
  -ab, --alpha-matting-background-threshold INTEGER
                                  trimap bg threshold  [default: 10]
  -ae, --alpha-matting-erode-size INTEGER
                                  erode size  [default: 10]
  -om, --only-mask                output only the mask
  -ppm, --post-process-mask       post process the mask
  -w, --watch                     watches a folder for changes
  --help                          Show this message and exit.

rembg p <inputfolder> <outputfolder>

-w for watch the input folder

rembg p -w <inputfolder> <outputfolder>

danielgatis avatar Sep 07 '22 00:09 danielgatis

Thank you so much for the kind reply! I believe that I was confused with a different project and I got confused,

Now that I've tried your version, installation was so simple with anaconda (consider I'm a not a programmer) and I created some batch files so I can test quickly instead of typing manually. I'm using anaconda and windows 10.

I'm very curious about the HUMAN limitations of the model you're using compare to others, so far I'm impressed with the default settings but I should play around with the Alpha options / erode, and their end results with Full body, Portrait, Hair, etc..


BTW - Is there a parameter to make it work with videos? I can try extract my own Image Sequence, but maybe if it's already an option I would love to try different resolutions, fps, etc..

AlonDan avatar Sep 07 '22 05:09 AlonDan

https://github.com/ecsplendid/rembg-greenscreen

danielgatis avatar Sep 07 '22 21:09 danielgatis

https://github.com/ecsplendid/rembg-greenscreen

Thanks! I will give it a try. I was hopping to do it with the already installed rembg with some parameter I may missed or updated, will be nice to see it in the future.

I already notice that it's having issues with Hair even on their official screenshot, and I did try to understand how to train on my own dataset based on the comment linked from the main rembg page but I had so many issues and fails I got stuck and didn't know how to fix them so I pretty much gave up on training my own which is too sad because I would love to use my own dataset and train as long as need to get real well done results like in the online demos:

  1. https://zhke.io/#/?modnet_demo Unfortunately, Author did not share this demo trained model

  2. https://arc.tencent.com/en/ai-demos/humansegmentation Try 1.2 for example it is very impressive, but same thing I don't know what model or tech they're using, I just put it as a example for amazing results.


If there will be an easier / more user-friendly step-by-step video tutorial to follow on how to train our own dataset + create a model for rembg I would defiantly give it a try unlike the failed tried I got stuck on, and I would share the trained model so more rembg users will be able to experiment.

Training is currently very complex for newbies such as myself, I'm not a programmer and that's probably why I can't understand how to make it work locally.

If anyone have some "easy-to-use" branch for training my own dataset please SHARE.

Thanks ahead for any help / advice for training a better model for Full-Body + Portrait HUMANS (or specific other subjects which could be VERY interesting as well)

AlonDan avatar Sep 08 '22 19:09 AlonDan

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 09 '22 02:10 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Oct 23 '22 02:10 github-actions[bot]