* Package name : rembg Version : 2.0.72 Upstream Contact: Daniel Gatis * URL : https://github.com/danielgatis/rembg * License : MIT Programming Lang: Python Description : CLI tool to remove image backgrounds Rembg is a tool to remove image backgrounds. It can be used as a CLI, Python library, HTTP server, or Docker container. It supports both CPU and GPU acceleration backends.
Hi, I have seen this tool on LinkedIn and it looks very promising. However, rembg requires the download of AI models at the first start (see [1]). This is a major issue for a Debian package, as the Policy does not allow downloading files from the internet during runtime or the build process. Furthermore, there is ongoing discussion within the project on how to treat pre-trained models regarding the DFSG (source-only vs. binary data). Can you describe how these models are handled and if there is a way to use locally provided models instead of the automatic download via pooch? Thanks! [1] https://github.com/danielgatis/rembg/blob/main/README.md#models
Hi, I have seen this tool on LinkedIn and it looks very promising. However, rembg requires the download of AI models at the first start (see [1]). This is a major issue for a Debian package, as the Policy does not allow downloading files from the internet during runtime or the build process. Furthermore, there is ongoing discussion within the project on how to treat pre-trained models regarding the DFSG (source-only vs. binary data). Can you describe how these models are handled and if there is a way to use locally provided models instead of the automatic download via pooch? Thanks! [1] https://github.com/danielgatis/rembg/blob/main/README.md#models
Hi, looking at the code, rembg will only download the models if they are not present in `$XDG_USER_DATA/.u2net/`. So local-only is possible. With a little patching (adding an empty `downloader` function to each model class) it should be possible to even disable the automatic download. (I'm happy to do the patching, if needed.) If none of the available models is DSFG-compliant (I haven't checked), then rembg could be treated as an engine for a game with proprietary assets (i.e., put in contrib). Regards,
Disabling the downloading can be done with tiny 1-line patches, one patch for each model. The code that deals with the model files is (currently) very simple. Yes, `rembg d` (undocumented, but it works fine). Regards,
Awesome, Thanks for bringing this up! When I have time, I will start packaging it :)--- Arian arian.ott@ieee.org
Hello, This message serves as a summary of an off-list interaction between Gioele Barabucci and myself regarding the packaging status of python-rembg. To ensure proper documentation I am posting the key findings here.----- BEGIN FINDINGS ----- 1. Package status Current status of the package: * rembg passes the entire salsa-ci pipeline [1] * I identified pymatting as missing dependency, causing a ModuleNotFoundError, which I will package separately. * The included pytest was deactivated, as it requires external models to run. [2] 2. Investigation on model downloads We investigated the automatic model download to ensure DFSG compliance. * A review confirmed that nothing triggers an automatic download during the build phase * While the source code (specifically in rembg/sessions) contains download_models methods that use pooch.retrieve , these paths are not executed during the build. An example of said download method can be found here. [3]----- END FINDINGS ----- Taking all findings in account we must conclude that rembg is eligible for the main repos, as no model is downloaded during build time. Furthermore patching the download_models methods is no longer needed [4] This bug has been blocked by the pymatting ITP to document dependencies. References: [1] https://salsa.debian.org/Arian-Ott/python-rembg/-/pipelines/1009987 [2] https://github.com/danielgatis/rembg/blob/4ef22cea5a32279680720d758a0755f65ecc7fb4/tests/ test_remove.py#L22-L38 [3] https://github.com/danielgatis/rembg/blob/4ef22cea5a32279680720d758a0755f65ecc7fb4/rembg/sessions/u2net.py#L62-L72 [4] For context see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1125925#20 Best,--- Arian Ott arian.ott@ieee.org