From ea4c184020f3b44b0b7c6d7ee3d858f4de91592b Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 20 Oct 2024 11:45:03 +0200 Subject: [PATCH] The issues with the notebooks have been resolved. --- Notebooks/AROS.ipynb | 7 ++-- Notebooks/Ablation_Study.ipynb | 62 ++++++++++++++++++++++++---------- README.md | 11 ++---- requirements.txt | 3 +- 4 files changed, 51 insertions(+), 32 deletions(-) diff --git a/Notebooks/AROS.ipynb b/Notebooks/AROS.ipynb index e2f3196..2d074f6 100644 --- a/Notebooks/AROS.ipynb +++ b/Notebooks/AROS.ipynb @@ -46,7 +46,7 @@ }, "outputs": [], "source": [ - "!git clone https://github.com/MMathisLab/AROS.git" + "!git clone https://github.com/AdaptiveMotorControlLab/AROS" ] }, { @@ -57,9 +57,8 @@ }, "outputs": [], "source": [ - "%cd /content/AROS\n", - "%ls\n", - "!pip install -r requirements.txt" + "!pip install -r ./AROS/requirements.txt\n", + "cd ./AROS/AROS" ] }, { diff --git a/Notebooks/Ablation_Study.ipynb b/Notebooks/Ablation_Study.ipynb index d356e78..49ffe4a 100644 --- a/Notebooks/Ablation_Study.ipynb +++ b/Notebooks/Ablation_Study.ipynb @@ -3,8 +3,8 @@ { "cell_type": "markdown", "metadata": { - "id": "view-in-github", - "colab_type": "text" + "colab_type": "text", + "id": "view-in-github" }, "source": [ "\"Open" @@ -12,12 +12,43 @@ }, { "cell_type": "markdown", - "source": [ - "## AROS, Ablation Study" - ], "metadata": { "id": "G1Ues10_fww5" - } + }, + "source": [ + "## AROS, Ablation Study" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!git clone https://github.com/AdaptiveMotorControlLab/AROS" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -r ./AROS/requirements.txt\n", + "cd ./AROS/AROS" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import argparse\n", + "import torch\n", + "import torch.nn as nn\n", + "from tqdm.notebook import tqdm" + ] }, { "cell_type": "code", @@ -91,10 +122,6 @@ } ], "source": [ - "!pip install -r requirements.txt\n", - "import argparse\n", - "import torch\n", - "import torch.nn as nn\n", "from evaluate import *\n", "from utils import *\n", "from tqdm.notebook import tqdm\n", @@ -112,8 +139,7 @@ "source": [ "parser = argparse.ArgumentParser(description=\"Hyperparameters for the script\")\n", "\n", - "# Define the hyperparameters controlled via CLI 'Ding2020MMA'\n", - "\n", + " \n", "parser.add_argument('--in_dataset', type=str, default='cifar100', choices=['cifar10', 'cifar100'], help='The in-distribution dataset to be used')\n", "parser.add_argument('--threat_model', type=str, default='Linf', help='Adversarial threat model for robust training')\n", "parser.add_argument('--noise_std', type=float, default=1, help='Standard deviation of noise for generating noisy fake embeddings')\n", @@ -144,14 +170,14 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "g2TltXvg7MfF", - "outputId": "4df864e7-e14b-4db4-e1ae-06e33c9b11be", "colab": { "referenced_widgets": [ "59296a90b8c84b1c94648a4c5d68a43b", "ad54c341af6e400280d000b3725f08ee" ] - } + }, + "id": "g2TltXvg7MfF", + "outputId": "4df864e7-e14b-4db4-e1ae-06e33c9b11be" }, "outputs": [ { @@ -217,14 +243,14 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "QeC-30C5ImKg", - "outputId": "793be5f3-3307-4a3d-8e5f-177ac212d30a", "colab": { "referenced_widgets": [ "c9c97585bef049ca9974797d1d5964ab", "97f0832ab970458f947318195735214b" ] - } + }, + "id": "QeC-30C5ImKg", + "outputId": "793be5f3-3307-4a3d-8e5f-177ac212d30a" }, "outputs": [ { diff --git a/README.md b/README.md index 3c85549..b7187de 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,9 @@ ## Overview This repository contains the code for the paper **"Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings"**. The method, termed **AROS**, employs Neural Ordinary Differential Equations (NODEs) with Lyapunov stability to create robust embeddings for OOD detection, significantly improving performance against adversarial attacks. -This repository contains the code for the paper **"Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings"**. The method, termed **AROS**, employs Neural Ordinary Differential Equations (NODEs) with Lyapunov stability to create robust embeddings for OOD detection, significantly improving performance against adversarial attacks. An example of training and evaluation of the model on the CIFAR-10 and CIFAR-100 of both benchmark is available in this -[notebook](https://colab.research.google.com/drive/1-VrfWbnlW_2x_lybVfyCD70OOEelrSYB?usp=sharing), along with a notebook detailing the ablation study provided [here](https://colab.research.google.com/drive/1SdSQpXeEoZnlQww-gvec9aJxK1CiPFjl?usp=sharing -). - - - - - -![AROS](https://github.com/user-attachments/assets/dd5d5dd9-2650-4746-9983-5abf6d7eedfc) +This repository contains the code for the paper **"Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings"**. The method, termed **AROS**, employs Neural Ordinary Differential Equations (NODEs) with Lyapunov stability to create robust embeddings for OOD detection, significantly improving performance against adversarial attacks. Additionally, the repository includes two notebooks: one demonstrates the training and evaluation process on the CIFAR-10 and CIFAR-100 datasets, while the other focuses on the ablation study. + ## Key Features - **Lyapunov Stability for OOD Detection**: Ensures that perturbed inputs converge back to stable equilibrium points, improving robustness against adversarial attacks. diff --git a/requirements.txt b/requirements.txt index 8e4b65f..c5b0a81 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ geotorch torchdiffeq -git+https://github.com/RobustBench/robustbench.git \ No newline at end of file +git+https://github.com/RobustBench/robustbench.git +timm==1.0.9 \ No newline at end of file