DeepRobust

repository·master·Indexed 22 days ago

https://github.com/dse-msu/deeprobust

A PyTorch library providing a comprehensive suite of adversarial attack and defense algorithms for image and graph data domains. It includes tools for attacking convolutional neural networks (CNNs) and Graph Neural Networks (GNNs), supporting various datasets such as Cora, MNIST, and CIFAR10. The library is organized into two main packages: `deeprobust.image` and `deeprobust.graph`.

Tokens
15.4K
Snippets
32
Records
49
Agent score
76%

What's inside DeepRobust

  1. Overview of the deeprobust package

    master

    The deeprobust package provides tools for studying and implementing attacks and defenses for both image-based and graph-based deep learning models. The package is organized into two primary subpackages:

    • deeprobust.image: Contains tools for image-based adversarial attacks and defenses.
    • deeprobust.graph: Contains tools for graph-based adversarial attacks and defenses (specifically targeting Graph Neural Networks).

    Users can access the core module functionality via the deeprobust entry point.

  2. Overview of DeepRobust

    master

    DeepRobust is a PyTorch-based adversarial library designed for implementing and testing attack and defense methods on both images and graphs.

    It provides a unified framework for:

    • Image Attack and Defense: Methods targeting convolutional neural networks (CNNs).
    • Graph Attack and Defense: Methods targeting Graph Neural Networks (GNNs), including node embedding attacks and backdoor attacks.

    The library is organized into two main packages:

    • deeprobust.image: Contains algorithms for image-based adversarial machine learning.
    • deeprobust.graph: Contains algorithms for graph-based adversarial machine learning.
  3. Available targeted attack algorithms in deeprobust.graph.targeted_attack

    master

    The deeprobust.graph.targeted_attack package provides several specialized modules for performing targeted attacks on Graph Neural Networks (GNNs). Depending on your research or testing requirements, you can use the following submodules:

    • fga: Feature Generation Attack.
    • ig_attack: Integrated Gradient-based attack.
    • nettack: A common attack method targeting graph structure.
    • rl_s2v: Reinforcement Learning based attack (S2V).
    • rnd: Random attack (often used as a baseline).
    • sga: Structure Generation Attack.

    All these modules inherit from or utilize the base_attack module to provide a consistent interface for generating adversarial perturbations.

  4. Explore the deeprobust.image package structure

    master

    The deeprobust.image package provides tools for image-based adversarial attacks and defenses. It is organized into several functional subpackages and modules:

    Subpackages

    • deeprobust.image.attack: Contains various adversarial attack implementations for images.
    • deeprobust.image.defense: Contains defense mechanisms to protect models against image attacks.
    • deeprobust.image.netmodels: Provides neural network model implementations and utilities.

    Core Modules

    • deeprobust.image.config: Configuration management for image tasks.
    • deeprobust.image.evaluation_attack: Tools for evaluating the effectiveness of attacks.
    • deeprobust.image.optimizer: Optimization algorithms used during attacks or training.
    • deeprobust.image.utils: General utility functions for image processing and data handling.
  5. Use global graph attack submodules in DeepRobust

    master

    The deeprobust.graph.global_attack package provides various methods for performing global attacks on Graph Neural Networks (GNNs). These attacks typically aim to perturb the graph structure globally to degrade model performance.

    Available attack submodules include:

    • dice: DICE attack implementation.
    • mettack: METTACK attack implementation.
    • nipa: NIPA attack implementation.
    • random_attack: Random graph perturbation attacks.
    • topology_attack: Attacks targeting the graph topology.
    • base_attack: The base class/module for defining global attacks.

    To use these, you should import the specific attack class from its corresponding submodule.

  6. Use the deeprobust.graph.data package for graph data management

    master

    The deeprobust.graph.data package provides tools for managing graph datasets and handling attacked graph data. It is organized into two primary submodules:

    1. deeprobust.graph.data.dataset: Used for loading and managing clean graph datasets.
    2. deeprobust.graph.data.attacked_data: Used for managing graph data that has been subjected to adversarial attacks.

    Developers should use this package to prepare graph structures (nodes, edges, and features) for training, testing, or evaluating graph neural network (GNN) robustness.

  7. Explore the deeprobust.graph package structure

    master

    The deeprobust.graph package provides tools for attacking and defending Graph Neural Networks (GNNs). It is organized into several specialized subpackages based on the attack type or defense mechanism:

    • deeprobust.graph.data: Data handling and loading utilities for graph datasets.
    • deeprobust.graph.defense: Defense mechanisms to protect GNNs against graph attacks.
    • deeprobust.graph.global_attack: Attacks that target the graph structure globally.
    • deeprobust.graph.rl: Reinforcement Learning-based graph attacks.
    • deeprobust.graph.targeted_attack: Attacks designed to achieve specific target outcomes.
  8. Explore deeprobust.image.netmodels submodules

    master

    The deeprobust.image.netmodels package provides a collection of neural network architectures and training utilities specifically designed for image-based tasks within the DeepRobust framework. It includes various CNN architectures, pre-trained models, and specialized training modules.

    Available submodules include:
    - `deeprobust.image.netmodels.CNN`: Basic CNN implementations.
    - `deeprobust.image.netmodels.CNN_multilayer`: Multilayer CNN architectures.
    - `deeprobust.image.netmodels.YOPOCNN`: YOPOCNN specific models.
    - `deeprobust.image.netmodels.densenet`: DenseNet architectures.
    - `deeprobust.image.netmodels.preact_resnet`: Pre-activation ResNet models.
    - `deeprobust.image.netmodels.resnet`: Standard ResNet architectures.
    - `deeprobust.image.netmodels.vgg`: VGG architectures.
    - `deeprobust.image.netmodels.train_model`: General model training utilities.
    - `deeprobust.image.netmodels.train_resnet`: Specialized training utilities for ResNet models.
  9. Identify available Graph Victim Models and Defense Methods

    master

    DeepRobust provides several classes for testing model robustness against graph attacks. You can use standard GNNs as victim models or specialized defense methods to mitigate the effects of poisoned graphs.

    Victim Models

    Used to evaluate how standard GNNs perform under attack:

    • deeprobust.graph.defense.GCN
    • deeprobust.graph.defense.GAT
    • deeprobust.graph.defense.ChebNet
    • deeprobust.graph.defense.SGC

    Node Embedding Victim Models

    • deeprobust.graph.defense.DeepWalk
    • deeprobust.graph.defense.Node2Vec

    Defense Methods

    Used to enhance the robustness of GNNs:

    • deeprobust.graph.defense.GCNJaccard
    • deeprobust.graph.defense.GCNSVD
    • deeprobust.graph.defense.ProGNN
    • deeprobust.graph.defense.RGCN
    • deeprobust.graph.defense.SimPGCN
    • deeprobust.graph.defense.AdvTraining