danielgatis / rembg Goto Github PK
View Code? Open in Web Editor NEWRembg is a tool to remove images background
License: MIT License
Rembg is a tool to remove images background
License: MIT License
I run cli "rembg -o out.png test.png", console show this error
Traceback (most recent call last):
File "/home/tony/PycharmProjects/rem/venv/bin/rembg", line 8, in
sys.exit(main())
File "/home/tony/PycharmProjects/rem/venv/lib/python3.8/site-packages/rembg/cmd/cli.py", line 118, in main
remove(
File "/home/tony/PycharmProjects/rem/venv/lib/python3.8/site-packages/rembg/bg.py", line 84, in remove
img = Image.open(io.BytesIO(data)).convert("RGB")
File "/home/tony/PycharmProjects/rem/venv/lib/python3.8/site-packages/PIL/Image.py", line 2943, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f50f7b4eb30>
Please Suggestion. thanks
➜ ~ docker pull danielgatis/rembg
Using default tag: latest
latest: Pulling from danielgatis/rembg
6a5697faee43: Pull complete
ba13d3bc422b: Pull complete
a254829d9e55: Pull complete
f853e5702a31: Pull complete
29cfce72a460: Pull complete
4bb689f629d3: Pull complete
302d6ee79e94: Downloading [=========> ] 273MB/1.501GB
fe1233ff1aac: Downloading [=========> ] 233.1MB/1.236GB
e8e3fb0eda20: Download complete
5bbf6ed80873: Downloading [> ] 29.4MB/1.816GB
For example:
Photo 1:
Original:
https://i.ibb.co/stYZ06K/IMG-1710.jpg
Without background:
https://i.ibb.co/dG9XC67/4003573022147-F.png
Photo2:
Original:
https://i.ibb.co/dbyn9bt/IMG-1722.jpg
Without background:
https://i.ibb.co/J5kRwSD/4003573022024-F.png
Hi there,
I got this error because my PC does not have NVIDIA GPU.
Can I run it without GPU?
rembg -o ~/Downloads/cat.png ~/Downloads/cat.jpg /home/huka/.local/lib/python3.8/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.) return torch._C._cuda_getDeviceCount() > 0 Traceback (most recent call last): File "/home/huka/.local/bin/rembg", line 8, in <module> sys.exit(main()) File "/home/huka/.local/lib/python3.8/site-packages/rembg/cmd/cli.py", line 118, in main remove( File "/home/huka/.local/lib/python3.8/site-packages/rembg/bg.py", line 84, in remove img = Image.open(io.BytesIO(data)).convert("RGB") File "/home/huka/.local/lib/python3.8/site-packages/PIL/Image.py", line 2943, in open raise UnidentifiedImageError( PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f4ad769ff90>
Many thanks for considering my request.
Best regards,
HungNLK
Hello,
first of all , thank you so much for sharing this cool tool, i love it.
i got one question , is there any way to increase its speed ?
I have 3000x5000px images and the background removal works more or less nicely. However, the resulting image is blurred (the dimensions are the same as the original). Is there a parameter to address this?
additionally, would it be possible to just output the alpha channel?
Hello,
I'm unable to make it work on a Windows.
when i exec cmd: rembg -o animal.png animal-3.jpg
Traceback (most recent call last): File "c:\programdata\anaconda3\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\programdata\anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\ProgramData\Anaconda3\Scripts\rembg.exe\__main__.py", line 7, in <module> File "c:\programdata\anaconda3\lib\site-packages\rembg\cmd\cli.py", line 113, in main remove( File "c:\programdata\anaconda3\lib\site-packages\rembg\bg.py", line 83, in remove model = get_model(model_name) File "c:\programdata\anaconda3\lib\site-packages\rembg\bg.py", line 72, in get_model return detect.load_model(model_name="u2net") File "c:\programdata\anaconda3\lib\site-packages\rembg\u2net\detect.py", line 69, in load_model net.load_state_dict(torch.load(path)) File "c:\programdata\anaconda3\lib\site-packages\torch\serialization.py", line 595, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "c:\programdata\anaconda3\lib\site-packages\torch\serialization.py", line 781, in _legacy_load deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly) RuntimeError: unexpected EOF, expected 383141 more bytes. The file might be corrupted.
Thanks a lot!
Command pip install rembg print error
Collecting rembg
Could not find a version that satisfies the requirement rembg (from versions: )
No matching distribution found for rembg
How to solve?
Hello
I got found one miss typo at README.md.
<input type="submi"t value="upload"/>
it would be
<input type="submit" value="upload"/>
Hey,
I really like your project! It really saved me a lot of time (and money)
But now I want to install it on a Virtual Machine on Digital Ocean, a Debian 10 one to more exact.
And it doesn't want to install:
Building wheels for collected packages: rembg, numba, llvmlite
Running setup.py bdist_wheel for rembg ... done
Stored in directory: /root/.cache/pip/wheels/d5/ad/72/a29715e07848809bb37bf068f7540983975e7941fbd4c1ea34
Running setup.py bdist_wheel for numba ... done
Stored in directory: /root/.cache/pip/wheels/cd/cd/8c/314cbe49cd8bb876f251763442807db9d55968d1f44cb20013
Running setup.py bdist_wheel for llvmlite ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-pekaldf3/llvmlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-u2vc646x --python-tag cp37:
running bdist_wheel
/usr/bin/python3 /tmp/pip-install-pekaldf3/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-install-pekaldf3/llvmlite/ffi/build.py", line 105, in main_posix
out = subprocess.check_output([llvm_config, '--version'])
File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/usr/lib/python3.7/subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config': 'llvm-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-install-pekaldf3/llvmlite/ffi/build.py", line 191, in <module>
main()
File "/tmp/pip-install-pekaldf3/llvmlite/ffi/build.py", line 181, in main
main_posix('linux', '.so')
File "/tmp/pip-install-pekaldf3/llvmlite/ffi/build.py", line 108, in main_posix
"to the path for llvm-config" % (llvm_config,))
RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
error: command '/usr/bin/python3' failed with exit status 1
----------------------------------------
Failed building wheel for llvmlite
Running setup.py clean for llvmlite
Successfully built rembg numba
Failed to build llvmlite
Installing collected packages: llvmlite, numba, pymatting, rembg
Running setup.py install for llvmlite ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-pekaldf3/llvmlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-i02sowqg/install-record.txt --single-version-externally-managed --compile:
running install
running build
got version from file /tmp/pip-install-pekaldf3/llvmlite/llvmlite/_version.py {'version': '0.34.0', 'full': 'c5889c9e98c6b19d5d85ebdd982d64a03931f8e2'}
running build_ext
/usr/bin/python3 /tmp/pip-install-pekaldf3/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-install-pekaldf3/llvmlite/ffi/build.py", line 105, in main_posix
out = subprocess.check_output([llvm_config, '--version'])
File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/usr/lib/python3.7/subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config': 'llvm-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-install-pekaldf3/llvmlite/ffi/build.py", line 191, in <module>
main()
File "/tmp/pip-install-pekaldf3/llvmlite/ffi/build.py", line 181, in main
main_posix('linux', '.so')
File "/tmp/pip-install-pekaldf3/llvmlite/ffi/build.py", line 108, in main_posix
"to the path for llvm-config" % (llvm_config,))
RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
error: command '/usr/bin/python3' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-pekaldf3/llvmlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-i02sowqg/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-pekaldf3/llvmlite/
Can anyone help with this? I got a lot of obscure errors I was able to fix (as an example Memory Errors due to torch) but I couldn't fix that one (yet)
Hello,
I am complete beginner in realm of Python and Image processing, which btw your work is amazing. Thank you for it.
For most cases your predefined models work great. But in some cases I would like to somehow train/update model which is processing pictures.
I have no idea what is the process.
Can you point me in some direction (step by step tutorial etc.) how to do it?
Again, thank you for your work I ❤️ it
Hi,
I have installed rembg.
it works nice.
However, remove.bg quality is much better than rembg.
How to achieve quality like remove.bg ?
Is there any such software like remove.bg?
Or, how to improve the quality of rembg?
thanks
This probably is impossible, but is there anyway to make the library more lightweight? There is so much overhead.
I want to use it in an app, but pytorch and all the other dependencies can really take up so much space.
please suggest to start rembg server as service in ubuntu.
thanks
Hi!
Thank you for this work. I am working on videos and I extracted all frames and removed background for each frame.
This understandably takes a long time.
Is there a way to fasten this process? Would running os.sys calls on multiple threads help? Are there other techniques that could be used.
Hi , I am trying to install this on MacOS 11.0 (Big sur) it always fails , I have tried different things but it doesn't work
Python version : 3.8.2 , also tried earlier 3.9.0 doesn't work either
Here are my logs:
Using cached https://files.pythonhosted.org/packages/74/5a/46cbdb14769ed50b1fa16d57e7a34c04d7251afbacdd3589cdfa8ad3503e/rembg-1.0.16.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting scikit-image==0.17.2 (from rembg)
Using cached https://files.pythonhosted.org/packages/54/fd/c1b0bb8f6f12ef9b4ee8d7674dac82cd482886f8b5cd165631efa533e237/scikit-image-0.17.2.tar.gz
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-v7cbgt59/scikit-image/setup.py'"'"'; __file__='"'"'/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-v7cbgt59/scikit-image/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-v7cbgt59/scikit-image/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-v7cbgt59/scikit-image/setup.py", line 234, in <module>
'build_ext': openmp_build_ext(),
File "/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-v7cbgt59/scikit-image/setup.py", line 58, in openmp_build_ext
from numpy.distutils.command.build_ext import build_ext
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
➜ rembg-master git:(master) ✗ curl -s http://input.png | rembg > output.png
zsh: command not found: rembg
➜ rembg-master git:(master) ✗ pip install --upgrade pip
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages (20.2.4)
➜ rembg-master git:(master) ✗ which python
/usr/bin/python
➜ rembg-master git:(master) ✗ brew uninstall python
Error: No installed keg or cask with the name "python"
➜ rembg-master git:(master) ✗ python --version
Python 2.7.16
➜ rembg-master git:(master) ✗ python3 --version
Python 3.8.2
➜ rembg-master git:(master) ✗ brew reinstall python
Warning: You are using macOS 11.0.
We do not provide support for this released but not yet supported version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
released but not yet supported version.
==> Downloading https://homebrew.bintray.com/bottles/python%403.9-3.9.0_1.big_
Already downloaded: /Users/nikhilsingh/Library/Caches/Homebrew/downloads/07eae7a7d7ed36eb2ce66e5a1a771df7d9483f58872e38036325d56194554bf8--python@3.9-3.9.0_1.big_sur.bottle.tar.gz
==> Reinstalling [email protected]
==> Pouring [email protected]_1.big_sur.bottle.tar.gz
^C
➜ rembg-master git:(master) ✗ brew reinstall [email protected]
Warning: You are using macOS 11.0.
We do not provide support for this released but not yet supported version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
released but not yet supported version.
==> Downloading https://homebrew.bintray.com/bottles/python%403.8-3.8.6_1.big_
Already downloaded: /Users/nikhilsingh/Library/Caches/Homebrew/downloads/bc25badd58f2a016a9cf5f45f7ec5b4beb87cba2f01324fbad4a351696738a24--python@3.8-3.8.6_1.big_sur.bottle.tar.gz
==> Reinstalling [email protected]
==> Pouring [email protected]_1.big_sur.bottle.tar.gz
==> /usr/local/Cellar/[email protected]/3.8.6_1/bin/python3 -s setup.py --no-user-cfg
==> /usr/local/Cellar/[email protected]/3.8.6_1/bin/python3 -s setup.py --no-user-cfg
==> /usr/local/Cellar/[email protected]/3.8.6_1/bin/python3 -s setup.py --no-user-cfg
==> Caveats
Python has been installed as
/usr/local/opt/[email protected]/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/[email protected]/libexec/bin
You can install Python packages with
/usr/local/opt/[email protected]/bin/pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.8/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have [email protected] first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
==> Summary
🍺 /usr/local/Cellar/[email protected]/3.8.6_1: 4,329 files, 69.4MB
➜ rembg-master git:(master) ✗ python --version
Python 2.7.16
➜ rembg-master git:(master) ✗ python3.8
zsh: command not found: python3.8
➜ rembg-master git:(master) ✗ pip3 install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Rolling back uninstall of pip
Moving to /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip-19.2.3.dist-info/
from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/~ip-19.2.3.dist-info
Moving to /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/
from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/~ip
Moving to /Users/nikhilsingh/Library/Caches/com.apple.python/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/
from /Users/nikhilsingh/Library/Caches/com.apple.python/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/~ip
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/3.8'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
➜ rembg-master git:(master) ✗ pip3 install --upgrade pip --user
Collecting pip
Using cached https://files.pythonhosted.org/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-20.2.4
WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
➜ rembg-master git:(master) ✗ pip3 install --upgrade pip3 --user
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
ERROR: Could not find a version that satisfies the requirement pip3 (from versions: none)
ERROR: No matching distribution found for pip3
➜ rembg-master git:(master) ✗ pip3 install rembg
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting rembg
Using cached rembg-1.0.16.tar.gz (13 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting numpy==1.19.4
Downloading numpy-1.19.4.zip (7.3 MB)
|████████████████████████████████| 7.3 MB 2.6 MB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Users/nikhilsingh/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp2c2qcd32
cwd: /private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-wsstgq1n/numpy
Complete output (225 lines):
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_generator.pyx
Processing numpy/random/_pcg64.pyx
Processing numpy/random/_common.pyx
Cythonizing sources
blas_opt_info:
blas_mkl_info:
customize UnixCCompiler
C compiler: xcrun -sdk macosx clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64
creating /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k/var
creating /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k/var/folders
creating /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k/var/folders/bm
creating /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn
creating /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T
creating /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k
compile options: '-MMD -MF /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k/file.c.d -c'
xcrun: /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp96fh0k1k/file.c
libraries mkl_rt not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
blis_info:
libraries blis not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_info:
libraries openblas not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
libraries tatlas not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_blas_info:
libraries satlas not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_blas_info:
libraries f77blas,cblas,atlas not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
accelerate_info:
libraries accelerate not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
Library accelerate was not found. Ignoring
libraries veclib not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
Library veclib was not found. Ignoring
FOUND:
extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
FOUND:
extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
non-existing path in 'numpy/distutils': 'site.cfg'
lapack_opt_info:
lapack_mkl_info:
libraries mkl_rt not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_lapack_info:
libraries openblas not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_clapack_info:
libraries openblas,lapack not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
flame_info:
libraries flame not found in ['/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
libraries tatlas,tatlas not found in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
libraries lapack_atlas not found in /usr/local/lib
libraries tatlas,tatlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries tatlas,tatlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
libraries lapack_atlas not found in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
libraries satlas,satlas not found in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
libraries lapack_atlas not found in /usr/local/lib
libraries satlas,satlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries satlas,satlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
libraries ptf77blas,ptcblas,atlas not found in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
libraries lapack_atlas not found in /usr/local/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
libraries lapack_atlas not found in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
libraries f77blas,cblas,atlas not found in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
libraries lapack_atlas not found in /usr/local/lib
libraries f77blas,cblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries f77blas,cblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
FOUND:
extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
running dist_info
running build_src
build_src
building py_modules sources
creating build
creating build/src.macosx-10.14.6-x86_64-3.8
creating build/src.macosx-10.14.6-x86_64-3.8/numpy
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/distutils
building library "npymath" sources
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath/npy_math_internal.h
adding 'build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath' to include_dirs.
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath/ieee754.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath/npy_math_complex.c
None - nothing done with h_files = ['build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npymath/npy_math_internal.h']
building library "npysort" sources
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_sort.h
adding 'build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common' to include_dirs.
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/quicksort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/mergesort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/timsort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/heapsort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/radixsort.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_partition.h
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/selection.c
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_binsearch.h
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/npysort/binsearch.c
None - nothing done with h_files = ['build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_sort.h', 'build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_partition.h', 'build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/common/npy_binsearch.h']
building library "npyrandom" sources
building extension "numpy.core._multiarray_tests" sources
creating build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/multiarray
conv_template:> build/src.macosx-10.14.6-x86_64-3.8/numpy/core/src/multiarray/_multiarray_tests.c
building extension "numpy.core._multiarray_umath" sources
Running from numpy source directory.
setup.py:480: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
Traceback (most recent call last):
File "/Users/nikhilsingh/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/Users/nikhilsingh/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/nikhilsingh/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/build_meta.py", line 156, in prepare_metadata_for_build_wheel
self.run_setup()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/build_meta.py", line 236, in run_setup
super(_BuildMetaLegacyBackend,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 508, in <module>
setup_package()
File "setup.py", line 500, in setup_package
setup(**metadata)
File "/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-wsstgq1n/numpy/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/dist_info.py", line 31, in run
egg_info.run()
File "/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-wsstgq1n/numpy/numpy/distutils/command/egg_info.py", line 24, in run
self.run_command("build_src")
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-wsstgq1n/numpy/numpy/distutils/command/build_src.py", line 144, in run
self.build_sources()
File "/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-wsstgq1n/numpy/numpy/distutils/command/build_src.py", line 161, in build_sources
self.build_extension_sources(ext)
File "/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-wsstgq1n/numpy/numpy/distutils/command/build_src.py", line 318, in build_extension_sources
sources = self.generate_sources(sources, ext)
File "/private/var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/pip-install-wsstgq1n/numpy/numpy/distutils/command/build_src.py", line 378, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 436, in generate_config_h
moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
File "numpy/core/setup.py", line 47, in check_types
out = check_types(*a, **kw)
File "numpy/core/setup.py", line 292, in check_types
raise SystemError(
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
----------------------------------------
ERROR: Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Users/nikhilsingh/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/bm/8v69908x5q11f27w9ydcn5kh0000gn/T/tmp2c2qcd32 Check the logs for full command output.```
Help appreciated, thanks!
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'))
Hi @danielgatis ,
From my previous comment on , i did some more research and experimentation and have found that the combinations of alpha matting fg, bg and erosion works well for a set of objects.
For example 240-10-3 with estimate_alpha_cf and estimate_foreground_ml works really really well for animals or things with fine edges like hairs.
190-100-3 with estimate_alpha_rw and estimate_foreground_cf works ok for humans and excellent for other non-living objects like phone, laptop, fruits, (things with more crisp boundaries).
Any thoughts or understanding on how to make the results for humans better?
I also have one other observation I found and thought to share.
For the same code and different machine specs, I am seeing different output. The main difference is of the CPU and RAM (both my machines don't have a GPU). In your opinion, does the capacity of the machine matters?
Uploading a few samples from my experiments. Any direction or help would be appreciated.
https://drive.google.com/file/d/1m0EokvSPmqjDp3hov5qm5jlcq6wkD8Rt/view?usp=sharing
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'))
hey there first off thanks for putting this together. I'm trying to use it to remove the background of product photos of shoes and I need them to be remove dot bee gee level accurate... any way to 'increase the power'?
cheers
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
Hi.
I get the following error after the pip install rembg command.
ERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-0r0l8i3_/scikit-image/setup.py'"'"'; __file__='"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-0r0l8i3_/scikit-image/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-pip-egg-info-oipq9o0h cwd: /private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-0r0l8i3_/scikit-image/ Complete output (7 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-0r0l8i3_/scikit-image/setup.py", line 234, in <module> 'build_ext': openmp_build_ext(), File "/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-0r0l8i3_/scikit-image/setup.py", line 58, in openmp_build_ext from numpy.distutils.command.build_ext import build_ext ModuleNotFoundError: No module named 'numpy' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I got this error while installing the program. Please kindly help.
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\phearun\appdata\local\programs\python\python39\python.exe' 'c:\users\phearun\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Phearun\AppData\Local\Temp\tmpdhlvhxvg'
cwd: C:\Users\Phearun\AppData\Local\Temp\pip-install-nacjzc_u\scipy
Complete output (195 lines):
setup.py:460: UserWarning: Unrecognized setuptools command ('dist_info --egg-base C:\Users\Phearun\AppData\Local\Temp\pip-modern-metadata-e08wg4a2'), proceeding with generating Cython sources and expanding templates
warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
Running from SciPy source directory.
lapack_opt_info:
lapack_mkl_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in ['c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
openblas_lapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in ['c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\libs']
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
NOT AVAILABLE
openblas_clapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas,lapack not found in ['c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
flame_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries flame not found in ['c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\phearun\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in c:\users\phearun\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\phearun\appdata\local\programs\python\python39\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in c:\users\phearun\appdata\local\programs\python\python39\libs
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\phearun\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in c:\users\phearun\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\phearun\appdata\local\programs\python\python39\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in c:\users\phearun\appdata\local\programs\python\python39\libs
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\phearun\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in c:\users\phearun\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\phearun\appdata\local\programs\python\python39\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in c:\users\phearun\appdata\local\programs\python\python39\libs
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\phearun\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in c:\users\phearun\appdata\local\programs\python\python39\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in C:\
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:\users\phearun\appdata\local\programs\python\python39\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in c:\users\phearun\appdata\local\programs\python\python39\libs
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
accelerate_info:
NOT AVAILABLE
lapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack not found in ['c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\lib', 'C:\\', 'c:\\users\\phearun\\appdata\\local\\programs\\python\\python39\\libs']
NOT AVAILABLE
C:\Users\Phearun\AppData\Local\Temp\pip-build-env-6gv_wa52\overlay\Lib\site-packages\numpy\distutils\system_info.py:1712: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
if getattr(self, '_calc_info_{}'.format(lapack))():
lapack_src_info:
NOT AVAILABLE
C:\Users\Phearun\AppData\Local\Temp\pip-build-env-6gv_wa52\overlay\Lib\site-packages\numpy\distutils\system_info.py:1712: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
if getattr(self, '_calc_info_{}'.format(lapack))():
NOT AVAILABLE
Traceback (most recent call last):
File "c:\users\phearun\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
main()
File "c:\users\phearun\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:\users\phearun\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:\Users\Phearun\AppData\Local\Temp\pip-build-env-6gv_wa52\overlay\Lib\site-packages\setuptools\build_meta.py", line 161, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:\Users\Phearun\AppData\Local\Temp\pip-build-env-6gv_wa52\overlay\Lib\site-packages\setuptools\build_meta.py", line 253, in run_setup
super(_BuildMetaLegacyBackend,
File "C:\Users\Phearun\AppData\Local\Temp\pip-build-env-6gv_wa52\overlay\Lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 583, in <module>
setup_package()
File "setup.py", line 579, in setup_package
setup(**metadata)
File "C:\Users\Phearun\AppData\Local\Temp\pip-build-env-6gv_wa52\overlay\Lib\site-packages\numpy\distutils\core.py", line 137, in setup
config = configuration()
File "setup.py", line 477, in configuration
raise NotFoundError(msg)
numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\phearun\appdata\local\programs\python\python39\python.exe' 'c:\users\phearun\appdata\local\programs\python\python39\lib\site-packages\pip_vendor\pep517_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Phearun\AppData\Local\Temp\tmpdhlvhxvg' Check the logs for full command output.
Hey,
I really like your project! It really helped me a lot.
But I have a small issue: I am currently building a Docker Container with a FastAPI Server for rembg, to deploy it via Kubernetes and get a pretty scalable and cheap Background Removal as a Service.
I will release that later, but I have a performance issue:
In bg.py you automatically load both models, but I will only use the u2netp one.
I want to speed up the API as fast as I can, and therefore there should be a config option (there is no config, yet?) to only load the needed model.
That will be a difficult task tho, I don't really know how to implement it since this module is not a class and I can't add parameters to it or anything.
Greetings,
Altay@Dorfmeyster
Hello
Thanks for the awesome model + tools.
How can I make c++ version of this app ?
pip install rembg
Collecting rembg
Using cached rembg-1.0.16.tar.gz (13 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting waitress==1.4.4
Using cached waitress-1.4.4-py2.py3-none-any.whl (58 kB)
Collecting numpy==1.19.4
Using cached numpy-1.19.4-cp39-cp39-win_amd64.whl (13.0 MB)
Collecting scikit-image==0.17.2
Downloading scikit-image-0.17.2.tar.gz (29.8 MB)
|████████████████████████████████| 29.8 MB 6.8 MB/s
ERROR: Command errored out with exit status 1:
command: 'd:\lab\rembg\rembg-env\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\karbo\\AppData\\Local\\Temp\\pip-install-x23l74te\\scikit-image\\setup.py'"'"'; __file__='"'"'C:\\Users\\karbo\\AppData\\Local\\Temp\\pip-install-x23l74te\\scikit-image\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\karbo\AppData\Local\Temp\pip-pip-egg-info-ic2ueh8m'
cwd: C:\Users\karbo\AppData\Local\Temp\pip-install-x23l74te\scikit-image\
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\karbo\AppData\Local\Temp\pip-install-x23l74te\scikit-image\setup.py", line 234, in <module>
'build_ext': openmp_build_ext(),
File "C:\Users\karbo\AppData\Local\Temp\pip-install-x23l74te\scikit-image\setup.py", line 58, in openmp_build_ext
from numpy.distutils.command.build_ext import build_ext
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 20.3.1 is available.
You should consider upgrading via the 'd:\lab\rembg\rembg-env\scripts\python.exe -m pip install --upgrade pip' command.
(rembg-env) PS D:\Lab\rembg\rembg-env> python --version
Python 3.9.0
ERROR: Could not find a version that satisfies the requirement torch==1.6.0 (from rembg) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.6.0 (from rembg)
I also get this error when I try to install torch.
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/[email protected]/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py'"'"'; __file__='"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-wheel-fdh_s1h4
cwd: /private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/
Complete output (30 lines):
running bdist_wheel
running build
running build_deps
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py", line 225, in <module>
setup(name="torch", version="0.1.2.post2",
File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 290, in run
self.run_command('build')
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py", line 51, in run
from tools.nnwrap import generate_wrappers as generate_nn_wrappers
ModuleNotFoundError: No module named 'tools.nnwrap'
----------------------------------------
ERROR: Failed building wheel for torch
Running setup.py clean for torch
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/[email protected]/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py'"'"'; __file__='"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
cwd: /private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch
Complete output (2 lines):
running clean
error: [Errno 2] No such file or directory: '.gitignore'
----------------------------------------
ERROR: Failed cleaning build dir for torch
Failed to build torch
Installing collected packages: torch
Running setup.py install for torch ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/[email protected]/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py'"'"'; __file__='"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-record-cp5gwhp7/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/torch
cwd: /private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/
Complete output (23 lines):
running install
running build_deps
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py", line 225, in <module>
setup(name="torch", version="0.1.2.post2",
File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py", line 99, in run
self.run_command('build_deps')
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py", line 51, in run
from tools.nnwrap import generate_wrappers as generate_nn_wrappers
ModuleNotFoundError: No module named 'tools.nnwrap'
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/[email protected]/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py'"'"'; __file__='"'"'/private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-install-jn4ttpcw/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/d9/3nm1w1td445fj9yfy49kl3300000gn/T/pip-record-cp5gwhp7/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/torch Check the logs for full command output.
Hello,
Thanks for your code, unfortunately I'm unable to make it work on a Mac.
After installing here's the error I encounter:
✘ julien@mbp-ju-2 ~/Desktop rembg -p photos
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/rembg", line 5, in
from rembg.cmd.cli import main
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rembg/cmd/cli.py", line 7, in
from ..bg import remove
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rembg/bg.py", line 67, in
@functools.lru_cache
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/functools.py", line 477, in lru_cache
raise TypeError('Expected maxsize to be an integer or None')
TypeError: Expected maxsize to be an integer or None
Do you think you can help?
Thanks a lot!
I have this picture in this link. How can i get all text and people ?
https://res.cloudinary.com/teepublic/image/private/s--RvwfU0hK--/t_Preview/b_rgb:191919,c_limit,f_auto,h_630,q_90,w_630/v1598124169/production/designs/13316062_0.jpg
Current i only get people.
Please suggestion
thanks
How about allowing to rea a pre-downloaded model from disk using some ENV variable that could be configured? I just set up an AWS Lambda using docker image and had to manually update the code to use model from disk because I had some issues with the downloaded models (AWS Lambda has some specific runtime requirements which made it harder to configure with caching option.). What do you think about this use case?
I am getting this error. Python version is Python 3.7.6 (64-bit).
ERROR: Could not find a version that satisfies the requirement torchvision==0.7.0 (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.3.0, 0.4.1, 0.5.0)
ERROR: No matching distribution found for torchvision==0.7.0 (from rembg)
yum install python38-devel
Last metadata expiration check: 1:21:27 ago on Sat 26 Dec 2020 03:52:16 AM UTC.
Package python38-devel-3.8.3-3.module_el8.3.0+468+0c52a667.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
rembg -o /root/test/test.png /root/test/test.jpg
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-1.1.1-py3.8.egg/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 11, in
load_entry_point('rembg==1.0.17', 'console_scripts', 'rembg')()
File "/usr/lib/python3.8/site-packages/pkg_resources/init.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.8/site-packages/pkg_resources/init.py", line 2852, in load_entry_point
return ep.load()
File "/usr/lib/python3.8/site-packages/pkg_resources/init.py", line 2443, in load
return self.resolve()
File "/usr/lib/python3.8/site-packages/pkg_resources/init.py", line 2449, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 655, in _load_unlocked
File "", line 618, in _load_backward_compatible
File "", line 259, in load_module
File "/usr/local/lib/python3.8/site-packages/rembg-1.0.17-py3.8.egg/rembg/cmd/cli.py", line 9, in
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 655, in _load_unlocked
File "", line 618, in _load_backward_compatible
File "", line 259, in load_module
File "/usr/local/lib/python3.8/site-packages/rembg-1.0.17-py3.8.egg/rembg/bg.py", line 6, in
File "/usr/local/lib/python3.8/site-packages/PyMatting-1.1.1-py3.8.egg/pymatting/init.py", line 2, in
import pymatting_aot.cc
File "/usr/local/lib/python3.8/site-packages/PyMatting-1.1.1-py3.8.egg/pymatting_aot/cc.py", line 28, in
compile_modules()
File "/usr/local/lib/python3.8/site-packages/PyMatting-1.1.1-py3.8.egg/pymatting_aot/cc.py", line 4, in compile_modules
from numba.pycc import CC
File "/usr/local/lib/python3.8/site-packages/numba-0.52.0-py3.8-linux-x86_64.egg/numba/init.py", line 19, in
from numba.core import config
File "/usr/local/lib/python3.8/site-packages/numba-0.52.0-py3.8-linux-x86_64.egg/numba/core/config.py", line 16, in
import llvmlite.binding as ll
File "/usr/local/lib/python3.8/site-packages/llvmlite-0.35.0-py3.8.egg/llvmlite/binding/init.py", line 4, in
from .dylib import *
File "/usr/local/lib/python3.8/site-packages/llvmlite-0.35.0-py3.8.egg/llvmlite/binding/dylib.py", line 3, in
from llvmlite.binding import ffi
File "/usr/local/lib/python3.8/site-packages/llvmlite-0.35.0-py3.8.egg/llvmlite/binding/ffi.py", line 153, in
raise OSError("Could not load shared object file: {}".format(_lib_name))
OSError: Could not load shared object file: libllvmlite.so
please help
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
[root@ ]# 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
Great work! Keep improving it !! Best Regards !!
Downloading model to /home/xxx/.u2net/u2net.pth
u2net.pth?dl=1: 0.00B [00:01, ?B/s]
FileNotFoundError: [Errno 2] No such file or directory: '/home/xxx/.u2net/u2net.pth'
I'm hitting an error when installing,
ERROR: Could not find a version that satisfies the requirement torch==1.6.0 (from rembg) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.6.0 (from rembg)
Hi,
I tried following image and got error.
curl -s https://i.pinimg.com/564x/b0/f2/50/b0f250c4f155a12e916d7ccd46f63bcb.jpg | rembg > output.png
Traceback (most recent call last):
File "/Users/nowhereman/.pyenv/versions/pydata/bin/rembg", line 6, in <module>
from rembg.cmd.cli import main
File "/Users/nowhereman/.pyenv/versions/3.7.3/envs/pydata/lib/python3.7/site-packages/rembg/cmd/cli.py", line 7, in <module>
from ..bg import remove
File "/Users/nowhereman/.pyenv/versions/3.7.3/envs/pydata/lib/python3.7/site-packages/rembg/bg.py", line 67, in <module>
@functools.lru_cache
File "/Users/nowhereman/.pyenv/versions/3.7.3/lib/python3.7/functools.py", line 477, in lru_cache
raise TypeError('Expected maxsize to be an integer or None')
TypeError: Expected maxsize to be an integer or None
Any comment?
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)
@danielgatis
Hello, most of my pictures have been rotating to the right (90 degrees) after removing their backgrounds. Does anyone know how to solve this issue? Thanks a lot!
Down below, I attach one of the pictures that I face this issue:
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!
Hello Daniel,
This project works great out of the box. Thanks for sharing.
I'm working on a hobby project but I realized it works slow on CPU (30 sec for a 1200x1800 image).
What I wonder is, if I use a server with a GPU support (e.g. google compute engine), how much the result will change.
I saw this line so I think it will use CUDA if it's available. Is this correct?
The last question is, how much performance boost I will be able to see? 2x or 3x maybe?
Thanks,
Cihad
I installed pytorch 1.7.1 with anaconda.
When I run pip install rembg
it said
ERROR: Could not find a version that satisfies the requirement torch==1.7.0 (from rembg) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 1.7.1)
ERROR: No matching distribution found for torch==1.7.0 (from rembg)
Does rembg need torch exact version 1.7.0?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.