KutsuyaYuki / ABG_extension

228 stars 23 forks source link

BG remover wasn't appeared in WebUI after installation #5

Closed starush closed 1 year ago

starush commented 1 year ago

After installation in Automatic1111's WebUI, select 'BG Remover'. I don't see any ABG or BG remover after installation. Where should it appear?

KutsuyaYuki commented 1 year ago

Restart your WebUI. It probably needs to install dependencies.

Harvester62 commented 1 year ago

The Extension's name in the Extensions list of SD Web UI is not "BG remover" but "ABG_extension". This should be corrected in the README.MD file.

Apart from that, I am unable to get it working because of a potential conflict with some other extensions or the SDWUI itself, since the protobuf your extension want to install is protobuf-3.19.6.dist-info but protobuf-3.20.3.dist-info was already installed.

Then, even if the ABG_extenstion is installed and activated in the SDWUI there is no tab available in the Web UI.

Here follow the error message displayed in the console:

Error running install.py for extension extensions\ABG_extension. Command: "C:\stable-diffusion-webui\venv\Scripts\python.exe" "extensions\ABG_extension\install.py" Error code: 1 stdout: Installing requirements for Anime Background Remover

stderr: Traceback (most recent call last): File "C:\stable-diffusion-webui\extensions\ABG_extension\install.py", line 4, in launch.run_pip("install onnx", "requirements for Anime Background Remover") File "C:\stable-diffusion-webui\launch.py", line 97, in run_pip return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}") File "C:\stable-diffusion-webui\launch.py", line 65, in run raise RuntimeError(message) RuntimeError: Couldn't install requirements for Anime Background Remover. Command: "C:\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install onnx --prefer-binary Error code: 1 stdout: Collecting onnx Using cached onnx-1.13.0-cp310-cp310-win_amd64.whl (12.2 MB) Requirement already satisfied: numpy>=1.16.6 in c:\stable-diffusion-webui\venv\lib\site-packages (from onnx) (1.23.3) Collecting protobuf<4,>=3.20.2 Using cached protobuf-3.20.3-cp310-cp310-win_amd64.whl (904 kB) Requirement already satisfied: typing-extensions>=3.6.2.1 in c:\stable-diffusion-webui\venv\lib\site-packages (from onnx) (4.4.0) Installing collected packages: protobuf, onnx Attempting uninstall: protobuf Found existing installation: protobuf 3.19.6 Uninstalling protobuf-3.19.6: Successfully uninstalled protobuf-3.19.6

stderr: WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) ERROR: Could not install packages due to an OSError: [WinError 5] Accesso negato: 'C:\stable-diffusion-webui\venv\Lib\site-packages\google\~7otobuf\internal\_api_implementation.cp310-win_amd64.pyd' Check the permissions.

WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages)

All those -rotobuf messages are due to duplicated copies of that library inside C:\stable-diffusion-webui\venv\Lib\site-packages which are created by the dependency installation of ABG_extension. If I remove it from the Extensions folder, everything works fine and none of the above errors are displayed relatively to the protobuf library.

Hope the above information might be useful. For the moment I will remove the extension from my local installation.

P.S.: I am the translator of the SD Web UI, Scripts and Extensions for the Italian Localization, and to do my work properly I need to have all, or the majority of the Extensions installed (too long to explain why, but it has to do with the language.json template).

Duanyll commented 1 year ago

The Extension's name in the Extensions list of SD Web UI is not "BG remover" but "ABG_extension". This should be corrected in the README.MD file.

Apart from that, I am unable to get it working because of a potential conflict with some other extensions or the SDWUI itself, since the protobuf your extension want to install is protobuf-3.19.6.dist-info but protobuf-3.20.3.dist-info was already installed.

Then, even if the ABG_extenstion is installed and activated in the SDWUI there is no tab available in the Web UI.

Here follow the error message displayed in the console:

Error running install.py for extension extensions\ABG_extension. Command: "C:\stable-diffusion-webui\venv\Scripts\python.exe" "extensions\ABG_extension\install.py" Error code: 1 stdout: Installing requirements for Anime Background Remover

stderr: Traceback (most recent call last): File "C:\stable-diffusion-webui\extensions\ABG_extension\install.py", line 4, in launch.run_pip("install onnx", "requirements for Anime Background Remover") File "C:\stable-diffusion-webui\launch.py", line 97, in run_pip return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}") File "C:\stable-diffusion-webui\launch.py", line 65, in run raise RuntimeError(message) RuntimeError: Couldn't install requirements for Anime Background Remover. Command: "C:\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install onnx --prefer-binary Error code: 1 stdout: Collecting onnx Using cached onnx-1.13.0-cp310-cp310-win_amd64.whl (12.2 MB) Requirement already satisfied: numpy>=1.16.6 in c:\stable-diffusion-webui\venv\lib\site-packages (from onnx) (1.23.3) Collecting protobuf<4,>=3.20.2 Using cached protobuf-3.20.3-cp310-cp310-win_amd64.whl (904 kB) Requirement already satisfied: typing-extensions>=3.6.2.1 in c:\stable-diffusion-webui\venv\lib\site-packages (from onnx) (4.4.0) Installing collected packages: protobuf, onnx Attempting uninstall: protobuf Found existing installation: protobuf 3.19.6 Uninstalling protobuf-3.19.6: Successfully uninstalled protobuf-3.19.6

stderr: WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) ERROR: Could not install packages due to an OSError: [WinError 5] Accesso negato: 'C:\stable-diffusion-webui\venv\Lib\site-packages\google\~7otobuf\internal_api_implementation.cp310-win_amd64.pyd' Check the permissions.

WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages) WARNING: Ignoring invalid distribution -rotobuf (c:\stable-diffusion-webui\venv\lib\site-packages)

All those -rotobuf messages are due to duplicated copies of that library inside C:\stable-diffusion-webui\venv\Lib\site-packages which are created by the dependency installation of ABG_extension. If I remove it from the Extensions folder, everything works fine and none of the above errors are displayed relatively to the protobuf library.

Hope the above information might be useful. For the moment I will remove the extension from my local installation.

P.S.: I am the translator of the SD Web UI, Scripts and Extensions for the Italian Localization, and to do my work properly I need to have all, or the majority of the Extensions installed (too long to explain why, but it has to do with the language.json template).

I ran into exactly the same issues, and I got the protobuf warnings whenever using pip in the venv. I can suppress the warnings by removing the ~rotobuf-*** directory inside site-packages, and everything works after that. I'm not sure where did the ~rotobuf-*** directory came from.

The extension is just a script, which can be activated in this dropdown:

image

Callieleaf commented 1 year ago

Also unable to get this extension to work. Moving the folder mentioned above did not help. Here is some of the error code I received. This is the only extension in A1111 that hasn't worked on my comp, that I have tried. It could be very helpful if it worked - particularly under text to image (as opposed to - or in addition to - image to image where it appears in the example above.)
module = script_loading.load_module(scriptfile.path) File "C:\Users\lake\Desktop\tacocat\modules\script_loading.py", line 13, in load_module exec(compiled, module.dict) File "C:\Users\lake\Desktop\tacocat\extensions\ABG_extension\scripts\app.py", line 9, in import onnxruntime as rt ModuleNotFoundError: No module named 'onnxruntime'

Reloading modules: modules.ui Refreshing Model List Restarting Gradio Error loading settings: Traceback (most recent call last): File "C:\Users\lake\Desktop\tacocat\modules\ui.py", line 1697, in create_ui ui_settings = json.load(file) File "C:\Users\lake\AppData\Local\Programs\Python\Python310\Lib\json__init.py", line 293, in load return loads(fp.read(), File "C:\Users\lake\AppData\Local\Programs\Python\Python310\Lib\json\init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\Users\lake\AppData\Local\Programs\Python\Python310\Lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\lake\AppData\Local\Programs\Python\Python310\Lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Callieleaf commented 1 year ago

I got it working. I reinstalled both onnxruntime and onnxruntime gpu through the Windows Command prompt using the Pip install commands on this page: https://onnxruntime.ai/docs/install/#python-installs Initially it did not work - and reloading from the extensions page in A1111 did not work. However on my most recent attempt I shut the interface down completely and relaunched it - I'm not sure if I had done that on a previous attempt - and the Anime Background Remover loaded normally! It is now working. One suggestion for future development - it would be very handy to be able to only save background free pictures and not the originals or the masks. It is saving a lot of extra files between masks, etc, so batch /working with a complete folder isn't really possible without intervention due to the superfluous files. It generally seems to do a decent job removing the background, though some images retain bits and pieces of unwanted content.

Cool extension once it is working!

Callieleaf commented 1 year ago

Thanks so much for adding the functionality to save just the BG-free image so quickly! On my computer, when I select to only save background free images - it is saving the original render with the background in place.

The background free version is in the A1111 window once it completes the rendering job and can be downloaded, but the original unaltered render is the version it is automatically saving in the chosen images folder.

KutsuyaYuki commented 1 year ago

@Callieleaf Oh, I see what you mean! Let me have a look.

Callieleaf commented 1 year ago

Thank-you for trying to address the issue. I downloaded the latest update but unfortunately it continues to exhibit the same behavior. Have a good day. :)

KutsuyaYuki commented 1 year ago

Yea, I'll fix this sometime later. I'm having issues with my PC, so I can't develop it right now. I'll fix it later when everything is up and running again!

Callieleaf commented 1 year ago

No worries and no rush! I appreciate that you continue to develop it. It is probably my favorite plug in. Sometimes the accuracy of the background removal can vary - I find trying to force Stable Diffusion to create a solid white or similar background before removal can help. If I knew coding better I would help develop and fine tune it, but alas it is beyond my skill set. Thanks again!

KutsuyaYuki commented 1 year ago

Hey @starush, did you get it to work? It's been some time by now.

starush commented 1 year ago

Yes It work, thank you. Sometimes accuracy is the question but I would like to to see it like some separate product that able to do the batch of already generated and upscaled images.

KutsuyaYuki commented 1 year ago

Yes It work, thank you. Sometimes accuracy is the question but I would like to to see it like some separate product that able to do the batch of already generated and upscaled images.

Glad the initial problem is solved. I cannot fix the accuracy problem, because I didn't create the model my plugin uses.

KutsuyaYuki commented 1 year ago

Closed because no further response