Comments (4)
For anyone else coming here for the exact same issue. Some interesting notes that I made while researching this:
The onyxruntime does not allow querying of active cards. You need to have pytorch or tensorflow, but this will only work if they have the very large GPU deps loaded (yuck). You can query otherwise with nvidia-smi.
You can manually set the GPU device via environmental variables
export CUDA_VISIBLE_DEVICES=0
export CUDA_VISIBLE_DEVICES=1
from rembg.
Okay, i was able to implement this in my front end with a --gpu-count 2
If anyone wants to check that out see removebackground
cmdlet in https://github.com/zackees/zcmds
from rembg.
To close the loop on this, what was going on is that despite the install instructions, I could not get rembg to use the GPU on windows using the pipx install. I think it's possible to do an isolated environment and conditionally inject the needed torch files.
The work around for performance is to recognize that the CPU version of the executor does not seems to utilize threads effectively so you can actually get a lot more performance if you split up the number of files into separate folders and run the p
tool on each, then merge back into one folder.
On my 12 CPU machine I was able to max out the performance at about 5 processes. Each process will report that it's running 4.5 seconds per iteration, so in AVERAGE that is under 1 second per image, so I consider that a massive win. The single threaded performance is about 2.8 seconds per image on my machine. So running parallel rembg p
gave me a speedup of about 3x.
from rembg.
Is there support for metal acceleration (macs)?
from rembg.
Related Issues (20)
- EP error onnxruntime error HOT 5
- [BUG] rembg import remove, ImportError HOT 2
- [BUG] ... HOT 2
- run rembg error HOT 8
- The resulting image is not clear enough, There are silhouettes behind the characters HOT 2
- The resulting image is not clear enough, There are silhouettes behind the characters HOT 1
- SAM model returns inversed HOT 4
- [FEATURE] Username and password authentication on the web server HOT 2
- [FEATURE] Ability to keep metadata HOT 2
- Strange detection behavior. HOT 2
- [BUG] ... HOT 2
- rembg import problem HOT 1
- Remove Background - Numba needs NumPy 1.25 or less ERROR HOT 2
- Github Security Lab Vulnerability Report HOT 3
- p switch -w fails with error HOT 1
- Cannot use GPU HOT 4
- The GPU is not working. `onnxruntime-gpu` does not seem to be activated in any case. HOT 1
- FAIL : Failed to load library libonnxruntime_providers_cuda.so with error: libcublasLt.so.12: cannot open shared object file: No such file or directory
- [BUG] Sam model "rectangle" is missing a step to apply the mask (CLI)
- [BUG] llvmlite fails building upon pip install
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rembg.