QE-DBA is a research project that explores query-efficient decision-based adversarial attacks using Bayesian Optimization. The goal is to generate adversarial examples that cause a classifier to misclassify an image while minimizing the perceptual difference between the original and perturbed images.
This repository contains:
- Bayesian Optimization Decision-Based Attack (BO-DBA) implementation
- Evaluation notebooks and experiments
- ImageNet validation dataset preprocessing tools
- Comparative evaluation against alternative adversarial attack methods
- A Docker-based runtime environment for reproducing experiments
Follow these steps in order for a clean setup.
git clone https://github.com/riker1/CISE-QE-DBA
cd CISE-QE-DBAThe BO-DBA experiments require the ImageNet 2012 validation dataset.
Download the dataset from Academic Torrents:
https://academictorrents.com/details/5d6d0df7ed81efd49ca99ea4737e0ae5e3a5f2e5
Students unfamiliar with BitTorrent may use one of the following clients:
- Transmission (macOS, Linux)
- qBittorrent (Windows, macOS, Linux)
After opening the torrent file in your BitTorrent client, download:
ILSVRC2012_img_val.tar
The completed archive should be approximately 6.3 GB.
Place the following files in the DataSet/ directory:
DataSet/
├── ILSVRC2012_img_val.tar
├── imagenet_2012_validation_synset_labels.txt
└── preprocess_imagenet_validation_data.py
Extract the validation archive into the directory expected by the project:
cd DataSet
mkdir -p ILSVRC2012_img_val
tar -xf ILSVRC2012_img_val.tar \
-C ILSVRC2012_img_valPreprocess the validation dataset:
python preprocess_imagenet_validation_data.py \
ILSVRC2012_img_val \
imagenet_2012_validation_synset_labels.txtAfter preprocessing, the directory structure should resemble:
DataSet/
└── ILSVRC2012_img_val/
├── n01440764/
├── n01443537/
├── n01592084/
└── ...
docker buildx build \
--platform linux/amd64 \
-t cise-qe-dba-old .The first build may take several minutes while Docker downloads and installs the required machine learning libraries.
docker run \
--platform linux/amd64 \
--rm \
-it \
-p 8888:8888 \
-v "$PWD:/workspace" \
-w /workspace \
cise-qe-dba-oldNavigate to:
http://localhost:8888/tree
Open:
Demo.ipynb
Execute the notebook cells sequentially.
For an initial functionality test, temporarily reduce:
queryBudgets = 500to:
queryBudgets = 2This allows the notebook to complete quickly and confirms that the environment, dataset, and attack pipeline are functioning correctly before launching longer experiments.
When a notebook kernel starts, the container uses a compatibility launcher that preloads TensorFlow and Matplotlib before starting ipykernel.
You should see messages similar to:
Preloading TensorFlow before ipykernel starts...
Preloading matplotlib Agg backend before ipykernel starts...
Preloads complete. Starting ipykernel...
These messages are expected.
TensorFlow may also report missing CUDA or TensorRT libraries when running on systems without NVIDIA GPUs. These warnings are expected and do not prevent the experiments from running.
A quick verification path is:
- Start the Docker container.
- Open
Demo.ipynb. - Set
queryBudgets = 2for a short test run. - Execute the notebook cells sequentially.
If the environment is working, the notebook should load the dataset, initialize the classifier, and begin running model predictions. The first execution may take several minutes while TensorFlow downloads pre-trained model weights. Longer runs with the default query budget may take significant time, especially on Apple Silicon systems running the linux/amd64 image through Docker Desktop emulation.
The project expects all ImageNet class directories to exist beneath:
DataSet/ILSVRC2012_img_val/
Do not run the preprocessing script against the current directory (.). Doing so will create the ImageNet class folders directly under DataSet/ instead of under DataSet/ILSVRC2012_img_val/.
If the class folders are created directly under DataSet/, the notebooks may fail with an error similar to:
FileNotFoundError:
./DataSet/ILSVRC2012_img_val
If this happens, rerun the preprocessing step using the correct path shown in the Recommended Workflow, or move the generated n* class directories into:
DataSet/ILSVRC2012_img_val/
Classifier settings are controlled through:
Configuration.yaml
Supported classifier options include:
- Inception
- ResNet
Additional configuration examples and attack parameters can be found in:
Demo.ipynb
Additional evaluation notebooks are located in:
Evaluation/
These notebooks compare BO-DBA against alternative adversarial attack techniques and provide performance measurements across different attack scenarios.
A historical requirements.txt file is included for reference.
Direct installation on a host operating system is not recommended because many of the original package versions have been deprecated, replaced, or removed from modern package repositories.
For reproducibility and ease of use, the Docker-based workflow described above is the recommended installation method.
- Prashant Jadiya
- Zhensheng Sun
- Nathan McDermott
Docker-based modernization, dependency restoration, Jupyter compatibility fixes, TensorFlow startup workarounds, and Apple Silicon compatibility updates were added to preserve reproducibility of the original research environment and allow the experiments to continue running on modern hardware and operating systems.