computes a soft mask of an object you click on, using a neural network. press
select, then left click on the image to add to the selection and right click
to remove from it, or drag a box around the object. with a box the network only
sees the box and a margin around it, zoomed in, and the mask is empty outside of
that. with draw start you can instead roughly paint over the object, the
network turns the strokes into a clean mask. strokes, clicks and a box can be
combined.
the network runs once per click and gets the mask of the run before as input, so later clicks refine the selection. with many clicks, the first run gets the first click and the four runs after it the latest clicks. if the object is small, the network runs once more zoomed in on a region around the mask, for finer edges.
use the mask as the mask input of a blend module,
refined by a guided filter. the select-exposure preset
shows how.
the weights are read from ~/.config/vkdt/data/select-*.dat, one file per
network: nclk for nvidia, aclk for amd, iclk for intel gpus with 8x16x16
cooperative matrices and gclk for everything else, arch overrides the
choice. without weights the mask is empty.
you can download the weights package here.
arch which network to run: auto picks by gpu vendorclick the number of clicks, followed by x, y and 1 (add) or 0 (remove) for
each click, in coordinates of the input imagebox x0 y0 x1 y1 of a box around the object in coordinates of the input image,
an empty box means nonedraw brush strokes, see the draw moduleradius the brush radius as fraction of the image widthzoom run the network a second time zoomed in on small objectshard blend from the soft mask to a hard one: threshold at one half and
shrink it, so it sits safely inside the object. a guided filter then grows it
back to the edges in the imageshrink how far to shrink the hard mask, relative to the image widthinput scene-referred linear rec2020output the maskthe network was trained from scratch on the segmentation masks and annotator clicks of Open Images V7 (annotations CC BY 4.0, images CC BY 2.0). no pretrained weights were used and no images are distributed.
the spir-v is generated using denox and vkdt-denox.