stable-diffusion-webui-rembg icon indicating copy to clipboard operation
stable-diffusion-webui-rembg copied to clipboard

The downloaded onnx for the Remove Background is saved in c:\Users\USERNAME\.u2net\*

Open GroxicTinch opened this issue 2 years ago • 5 comments

Downloading data from 'https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx' to file 'C:\Users\USERNAME\.u2net\u2net.onnx'.
100%|###############################################| 176M/176M [00:00<?, ?B/s]
Downloading data from 'https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2netp.onnx' to file 'C:\Users\USERNAME\.u2net\u2netp.onnx'.
100%|#############################################| 4.57M/4.57M [00:00<?, ?B/s]
Downloading data from 'https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx' to file 'C:\Users\USERNAME\.u2net\u2net_human_seg.onnx'.

I believe these should be saved somewhere in the web-ui folders

GroxicTinch avatar Mar 13 '23 04:03 GroxicTinch

Agreed, somewhere like this should work:

extensions/stable-diffusion-webui-rembg/checkpoints

Or even better being able to set it's location with a configuration.

CansecoDev avatar Mar 16 '23 02:03 CansecoDev

3rd-ed, after all the saving that SD does on your OS Drive/SSD I do not want anymore saving onto it.

iSupremacy avatar Mar 16 '23 20:03 iSupremacy

Change the location of the rembg models.

Models location:

extensions/stable-diffusion-webui-rembg/models

Code change

File: postprocessing_rembg.py

    def process(self, pp: scripts_postprocessing.PostprocessedImage, model, return_mask, alpha_matting, alpha_matting_foreground_threshold, alpha_matting_background_threshold, alpha_matting_erode_size):
        if model == "None":
            return

        import os
        script_dir = os.path.abspath( os.path.dirname( __file__ ) )
        root_dir = os.path.dirname(os.path.normpath(script_dir))
        models_dir = os.path.join(root_dir, "models")
        os.environ["U2NET_HOME"] = models_dir
        # print("U2NET_HOME: " + models_dir)

        .....


maijz128 avatar Mar 17 '23 07:03 maijz128

Will this problem be corrected?

Sostay avatar Apr 28 '23 02:04 Sostay

I've opened a Pull Request to fix this issue: https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg/pull/28

h3rmit-git avatar Aug 27 '23 22:08 h3rmit-git