sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training package¶
Submodules¶
sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment module¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment.matrix(*rows, device=None)[source]¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment.rotate2d(theta, **kwargs)[source]¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment.rotate2d_inv(theta, **kwargs)[source]¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment.rotate3d(v, theta, **kwargs)[source]¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment.scale2d(sx, sy, **kwargs)[source]¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment.scale2d_inv(sx, sy, **kwargs)[source]¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment.scale3d(sx, sy, sz, **kwargs)[source]¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.augment.translate2d(tx, ty, **kwargs)[source]¶
sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.canvas_loss module¶
sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.dataset module¶
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.dataset.Dataset(name, raw_shape, original_resolution=None, max_size=None, use_labels=False, xflip=False, random_seed=0, transform=None)[source]¶
Bases:
Dataset- property has_labels¶
- property has_onehot_labels¶
- property image_shape¶
- property label_dim¶
- property label_shape¶
- property name¶
- property num_channels¶
- property original_resolution¶
- property resolution¶
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.dataset.EnsureChannelDimension[source]¶
Bases:
object
sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.geom_loss module¶
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.geom_loss.DiceLoss[source]¶
Bases:
Module- forward(source, target)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.geom_loss.GeometryLoss(device, color_format='triad', internal_loss_dict={})[source]¶
Bases:
objectThe loss that wraps one or more segmentation losses between the “foreground” component and the geometry input.
- _foreground_data(component, gen_data)[source]¶
Returns the foreground component of the Generator output. If color_format is triad, component can only take the value of uvs. If color_format is canvas, component can be either uvs or alpha, although we never use uvs here. @param component: a str, indicating the component to use for computing geom_loss. Valid values: “uvs” and “alpha” @param gen_data: a dict object that holds the output of the Generator. @return: a torch.Tensor of size [B, C, W, H]
- _validate_internal_dict(color_format, internal_loss_dict)[source]¶
Given two possible values for color_format - ‘triad’ and ‘canvas’ check if the corresponding weight of losses is provided. For ‘triad’, the user must provide geom_uvs_weights, and geom_alpha_weights is ignored. For canvas, the user must provide either geom_alpha_weights or geom_alpha_weights, or both. @param color_format @param internal_loss_dict: A dict object with keys geom_loss_types, geom_uvs_weights and geom_alpha_weights
geom_loss_types maps to a list of name string of losses; geom_uvs_weights and geom_alpha_weights maps to a list of floats.
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.geom_loss.IoULoss[source]¶
Bases:
Module- forward(source: Tensor, target: Tensor)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.geom_loss._MaskLoss(loss_types=['bce'])[source]¶
Bases:
objectmaskLoss makes use of the mask produced by color triad.
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.geom_loss.init_segmentation_loss(loss_type)[source]¶
- sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.geom_loss.logger = <Logger sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.geom_loss (NOTSET)>¶
Format of internal_loss_dict: {
geom_loss_weights: [], geom_uvs_types: [], geom_alpha_types: []
}
sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.loss module¶
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.loss.Loss[source]¶
Bases:
object
sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.loss_modified module¶
sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.loss_util module¶
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.loss_util.RGB2Gray[source]¶
Bases:
Module- forward(img)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class sketchkit.stylization.brushstrokesengine.thirdparty.stylegan2_ada_pytorch.training.loss_util.gradientLayer(edge_ksize=3)[source]¶
Bases:
Module- forward(img)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.