Shortcuts

normal

class trojanvision.datasets.MNIST(norm_par={'mean': [0.1307], 'std': [0.3081]}, **kwargs)[source]

MNIST dataset. It inherits trojanvision.datasets.ImageSet.

Variables:
  • name (str) – 'mnist'

  • num_classes (int) – 10

  • data_shape (list[int]) – [1, 28, 28]

  • norm_par (dict[str, list[float]]) – {'mean': [0.1307], 'std': [0.3081]}

class trojanvision.datasets.CIFAR10(norm_par={'mean': [0.49139968, 0.48215827, 0.44653124], 'std': [0.24703233, 0.24348505, 0.26158768]}, **kwargs)[source]

CIFAR10 dataset introduced by Alex Krizhevsky in 2009. It inherits trojanvision.datasets.ImageSet.

Variables:
  • name (str) – 'cifar10'

  • num_classes (int) – 10

  • data_shape (list[int]) – [3, 32, 32]

  • class_names (list[str]) –

    ['airplane', 'automobile', 'bird', 'cat', 'deer',
    'dog', 'frog', 'horse', 'ship', 'truck']

  • norm_par (dict[str, list[float]]) –

    {'mean': [0.49139968, 0.48215827, 0.44653124],
    'std'  : [0.24703233, 0.24348505, 0.26158768]}

class trojanvision.datasets.CIFAR100(norm_par={'mean': [0.49139968, 0.48215827, 0.44653124], 'std': [0.24703233, 0.24348505, 0.26158768]}, **kwargs)[source]

CIFAR100 dataset. It inherits trojanvision.datasets.ImageSet.

Variables:
  • name (str) – 'cifar100'

  • num_classes (int) – 100

  • data_shape (list[int]) – [3, 32, 32]

  • norm_par (dict[str, list[float]]) –

    {'mean': [0.49139968, 0.48215827, 0.44653124],
    'std'  : [0.24703233, 0.24348505, 0.26158768]}

class trojanvision.datasets.ImageNet16(norm_par={'mean': [122.68 / 255, 116.66 / 255, 104.01 / 255], 'std': [63.22 / 255, 61.26 / 255, 65.09 / 255]}, num_classes=1000, **kwargs)[source]

ImageNet16 dataset introduced by Patryk Chrabaszcz in 2017. It inherits trojanvision.datasets.ImageSet.

Variables:
  • name (str) – 'imagenet16'

  • num_classes (int) – Flexible (passed by command line argument, no larger than 1000).

  • data_shape (list[int]) – [3, 16, 16]

class trojanvision.datasets.ImageNet32(norm_par={'mean': [122.68 / 255, 116.66 / 255, 104.01 / 255], 'std': [63.22 / 255, 61.26 / 255, 65.09 / 255]}, num_classes=1000, **kwargs)[source]

ImageNet32 dataset introduced by Patryk Chrabaszcz in 2017. It inherits trojanvision.datasets.ImageSet.

Variables:
  • name (str) – 'imagenet64'

  • num_classes (int) – Flexible (passed by command line argument, no larger than 1000).

  • data_shape (list[int]) – [3, 32, 32]

class trojanvision.datasets.STL10(norm_par={'mean': [0.507, 0.487, 0.441], 'std': [0.267, 0.256, 0.276]}, **kwargs)[source]

STL10 dataset. It inherits trojanvision.datasets.ImageSet.

Variables:
  • name (str) – 'stl10'

  • num_classes (int) – 10

  • data_shape (list[int]) – [3, 256, 256]

  • norm_par (dict[str, list[float]]) – {'mean': [0.507, 0.487, 0.441], 'std': [0.267, 0.256, 0.276]}

get_transform(mode, normalize=None)[source]

Get dataset transform.

Parameters:
  • mode (str) – The dataset mode (e.g., 'train' | 'valid' | 'unlabeled' | 'train+unlabeled').

  • normalize (bool | None) – Whether to use torchvision.transforms.Normalize in dataset transform. Defaults to self.normalize.

Returns:

torchvision.transforms.Compose – The transform sequence.

Docs

Access comprehensive developer documentation for TrojanZoo

View Docs