Repository navigation
FAQ
Answers to common questions about installing and running the background removal service. If your question is not here, open an issue.
The model weights are not in the repository. Download isnet-general-use.pth into service/isnet/model/ (IS-Net) or u2net.pth into service/u2net/model/ (U²-Net). See Models. Also make sure you start uvicorn from the repository root, because the paths are relative.
Run uvicorn from the repository root so that service is importable: uvicorn service.app:app --host localhost --port 8000.
The IS-Net engine imports imageio and tqdm. They are normally installed as dependencies of scikit-image and gdown. If your environment is missing them, run pip install imageio tqdm.
IS-Net (service.app:app). It is the newer model, runs at 1024 × 1024 and uses the GPU when available. U²-Net (service.app_u2net:app) is kept for compatibility. See Models.
The IS-Net engine prints Device: cuda or Device: cpu at start-up, and every response includes the S-Processing-Device header. If it says cpu, install a CUDA-enabled PyTorch build.
A PNG image (RGBA) with the same size as the input and a transparent background, plus the headers S-Processing-Time, S-Processing-Server and (IS-Net) S-Processing-Device. See API Reference.
The IS-Net engine normalizes three color channels. Images with an alpha channel (RGBA PNG) have four channels and can fail. Convert the image to RGB (for example JPEG, or PNG without transparency) before sending it.
Not from another origin: the app does not configure CORS. Call it from your back end or serve it behind a reverse proxy on the same origin. See Deployment.
No. The service is meant to run inside your infrastructure. Protect it with a reverse proxy or a private network before exposing it. See Deployment.
Not through the API; the endpoints always return a transparent PNG. You can composite the result over any background in your own code. The U²-Net engine contains a change_background helper you can use as a starting point.