How p-shekhar/adversarial-patch-transferability works
Main Components
a. Experiments Component:
• “Experiments” folder as the central experimental control unit.
• This includes multiple Jupyter Notebooks (e.g., Main.ipynb, Fig1.ipynb, Fig2, Fig3, Table notebooks) and generated figures (PDFs).
• These notebooks orchestrate the entire process: loading configurations, running training, generating plots, and evaluating results.
b. Configuration & Dataset Management:
• The “configs” directory holds the config.yaml, which contains crucial runtime parameters like dataset paths and file locations.
• The “dataset” folder contains modules for dataset handling (e.g., base_dataset.py and cityscapes.py) that read and preprocess images and masks.
c. Metrics & Loss Computation:
• The “metrics” folder defines custom performance measurement and loss calculations (e.g., loss.py and performance.py). They incorporate the adaptive adversarial loss function needed during training.
d. Patch Generation:
• The “patch” module includes the code (in create.py) for generating adversarial patches using the proposed variant of EOT.
e. Pretrained Models:
• The “pretrained_models” directory includes different segmentation models such as BisNetV1, BisNetV2, ICNet, and PIDNet, each with its own implementation files and supporting scripts. These models are the targets for adversarial attack experiments.
• Special attention should be given to the models’ sub-components (e.g., backbone, model definitions, etc.).
f. Trainer Module:
• The “trainer” folder contains training orchestration code (trainer.py) that manages the training loop, integrates patch generation, adaptive loss function, and updates model parameters.
g. Utility Functions:
• The “utils” folder offers helper modules (dirs.py, helper.py, utils.py) used across the project for file/directory management, logging, and miscellaneous functions.
Relationships and Interactions
• The configuration component feeds the dataset management system with paths and parameters required to load and preprocess the dataset.
• Once preprocessed data is available, the Trainer module leverages both the patch generator from the “patch” directory and the loss functions from “metrics” during the training phase.
• The Trainer orchestrates training with the pretrained models (loaded from “pretrained_models”), effectively testing the adversarial patch’s transferability.
• Experiments notebooks in the “Experiments” directory guide the execution flow, from initializing the training routines to plotting and visualizing performance metrics and figures.
• Utility functions support all modules by providing logging, error handling, and general-purpose services.
Architectural Patterns and Design Principles
• Modularity: Most functionalities are encapsulated in self-contained directories (data handling, training, evaluation, model definitions, etc.), thus promoting separation of concerns.
• Configurability: The use of a standalone config.yaml suggests that the system is built to support flexible experimentation—an essential feature for research work.
• Reusability & Extensibility: The clear separation of modules (e.g., metrics, patch, and pretrained models) allows for experiments with different adversarial strategies or models without major code modifications.
• Experiment-driven Flow: The project is designed as an experimental study, where components dynamically interact through training pipelines initiated by Jupyter Notebooks.
Relevant Technologies & Frameworks
• Although not explicitly mentioned in the file tree or README, it is likely that frameworks such as PyTorch are used for deep learning and model training.
• Jupyter Notebooks for experiment tracking and result visualization.
• YAML-based configuration management and possibly Python libraries for image and data processing.