Skip to main content Link Search Menu Expand Document (external link)

Table of contents

  1. What can I do with it?
  2. How do I use it?
  3. Example work
  4. Credits and references

orml-u2net

A U^2-net that extracts salient parts from input images.

What can I do with it?

Extract salient parts from an image.

To understand that a bit better consider this image:

cheetah

U^2-net finds the most salient parts of the input image and produces a matte image.

matte

The matte image can be used to create a cut-out of the foreground objects.

foreground

How do I use it?

To load a U2Net instance

val u2net = U2Net.load()

After loading the net there are 3 ways to use it:

To remove the background from an image:

val foreground = u2net.removeBackground(inputImage)

To remove the foreground from an image (exactly the inverse of removing the background)

val background = u2net.removeForeground(inputImage)

To get a matte image for the image

val matte = u2net.matte()

Example work

Credits and references

Based on: