threedb.controls.blender.imagenet_c

Apply corruptions to renderings. An example config file using this control can be found here: https://github.com/3db/3db/tree/main/examples/unit_tests/imagenet_c.yaml.

class threedb.controls.blender.imagenet_c.ImagenetCControl(root_folder: str)

Bases: threedb.controls.base_control.PostProcessControl

Applies the ImageNet-C corruptions from https://github.com/hendrycks/robustness.

Discrete Dimensions:

  • corruption_name: The name of corruption that will be applied. Includes

    ‘gaussian_noise’, ‘shot_noise’, ‘impulse_noise’, ‘defocus_blur’, ‘glass_blur’, ‘motion_blur’, ‘zoom_blur’, ‘snow’, ‘frost’, ‘fog’, ‘speckle_noise’, ‘gaussian_blur’, ‘spatter’, ‘saturate’, ‘brightness’, ‘contrast’, ‘elastic_transform’, ‘pixelate’, ‘jpeg_compression’.

  • severity: Imagenet-C severity parameter. (range: {0, 1, 2, 3, 4, 5})

Example images

Examples of impulse noise application at various severity levels.

__init__(root_folder: str)

Construct a BaseControl

Parameters

root_folder – The folder containing all the data for this 3DB experiment. All paths are lative to his folder

apply(render: torch.Tensor, control_args: Dict[str, Any])torch.Tensor

Modify a rendered image and return the transformed output.

Parameters
  • render (ch.Tensor) – A tensor representation of the rendered image.

  • control_args (Dict[str, Any]) – Control-specific settings (e.g., noise level for noise corruption, contrast level for contrast change, etc.).

Returns

The post-processed output.

Return type

ch.Tensor

unapply(context: Dict[str, Any])None
threedb.controls.blender.imagenet_c.Control

alias of threedb.controls.blender.imagenet_c.ImagenetCControl