20.3 u2net demo


The pre-built demonstration highlights the capabilities of the package. Several images are put through the pre-built cutout model to deliver the cutout.

ml demo u2net

U2Net is a Python library for static image background removal
(cutout). This MLHub package is based on u2net as the backbone 
network. The pretrained model for u2net will be downloaded as

See https://arxiv.org/pdf/2005.09007.pdf for a paper describing
the pre-built model and https://github.com/xuebinqin/U-2-Net
for details.

For this demo we will randomly choose an image from which to 
generate a cutout and then display the original and the cutout.

The first two examples illustrate the default cutout and the third
utilises alpha matting to obtain the cutout.

Press Enter to continue: 

Cutout Example 1

Press Enter to perform basic cutout on animal-2.jpg: 

Downloading u2net.pth
Downloading u2net.pth to model:  168M/168M [00:25, 6.46MiB/s]

Close the graphic window using Ctrl-W.

Press Enter to continue:

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-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0