mmagic.models.editors.stylegan2.ada.augment
¶
Module Contents¶
Classes¶
Augmentation pipeline include multiple geometric and color |
Functions¶
|
Constructing transformation matrices. |
|
Construct 2d translation matrix. |
|
Construct 3d translation matrix. |
|
Construct 2d scaling matrix. |
|
Construct 3d scaling matrix. |
|
Construct 2d rotating matrix. |
|
Constructing 3d rotating matrix. |
|
Construct inverse matrix of 2d translation matrix. |
|
Construct inverse matrix of 2d scaling matrix. |
|
Construct inverse matrix of 2d rotating matrix. |
Attributes¶
- mmagic.models.editors.stylegan2.ada.augment.matrix(*rows, device=None)[source]¶
Constructing transformation matrices.
- Parameters
device (str|torch.device, optional) – Matrix device. Defaults to None.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.translate2d(tx, ty, **kwargs)[source]¶
Construct 2d translation matrix.
- Parameters
tx (float) – X-direction translation amount.
ty (float) – Y-direction translation amount.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.translate3d(tx, ty, tz, **kwargs)[source]¶
Construct 3d translation matrix.
- Parameters
tx (float) – X-direction translation amount.
ty (float) – Y-direction translation amount.
tz (float) – Z-direction translation amount.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.scale2d(sx, sy, **kwargs)[source]¶
Construct 2d scaling matrix.
- Parameters
sx (float) – X-direction scaling coefficient.
sy (float) – Y-direction scaling coefficient.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.scale3d(sx, sy, sz, **kwargs)[source]¶
Construct 3d scaling matrix.
- Parameters
sx (float) – X-direction scaling coefficient.
sy (float) – Y-direction scaling coefficient.
sz (float) – Z-direction scaling coefficient.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.rotate2d(theta, **kwargs)[source]¶
Construct 2d rotating matrix.
- Parameters
theta (float) – Counter-clock wise rotation angle.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.rotate3d(v, theta, **kwargs)[source]¶
Constructing 3d rotating matrix.
- Parameters
v (torch.Tensor) – Luma axis.
theta (float) – Rotate theta counter-clock wise with
v
as the axis.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.translate2d_inv(tx, ty, **kwargs)[source]¶
Construct inverse matrix of 2d translation matrix.
- Parameters
tx (float) – X-direction translation amount.
ty (float) – Y-direction translation amount.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.scale2d_inv(sx, sy, **kwargs)[source]¶
Construct inverse matrix of 2d scaling matrix.
- Parameters
sx (float) – X-direction scaling coefficient.
sy (float) – Y-direction scaling coefficient.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- mmagic.models.editors.stylegan2.ada.augment.rotate2d_inv(theta, **kwargs)[source]¶
Construct inverse matrix of 2d rotating matrix.
- Parameters
theta (float) – Counter-clock wise rotation angle.
- Returns
- Transformation matrices in np.ndarry or torch.Tensor
format.
- Return type
ndarry | Tensor
- class mmagic.models.editors.stylegan2.ada.augment.AugmentPipe(xflip=0, rotate90=0, xint=0, xint_max=0.125, scale=0, rotate=0, aniso=0, xfrac=0, scale_std=0.2, rotate_max=1, aniso_std=0.2, xfrac_std=0.125, brightness=0, contrast=0, lumaflip=0, hue=0, saturation=0, brightness_std=0.2, contrast_std=0.5, hue_max=1, saturation_std=1, imgfilter=0, imgfilter_bands=[1, 1, 1, 1], imgfilter_std=1, noise=0, cutout=0, noise_std=0.1, cutout_size=0.5)[source]¶
Bases:
torch.nn.Module
Augmentation pipeline include multiple geometric and color transformations.
Note: The meaning of arguments are written in the comments of
__init__
function.