Rembg is a tool to remove images background.

Overview

Rembg

Downloads Downloads Downloads License

Rembg is a tool to remove images background. That is it.

*** If you want to remove background from videos try this this fork: https://github.com/ecsplendid/rembg-greenscreen ***

Requirements

How to install torch/torchvision

Go to https://pytorch.org and scrool down to INSTALL PYTORCH section and follow the instructions.

For example:

PyTorch Build: Stable (1.7.1)
Your OS: Windows
Package: Pip
Language: Python
CUDA: None

The install cmd is:

pip install torch==1.7.1+cpu torchvision==0.8.2+cpu -f https://download.pytorch.org/whl/torch_stable.html

Installation

Install it from pypi

pip install rembg

Usage as a cli

Remove the background from a remote image

curl -s http://input.png | rembg > output.png

Remove the background from a local file

rembg -o path/to/output.png path/to/input.png

Remove the background from all images in a folder

rembg -p path/to/input path/to/output

Add a custom model

Copy the custom-model.pth file to ~/.u2net and run:

curl -s http://input.png | rembg -m custom-model > output.png

Usage as a server

Start the server

rembg-server

Open your browser to

http://localhost:5000?url=http://image.png

Also you can send the file as a FormData (multipart/form-data):

Usage as a library

Example 1: Read from stdin and write to stdout

In app.py

import sys
from rembg.bg import remove

sys.stdout.buffer.write(remove(sys.stdin.buffer.read()))

Then run

cat input.png | python app.py > out.png

Example 2: Using PIL

In app.py

from rembg.bg import remove
import numpy as np
import io
from PIL import Image

input_path = 'input.png'
output_path = 'out.png'

f = np.fromfile(input_path)
result = remove(f)
img = Image.open(io.BytesIO(result)).convert("RGBA")
img.save(output_path)

Then run

python app.py

Usage as a docker

Just run

curl -s http://input.png | docker run -i -v ~/.u2net:/root/.u2net danielgatis/rembg:latest > output.png

Advance usage

Sometimes it is possible to achieve better results by turning on alpha matting. Example:

curl -s http://input.png | rembg -a -ae 15 > output.png
Original Without alpha matting With alpha matting (-a -ae 15)

References

Backers

Love rembg? Help me keep it alive by donating funds to cover project expenses!
[Become a backer]

Sponsors

Become a sponsor and get your logo here on our Github page.
[Become a sponsor]

License

Copyright (c) 2020-present Daniel Gatis

Licensed under MIT License

Issues
  • Error ModuleNotFoundError: No module named 'pymatting_aot.aot'

    Error ModuleNotFoundError: No module named 'pymatting_aot.aot'

    Hello, I have centos 8 server.

    This is the error after running the command rembg -o input_image output_image

    Failed to import ahead-of-time-compiled modules. This is expected on first import. Compiling modules and trying again (this might take a minute). Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/pymatting_aot/cc.py", line 21, in import pymatting_aot.aot ModuleNotFoundError: No module named 'pymatting_aot.aot'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/usr/local/bin/rembg", line 5, in from rembg.cmd.cli import main File "/usr/local/lib/python3.8/site-packages/rembg/cmd/cli.py", line 7, in from ..bg import remove File "/usr/local/lib/python3.8/site-packages/rembg/bg.py", line 6, in from pymatting.alpha.estimate_alpha_cf import estimate_alpha_cf File "/usr/local/lib/python3.8/site-packages/pymatting/init.py", line 2, in import pymatting_aot.cc File "/usr/local/lib/python3.8/site-packages/pymatting_aot/cc.py", line 28, in compile_modules() File "/usr/local/lib/python3.8/site-packages/pymatting_aot/cc.py", line 16, in compile_modules cc.compile() File "/usr/local/lib64/python3.8/site-packages/numba/core/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/usr/local/lib64/python3.8/site-packages/numba/pycc/cc.py", line 217, in compile objects += self._compile_mixins(build_dir) File "/usr/local/lib64/python3.8/site-packages/numba/pycc/cc.py", line 187, in _compile_mixins objects = self._toolchain.compile_objects(sources, build_dir, File "/usr/local/lib64/python3.8/site-packages/numba/pycc/platform.py", line 137, in compile_objects objects = self._compiler.compile(sources, File "/usr/local/lib64/python3.8/site-packages/numpy/distutils/ccompiler.py", line 90, in m = lambda self, *args, **kw: func(self, *args, **kw) File "/usr/local/lib64/python3.8/site-packages/numpy/distutils/ccompiler.py", line 356, in CCompiler_compile pool.map(single_compile, build_items) File "/usr/lib64/python3.8/multiprocessing/pool.py", line 364, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/usr/lib64/python3.8/multiprocessing/pool.py", line 768, in get raise self._value File "/usr/lib64/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/usr/lib64/python3.8/multiprocessing/pool.py", line 48, in mapstar return list(map(*args)) File "/usr/local/lib64/python3.8/site-packages/numpy/distutils/ccompiler.py", line 321, in single_compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/usr/local/lib64/python3.8/site-packages/numpy/distutils/ccompiler.py", line 90, in m = lambda self, *args, **kw: func(self, *args, **kw) File "/usr/local/lib64/python3.8/site-packages/numpy/distutils/unixccompiler.py", line 54, in UnixCCompiler__compile raise CompileError(msg) distutils.errors.CompileError: Command "gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYCC_MODULE_NAME=aot -DPYCC_USE_NRT=1 -I/usr/include/python3.8 -I/usr/local/lib64/python3.8/site-packages/numpy/core/include -c /usr/local/lib64/python3.8/site-packages/numba/cext/utils.c -o /tmp/pycc-build-aot-gz0f8q5m/usr/local/lib64/python3.8/site-packages/numba/cext/utils.o" failed with exit status 1

    This is the command I have used to install rembg

    python3.8 -m pip install --upgrade pip

    [[email protected] ]# python3.8 -m pip install rembg

    Processing /root/.cache/pip/wheels/c4/52/be/f93ed10eb3209e691a9226d0ba337172ef19e38a0014892198/rembg-1.0.15-cp38-none-any.whl Requirement already satisfied: pillow==8.0.1 in /usr/local/lib64/python3.8/site-packages (from rembg) (8.0.1) Requirement already satisfied: numpy==1.19.4 in /usr/local/lib64/python3.8/site-packages (from rembg) (1.19.4) Requirement already satisfied: requests==2.24.0 in /usr/local/lib/python3.8/site-packages (from rembg) (2.24.0) Requirement already satisfied: scipy==1.5.4 in /usr/local/lib64/python3.8/site-packages (from rembg) (1.5.4) Requirement already satisfied: scikit-image==0.17.2 in /usr/local/lib64/python3.8/site-packages (from rembg) (0.17.2) Requirement already satisfied: waitress==1.4.4 in /usr/local/lib/python3.8/site-packages (from rembg) (1.4.4) Requirement already satisfied: pymatting==1.1.1 in /usr/local/lib/python3.8/site-packages (from rembg) (1.1.1) Requirement already satisfied: tqdm==4.51.0 in /usr/local/lib/python3.8/site-packages (from rembg) (4.51.0) Requirement already satisfied: flask==1.1.2 in /usr/local/lib/python3.8/site-packages (from rembg) (1.1.2) Requirement already satisfied: torchvision==0.8.1 in /usr/local/lib64/python3.8/site-packages (from rembg) (0.8.1) Requirement already satisfied: torch==1.7.0 in /usr/local/lib64/python3.8/site-packages (from rembg) (1.7.0) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.8/site-packages (from requests==2.24.0->rembg) (1.25.11) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/site-packages (from requests==2.24.0->rembg) (2020.11.8) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.8/site-packages (from requests==2.24.0->rembg) (3.0.4) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.8/site-packages (from requests==2.24.0->rembg) (2.10) Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.8/site-packages (from scikit-image==0.17.2->rembg) (2020.10.1) Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib64/python3.8/site-packages (from scikit-image==0.17.2->rembg) (3.3.3) Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.8/site-packages (from scikit-image==0.17.2->rembg) (2.5) Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.8/site-packages (from scikit-image==0.17.2->rembg) (2.9.0) Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib64/python3.8/site-packages (from scikit-image==0.17.2->rembg) (1.1.1) Requirement already satisfied: numba!=0.49.0 in /usr/local/lib64/python3.8/site-packages (from pymatting==1.1.1->rembg) (0.51.2) Requirement already satisfied: Jinja2>=2.10.1 in /usr/local/lib/python3.8/site-packages (from flask==1.1.2->rembg) (2.11.2) Requirement already satisfied: click>=5.1 in /usr/local/lib/python3.8/site-packages (from flask==1.1.2->rembg) (7.1.2) Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python3.8/site-packages (from flask==1.1.2->rembg) (1.1.0) Requirement already satisfied: Werkzeug>=0.15 in /usr/local/lib/python3.8/site-packages (from flask==1.1.2->rembg) (1.0.1) Requirement already satisfied: dataclasses in /usr/local/lib/python3.8/site-packages (from torch==1.7.0->rembg) (0.6) Requirement already satisfied: future in /usr/local/lib/python3.8/site-packages (from torch==1.7.0->rembg) (0.18.2) Requirement already satisfied: typing-extensions in /usr/local/lib/python3.8/site-packages (from torch==1.7.0->rembg) (3.7.4.3) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib64/python3.8/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (1.3.1) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /usr/local/lib/python3.8/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (2.4.7) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.8/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (2.8.1) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.8/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (0.10.0) Requirement already satisfied: decorator>=4.3.0 in /usr/local/lib/python3.8/site-packages (from networkx>=2.0->scikit-image==0.17.2->rembg) (4.4.2) Requirement already satisfied: llvmlite<0.35,>=0.34.0.dev0 in /usr/local/lib64/python3.8/site-packages (from numba!=0.49.0->pymatting==1.1.1->rembg) (0.34.0) Requirement already satisfied: setuptools in /usr/lib/python3.8/site-packages (from numba!=0.49.0->pymatting==1.1.1->rembg) (41.6.0) Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib64/python3.8/site-packages (from Jinja2>=2.10.1->flask==1.1.2->rembg) (1.1.1) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.8/site-packages (from python-dateutil>=2.1->matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (1.15.0) Installing collected packages: rembg Successfully installed rembg-1.0.15

    Please suggest

    opened by arnold408 24
  • Why is CUDA not *much* faster then CPU?

    Why is CUDA not *much* faster then CPU?

    I ran rembg -o 01.PNG 01.JPG on a system with CUDA support and on a system without CUDA support. It's a 2784x1856 JPG with 3.32 MB. CUDA is 11 seconds, CPU is 14 seconds. CUDA is actually used as the check in https://github.com/danielgatis/rembg/blob/master/src/rembg/u2net/detect.py#L92 is successful. Can you explain that to me please?

    opened by coveritytest 22
  • exec from a php file

    exec from a php file

    Hello,

    Thank you so much for this great tool. I have a php website using CodeIgniter.

    When I execute the code below from a php file at the root of my website, it"s working fine. When I execute it in the codeIgniter 'application' folder (what I need), it doesn't work. Any file is returned.

    I have tried with python as well

    $rembgpy = '/my_path/app.py'; $in = '/my_path/lanterne.jpg'; $out = '/mypath/new_lanterne.png';

    exec("rembg -o '$out' '$in'");

    exec("cat '$in' | python3.6 '$rembgpy' > '$out' ");

    Do you have any idea ? (In codeIgniter, python is working for other python program)

    Thank you very much Aude

    opened by latrille-bot 17
  • Trying to get it to work

    Trying to get it to work

    I am on Windows 11. While I did read that it runs with 3.9, does that mean this will not work with a later version? I tried to run with 3.10, 3.9.13 but always getting the following error and not sure what to do: image

    opened by bullmoose20 13
  • requests.exceptions.ConnectionError: HTTPSConnectionPool(host='docs.google.com', port=443)

    requests.exceptions.ConnectionError: HTTPSConnectionPool(host='docs.google.com', port=443)

    Traceback (most recent call last): File "/Users/apple/.pyenv/versions/3.8.6/bin/rembg", line 8, in sys.exit(main()) File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/rembg/cmd/cli.py", line 122, in main remove( File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/rembg/bg.py", line 87, in remove model = get_model(model_name) File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/rembg/bg.py", line 76, in get_model return detect.load_model(model_name="u2net") File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/rembg/u2net/detect.py", line 83, in load_model download_file_from_google_drive( File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/rembg/u2net/detect.py", line 28, in download_file_from_google_drive response = session.get(URL, params={"id": id}, stream=True) File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/requests/sessions.py", line 543, in get return self.request('GET', url, **kwargs) File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/requests/sessions.py", line 530, in request resp = self.send(prep, **send_kwargs) File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/requests/sessions.py", line 643, in send r = adapter.send(request, **kwargs) File "/Users/apple/.pyenv/versions/3.8.6/lib/python3.8/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='docs.google.com', port=443): Max retries exceeded with url: /uc?export=download&id=1ao1ovG1Qtx4b7EoskHXmi2E9rp5CHLcZ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x136a4b460>: Failed to establish a new connection: [Errno 60] Operation timed out'))

    opened by hallywang 12
  • sudo: rembg:command not found

    sudo: rembg:command not found

    What a wonderful work! I am sorry to bother you,but I have a question in "sudo: rembg:command not found". I have installed rembg,but when I use "rembg -o /home/zc/transformed.png /home/zc/PycharmProjects/pythonProject/modeltest.png",nothing happened.What should I do?How can I operate?

    I would very appreciate if you could help me. Thank you!

    opened by tks-reply 9
  • Upgrade torchvision version

    Upgrade torchvision version

    I got an error for installing rembg

    ERROR: Could not find a version that satisfies the requirement torchvision==0.8.1 (from rembg) (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3, 0.5.0) ERROR: No matching distribution found for torchvision==0.8.1 (from rembg)

    opened by ibrahimnsu15 8
  • Error when using alpha mating

    Error when using alpha mating

    When I try to use alpha mating on a image it throws following error message:

    image

    According documentation it should work well.

    Installation over pip3: Python 3.8.10 pip3 20.0.2 ubuntu 20.04

    opened by a-tonchev 7
  • feature request: functionality to add a background image/color to the generated image

    feature request: functionality to add a background image/color to the generated image

    Will be great to have an optional way to add a custom background image/color to the generated image (through simple overlay) would be great.

    PS: Thank you for this awesome library. The quality of generated image is superb! (not to mention the speed - even with just the CPU).

    opened by option-greek 7
  • u2net file download failed

    u2net file download failed

    first time run rembg command, console error as follows

    File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='docs.google.com', port=443): Max retries exceeded with url: /uc?export=download&id=1ao1ovG1Qtx4b7EoskHXmi2E9rp5CHLcZ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f74927be700>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

    but I have manual downloaded u2net.pth and u2netp.pth file, put these to /root/.u2net dir,but it does not work, console also error

    File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='docs.google.com', port=443): Max retries exceeded with url: /uc?export=download&id=1ao1ovG1Qtx4b7EoskHXmi2E9rp5CHLcZ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f74927be700>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

    opened by loop965 7
  • why? www.remove.bg is good, but Using PIL is bad

    why? www.remove.bg is good, but Using PIL is bad

    1. by: https://www.remove.bg/zh/upload

    input.png: imput_test1

    out.png is good! imput_test1-removebg-preview

    1. by: Using PIL from rembg.bg import remove import numpy as np import io from PIL import Image

    input_path = 'input.png' output_path = 'out.png'

    f = np.fromfile(input_path) result = remove(f) img = Image.open(io.BytesIO(result)).convert("RGBA") img.save(output_path)

    input.png: imput_test1

    out.png is bad! output1

    opened by xiaoyezi55 6
  • Use option -a -ae get an error message

    Use option -a -ae get an error message

    OMP: Info #271: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead. Traceback (most recent call last): File "/Users/kane/opt/anaconda3/bin/rembg", line 8, in <module> sys.exit(main()) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/rembg/cli.py", line 88, in i output.write(remove(input.read(), session=new_session(model), **kwargs)) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/rembg/bg.py", line 116, in remove cutout = alpha_matting_cutout( File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/rembg/bg.py", line 52, in alpha_matting_cutout alpha = estimate_alpha_cf(img_normalized, trimap_normalized) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/pymatting/alpha/estimate_alpha_cf.py", line 53, in estimate_alpha_cf L = cf_laplacian(image, **laplacian_kwargs, is_known=is_known) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/pymatting/laplacian/cf_laplacian.py", line 168, in cf_laplacian _cf_laplacian(image, epsilon, radius, values, indices, indptr, is_known) File "/Users/kane/opt/anaconda3/lib/python3.9/site-packages/pymatting/laplacian/cf_laplacian.py", line 8, in _cf_laplacian assert d == 3 AssertionError

    opened by szkane 0
  • How to include for entire folder for removing background of images in folder

    How to include for entire folder for removing background of images in folder

    How to include for entire folder for removing background of images in folder....I tried with following code in jupyter notebook.... from rembg import remove input_path = 'C:\For_Split\Grade1' output_path = 'C:\Background_Removed\G1'

    with open(input_path, 'rb') as i: with open(output_path, 'wb') as o: input = i.read() output = remove(input) o.write(output)

    giving the following error... PermissionError: [Errno 13] Permission denied: 'C:\For_Split\Grade1'

    opened by PraveenMNaik 0
  • Occasional segmentation fault with -a option

    Occasional segmentation fault with -a option

    Certan images produce a segmentation fault when run through rembg with the -a option. Unfortunatly I can't attach the images I have which re-produce the issue, but here is what I get with PYTHONFAULTHANDLER=1:

    /home/user/.local/lib/python3.10/site-packages/torch/nn/functional.py:780: UserWarning: Note that order of the arguments: ceil_mode and return_indices will changeto match the args list in nn.MaxPool2d in a future release.
      warnings.warn("Note that order of the arguments: ceil_mode and return_indices will change"
    Fatal Python error: Segmentation fault
    
    Current thread 0x00007f6b63ff3740 (most recent call first):
      File "/home/user/.local/lib/python3.10/site-packages/pymatting/foreground/estimate_foreground_ml.py", line 220 in estimate_foreground_ml
      File "/home/user/.local/lib/python3.10/site-packages/rembg/bg.py", line 55 in alpha_matting_cutout
      File "/home/user/.local/lib/python3.10/site-packages/rembg/bg.py", line 96 in remove
      File "/home/user/.local/lib/python3.10/site-packages/rembg/cmd/cli.py", line 146 in main
      File "/home/user/.local/bin/rembg", line 8 in <module>
    
    Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, PIL._imaging, yaml._yaml, numba.core.typeconv._typeconv, numba._helperlib, numba._dynfunc, numba._dispatcher, numba.core.runtime._nrt_python, numba.np.ufunc._internal, scipy._lib._ccallback_c, scipy.linalg._fblas, scipy.linalg._flapack, scipy.linalg._cythonized_array_utils, scipy.linalg._flinalg, scipy.linalg._solve_toeplitz, scipy.linalg._matfuncs_sqrtm_triu, scipy.linalg.cython_blas, scipy.linalg.cython_lapack, scipy.linalg._decomp_update, scipy.sparse._sparsetools, scipy.sparse._csparsetools, scipy.sparse.csgraph._tools, scipy.sparse.csgraph._shortest_path, scipy.sparse.csgraph._traversal, scipy.sparse.csgraph._min_spanning_tree, scipy.sparse.csgraph._flow, scipy.sparse.csgraph._matching, scipy.sparse.csgraph._reordering, numba.experimental.jitclass._box, scipy.sparse.linalg._isolve._iterative, scipy.sparse.linalg._dsolve._superlu, scipy.sparse.linalg._eigen.arpack._arpack, scipy.ndimage._nd_image, scipy.special._ufuncs_cxx, scipy.special._ufuncs, scipy.special._specfun, scipy.special._comb, scipy.special._ellip_harm_2, _ni_label, scipy.ndimage._ni_label, torch._C, torch._C._fft, torch._C._linalg, torch._C._nn, torch._C._sparse, torch._C._special, PIL._imagingft, skimage._shared.geometry, scipy.spatial._ckdtree, scipy._lib.messagestream, scipy.spatial._qhull, scipy.spatial._voronoi, scipy.spatial._distance_wrap, scipy.spatial._hausdorff, scipy.spatial.transform._rotation, skimage.draw._draw, skimage.transform._hough_transform, scipy.interpolate._fitpack, scipy.interpolate.dfitpack, scipy.interpolate._bspl, scipy.interpolate._ppoly, scipy.interpolate.interpnd, scipy.interpolate._rbfinterp_pythran, scipy._lib._uarray._uarray, skimage.transform._warps_cy, skimage.measure._find_contours_cy, skimage.measure._marching_cubes_lewiner_cy, skimage.measure._marching_cubes_classic_cy, skimage.measure._moments_cy, scipy.signal._sigtools, scipy.signal._max_len_seq_inner, scipy.signal._upfirdn_apply, scipy.signal._spline, scipy.optimize._minpack2, scipy.optimize._group_columns, scipy.optimize._trlib._trlib, numpy.linalg.lapack_lite, scipy.optimize._lbfgsb, _moduleTNC, scipy.optimize._moduleTNC, scipy.optimize._cobyla, scipy.optimize._slsqp, scipy.optimize._minpack, scipy.optimize._lsq.givens_elimination, scipy.optimize._zeros, scipy.optimize.__nnls, scipy.optimize._highs.cython.src._highs_wrapper, scipy.optimize._highs._highs_wrapper, scipy.optimize._highs.cython.src._highs_constants, scipy.optimize._highs._highs_constants, scipy.linalg._interpolative, scipy.optimize._bglu_dense, scipy.optimize._lsap_module, scipy.integrate._odepack, scipy.integrate._quadpack, scipy.integrate._vode, scipy.integrate._dop, scipy.integrate._lsoda, scipy.signal._sosfilt, scipy.signal._spectral, scipy.special.cython_special, scipy.stats._stats, beta_ufunc, scipy.stats._boost.beta_ufunc, binom_ufunc, scipy.stats._boost.binom_ufunc, nbinom_ufunc, scipy.stats._boost.nbinom_ufunc, hypergeom_ufunc, scipy.stats._boost.hypergeom_ufunc, scipy.stats._biasedurn, scipy.stats._hypotests_pythran, scipy.stats._statlib, scipy.stats._mvn, scipy.stats._sobol, scipy.stats._qmc_cy, scipy.stats._unuran.unuran_wrapper, scipy.signal._peak_finding_utils, skimage.measure._pnpoly, skimage.measure._ccomp, skimage.transform._radon_transform, matplotlib._c_internal_utils, matplotlib._path, kiwisolver._cext, matplotlib._image (total: 137)
    

    If I remove the -a option, things work as expected. Let me know if there is anything I can do to help troubleshoot.

    opened by 9072997 1
  • numba.core.errors.UnsupportedParforsError while I run this command rembg i input.png output.png

    numba.core.errors.UnsupportedParforsError while I run this command rembg i input.png output.png

    PS C:\Users\Asad Kareem\Desktop\Happy Frog> rembg i input.png output.png                
    Traceback (most recent call last):
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "C:\Users\Asad Kareem\AppData\Local\Programs\Python\Python39-32\Scripts\rembg.exe\__main__.py", line 4, in <module>
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\rembg\__init__.py", line 11, in <module>
        from .bg import remove
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\rembg\bg.py", line 8, in <module>
        from pymatting.alpha.estimate_alpha_cf import estimate_alpha_cf
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\pymatting\__init__.py", line 2, in <module>
        from pymatting.util import *
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\pymatting\util\__init__.py", line 2, in <module>
        from pymatting.util.kdtree import KDTree, knn
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\pymatting\util\kdtree.py", line 138, in <module>
        def _find_knn(
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\decorators.py", line 219, in wrapper
        disp.compile(sig)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\dispatcher.py", line 965, in compile
        cres = self._compiler.compile(args, return_type)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\dispatcher.py", line 125, in compile
        status, retval = self._compile_cached(args, return_type)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\dispatcher.py", line 139, in _compile_cached
        retval = self._compile_core(args, return_type)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\dispatcher.py", line 152, in _compile_core
        cres = compiler.compile_extra(self.targetdescr.typing_context,
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler.py", line 693, in compile_extra
        return pipeline.compile_extra(func)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler.py", line 429, in compile_extra
        return self._compile_bytecode()
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler.py", line 497, in _compile_bytecode
        return self._compile_core()
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler.py", line 476, in _compile_core
        raise e
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler.py", line 463, in _compile_core
        pm.run(self.state)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler_machinery.py", line 353, in run
        raise patched_exception
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler_machinery.py", line 341, in run
        self._runPass(idx, pass_inst, state)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler_lock.py", line 35, in _acquire_compile_lock
        return func(*args, **kwargs)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler_machinery.py", line 296, in _runPass
        mutated |= check(pss.run_pass, internal_state)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\compiler_machinery.py", line 269, in check
        mangled = func(compiler_state)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\typed_passes.py", line 394, in run_pass
        lower.lower()
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\lowering.py", line 196, in lower
        self.lower_normal_function(self.fndesc)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\lowering.py", line 250, in lower_normal_function
        entry_block_tail = self.lower_function_body()
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\lowering.py", line 279, in lower_function_body
        self.lower_block(block)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\lowering.py", line 293, in lower_block
        self.lower_inst(inst)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\core\lowering.py", line 565, in lower_inst
        func(self, inst)
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\parfors\parfor_lowering.py", line 64, in _lower_parfor_parallel
        ensure_parallel_support()
      File "c:\users\asad kareem\appdata\local\programs\python\python39-32\lib\site-packages\numba\parfors\parfor.py", line 4701, in ensure_parallel_support
        raise errors.UnsupportedParforsError(msg)
    numba.core.errors.UnsupportedParforsError: Failed in nopython mode pipeline (step: native lowering)
    
    opened by asadatgithub 0
  • pip can't find the latest rembg version.

    pip can't find the latest rembg version.

    pip install rembg==2.0.21 Collecting rembg==2.0.21 Using cached rembg-2.0.21-py3-none-any.whl (12 kB) Collecting filetype==1.0.9 Using cached filetype-1.0.9-py2.py3-none-any.whl (16 kB) Collecting uvicorn==0.17.0 Using cached uvicorn-0.17.0-py3-none-any.whl (54 kB) Collecting watchdog==2.1.7 Using cached watchdog-2.1.7-cp39-cp39-macosx_11_0_arm64.whl (86 kB) Collecting tqdm==4.62.3 Using cached tqdm-4.62.3-py2.py3-none-any.whl (76 kB) Collecting scikit-image==0.19.1 Using cached scikit_image-0.19.1-cp39-cp39-macosx_12_0_arm64.whl (12.2 MB) Collecting asyncer==0.0.1 Using cached asyncer-0.0.1-py3-none-any.whl (8.1 kB) Collecting gdown==4.4.0 Using cached gdown-4.4.0.tar.gz (14 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting numpy==1.22.3 Using cached numpy-1.22.3-cp39-cp39-macosx_11_0_arm64.whl (12.8 MB) Collecting pymatting==1.1.5 Using cached PyMatting-1.1.5-py3-none-any.whl (46 kB) Collecting aiohttp==3.8.1 Using cached aiohttp-3.8.1-cp39-cp39-macosx_11_0_arm64.whl (552 kB) Collecting scipy==1.8.0 Using cached scipy-1.8.0-cp39-cp39-macosx_12_0_arm64.whl (28.7 MB) Collecting pillow==9.0.1 Using cached Pillow-9.0.1-1-cp39-cp39-macosx_11_0_arm64.whl (2.7 MB) Collecting click==8.0.3 Using cached click-8.0.3-py3-none-any.whl (97 kB) Collecting python-multipart==0.0.5 Using cached python-multipart-0.0.5.tar.gz (32 kB) Preparing metadata (setup.py) ... done Collecting fastapi==0.72.0 Using cached fastapi-0.72.0-py3-none-any.whl (52 kB) ERROR: Ignored the following versions that require a different python version: 0.10.6 Requires-Python >=2.7, <3.6; 0.10.7 Requires-Python >=2.7, <3.6 ERROR: Could not find a version that satisfies the requirement onnxruntime==1.10.0 (from rembg) (from versions: none) ERROR: No matching distribution found for onnxruntime==1.10.0

    opened by abhishek692 0
Releases(v2.0.21)
Owner
Daniel Gatis
Daniel Gatis
Tool to create a Phunk image with a custom background

Create Phunk image Tool to create a Phunk image with a custom background Installation Clone the repo git clone https://github.com/albanow/etherscan_sa

Albano Pena Torres 6 Mar 31, 2022
Seeks to remove text from an image in a convincing way.

Text-Removal This is a Computer Vision project that seeks to successfully remove text from an image by covering the text areas in a convincing way. He

null 5 Feb 22, 2022
FrostedGlass is a translucent frosted glass effect widget, that creates a context with the background behind it.

FrostedGlass FrostedGlass is a translucent frosted glass effect widget, that creates a context with the background behind it. The effect is drawn on t

Kivy Garden 18 May 12, 2022
missing-pixel-filler is a python package that, given images that may contain missing data regions (like satellite imagery with swath gaps), returns these images with the regions filled.

Missing Pixel Filler This is the official code repository for the Missing Pixel Filler by SpaceML. missing-pixel-filler is a python package that, give

SpaceML 11 May 9, 2022
MetaStalk is a tool that can be used to generate graphs from the metadata of JPEG, TIFF, and HEIC images

MetaStalk About MetaStalk is a tool that can be used to generate graphs from the metadata of JPEG, TIFF, and HEIC images, which are tested. More forma

Cyb3r Jak3 1 Jul 5, 2021
A tool for hiding data inside of images

Stegenography-tool a tool for hiding data inside of images Quick test: do python steg-encode.py test/message.txt test/covid19.png to generate the test

luke 2 Nov 2, 2021
Png2Jpg tool will help you convert from png image format to jpg images format.

PNG 2 JPG All codes assume running from root directory. Please update the sys path at the beginning of the codes before running. Over View Png2Jpg too

Nguyễn Trường Lâu 2 Dec 27, 2021
A simple image-level annotation tool supporting multi-channel images for napari.

napari-labelimg4classification A simple image-level annotation tool supporting multi-channel images for napari. This napari plugin was generated with

null 4 May 16, 2022
Tool made for the FWA Yearbook Team to resize multiple images quickly.

ImageResize Tool Tool made for the FWA Yearbook Team to resize multiple images quickly. Make sure to check this repo for future updates How to Use The

LGobin 1 Jan 7, 2022
A large-scale dataset of both raw MRI measurements and clinical MRI images

fastMRI is a collaborative research project from Facebook AI Research (FAIR) and NYU Langone Health to investigate the use of AI to make MRI scans faster. NYU Langone Health has released fully anonymized knee and brain MRI datasets that can be downloaded from the fastMRI dataset page. Publications associated with the fastMRI project can be found at the end of this README.

Facebook Research 825 Jun 19, 2022
A simple programming language for manipulating images.

f-stop A simple programming language for manipulating images. Examples OPEN "image.png" AS image RESIZE image (300, 300) SAVE image "out.jpg" CLOSE im

F-Stop 6 Jan 30, 2022
A simple Streamlit Component to compare images in Streamlit apps. It integrates Knightlab's JuxtaposeJS

streamlit-image-juxtapose A simple Streamlit Component to compare images in Streamlit apps using Knightlab's JuxtaposeJS. The images are saved to the

Robin 20 Apr 19, 2022
Fixes 500+ mislabeled MURA images

In this repository, new csv files are provided that fixes 500+ mislabeled MURA x-rays for all categories. The mislabeled x-rays mainly had hardware in them. This project only fixes the false negatives for now.

Pieter Zeilstra 4 May 18, 2022
Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures.

WADs Out For [The] Ladies Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures. Development mostly focused on L

null 5 Apr 9, 2022
HtmlWebShot - A python3 package which Can Create Images From url, Html-CSS, Svg and from any readable file and texts with many setup features.

A python3 package which Can Create Images From url, Html-CSS, Svg and from any readable file and texts with many setup features

Danish 21 Jun 10, 2022
pix2tex: Using a ViT to convert images of equations into LaTeX code.

The goal of this project is to create a learning based system that takes an image of a math formula and returns corresponding LaTeX code.

Lukas Blecher 1.6k Jun 21, 2022
A scalable implementation of WobblyStitcher for 3D microscopy images

WobblyStitcher Introduction A scalable implementation of WobblyStitcher Dependencies $ python -m pip install numpy scikit-image Visualization ImageJ

CSE Lab, ETH Zurich 6 Dec 14, 2021
Glyphtracer is an app for converting images of letters to a font

Glyphtracer takes an image that contains pictures of several letters. It recognizes all them and lets the user tag each letter to a Unicode code point. It then converts the images to vector form and writes them to a FontForge's data format. The font can then be finalized with FontForge.

Jussi Pakkanen 34 May 5, 2022
Django helper application to easily and non-destructively crop arbitrarily large images in admin and frontend.

django-image-cropping django-image-cropping is an app for cropping uploaded images via Django's admin backend using Jcrop. Screenshot: django-image-cr

Jonas und der Wolf GmbH 535 Jun 18, 2022