RemBG

This is a Julia implementation of the python package rembg.

Quick Start

using RemBG
using Images

exampledir(args...) = abspath(joinpath(dirname(pathof(RemBG)), "..", "examples", args...))

img = load(exampledir("animal-1.jpg"))
img_num = copy(channelview(img))

output_img_num = remove(img_num)
output_img = remove(img)  # If we do not pass an inference session to `remove`, it will use a new session containing the U2Net model.
# Use a specific model. The available models are U2Net, U2Netp, U2NetClothSeg, U2NetHumanSeg, Silueta, ISNetGeneralUse
session = new_session(U2Netp)
output_img_num = remove(img_num; session=session)
output_img = remove(img; session=session)
output_img = remove(img; only_mask=true)  # return mask
output_img = remove(img; bgcolor=(255, 0, 0, 255))  # apply background color