class trojanvision.models.MagNet(name='magnet', dataset=None, model=_MagNet, structure=None, activation=None, v_noise=0.1, **kwargs)[source]

MagNet proposed by Dongyu Meng from Shanghai Tech University in CCS 2017. It is an autoencoder for input images to defend against adversarial attacks.

Available model names:
  • structure (list[int | str]) –

    The MagNet model structure. Defaults to

    • 1-channel images: [3, 'average', 3] (e.g, MNIST)

    • 3-channel images: [32]

  • activation (str) – The activation layer in MagNet model. Choose from ['sigmoid', 'relu']. Defaults to 'sigmoid' for 1-channel images (e.g, MNIST) and 'relu' for 3-channel images.

  • v_noise (float) – The std of random Gaussian noise added to training data. Defaults to 0.1.


Access comprehensive developer documentation for TrojanZoo

View Docs