Shortcuts

mmedit.models.utils.get_unknown_tensor

mmedit.models.utils.get_unknown_tensor(trimap, unknown_value=0.5019607843137255)[source]

Get 1-channel unknown area tensor from the 3 or 1-channel trimap tensor.

Parameters
  • trimap (Tensor) – Tensor with shape (N, 3, H, W) or (N, 1, H, W).

  • unknown_value (float) – Scalar value indicating unknown region in trimap. If trimap is pre-processed using ‘rescale_to_zero_one’, then 0 for bg, 128/255 for unknown, 1 for fg, and unknown_value should set to 128 / 255. If trimap is pre-processed by FormatTrimap(to_onehot=False)(), then 0 for bg, 1 for unknown, 2 for fg and unknown_value should set to 1. If trimap is pre-processed by FormatTrimap(to_onehot=True)(), then trimap is 3-channeled, and this value is not used.

Returns

Unknown area mask of shape (N, 1, H, W).

Return type

Tensor

Read the Docs v: zyh/doc-notfound-extend
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.