16 RemBG with U2Net
20211014 Package: rembg by Yan Liu.
Removing the background from an image (referred to in the business as generating a cutout) can be a tedious task, unless you think to use AI to do it for you, in 5 minutes or less. This MLHub package demonstrates how to do just that. Utilising the u2net framework, this rembg package can run a quick demo that visualises the results, for you to determine whether this package fits your needs. The capability is then provided as a command line tool, producing a cutout from any image file.
To install, configure, and demonstrate the package, calling it u2net (expecting other u2net capabilities to be added over time):
ml install https://github.com/StafferOliver/rembg as u2net ml configure u2net ml readme u2net ml commands u2net ml demo u2net
Notice the use of the as operator to rename the package locally as u2net. This functionally is experimental and not yet released. For now, replace u2net with rembg in the examples in this chapter.
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0