Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlackCAtt: Out-of-the-box: Black-box Causal Attacks on Object Detectors

This repository contains the code for the paper "Out-of-the-box: Black-box Causal Attacks on Object Detectors" by Melane Navaratnarajah, David A. Kelly, and Hana Chockler. The code is organized into several scripts that allow you to run the attack generation and analysis for object detectors using the ReX framework.

Usage

  1. Clone the repository
  2. Install the required packages
  3. Run the pipeline with your dataset path, ReX output path, ReX script path, and dataset info path.
 python -m scripts.run_pipeline --dataset-path /mnt/data/Documents/coco/test2017/ --run-rex --rex-output fixed-results --rex-script /mnt/data/Documents/ReX/scripts/yolo.py --dataset-info /mnt/data/Documents/coco/test2017/predictions_info.csv 
  1. The results will be saved in the specified ReX output path.
 python -m scripts.run_pipeline --dataset-path /mnt/data/Documents/testing/image_2/ --run-rex --rex-output fixed-kitti-results --rex-script /mnt/data/Documents/ReX/scripts/yolo.py --dataset-info /mnt/data/Documents/testing/image_2/predictions_info.csv --rex-config /mnt/data/Documents/ReX/rex.toml

To run analysis for the rex information

coco:

 python -m scripts.run_pipeline  --dataset-path /mnt/data/Documents/coco/test2017/  --dataset-info /mnt/data/Documents/coco/test2017/predictions_info.csv  --analyse --rex-output fixed-results --visualise --output-dir attack --visualise

kitti:

 python -m scripts.run_pipeline  --dataset-path /mnt/data/Documents/testing/image_2/  --dataset-info /mnt/data/Documents/testing/image_2/predictions_info.csv  --analyse --rex-output fixed-kitti-results --visualise --output-dir attack_kitti --visualise

Attack Generation for Label + Bounding Box Adversarial Setting:

In this setting, we generate attacks that using the label and the bounding box information only.

To run only the attack generation with certain method: {NOISE}

coco:

python -m scripts.run_pipeline  --dataset-path /mnt/data/Documents/coco/test2017/  --dataset-info /mnt/data/Documents/coco/test2017/predictions_info.csv  --rex-output fixed-results --output-dir attack  --run-attacks --extract-method "noise" --num-images 50

To run only the analysis for the attack generation with certain method: {GREEDY} - ReX maps

coco:

 python -m scripts.run_pipeline  --dataset-path /mnt/data/Documents/coco/test2017/  --dataset-info /mnt/data/Documents/coco/test2017/predictions_info.csv --rex-output fixed-results --rex-script /mnt/data/Documents/ReX/scripts/yolo.py --output-dir attack --run-attacks --extract-method "greedy" --num-images 50

Run bash script

To run the extraction using the bash script, use the following command: Make sure to replace the paths and parameters as needed and give execute permission to the script using chmod +x run_extraction.sh.

  ./run_extraction.sh /mnt/data/Documents/coco/test2017/ yolo attack noise_targeted 6000 fixed-results /mnt/data/Documents/ReX/scripts/yolo.py 15

To run analysis bash script:

 ./run_analysis.sh /mnt/data/Documents/coco/test2017/ yolo fixed-results /mnt/data/Documents/ReX/scripts/yolo.py 6000 attack 1 

Meta-Algorithm for the attack generation + Score-Based Setting:

BlackCAtt can be used in-juction with other state-of-the-art methods to generate attacks. In this paper, we focused on Square Attack, Parallel Rectangle Flip Attack (PRFA), and SparseRS. In this setting, the attack generation is done using a provided loss function. Example run:

python square_attack_runner.py --num_images 1000 --eps 0.0156862745 --results attack_coco/results_analysis.csv --output_folder square_yolo_coco_results_change/ --attack_type label_changing

Citation

If you use this code in your research, please cite the following paper:

@article{navaratnarajah2025out,
  title={Out-of-the-box: Black-box Causal Attacks on Object Detectors},
  author={Navaratnarajah, Melane and Kelly, David A and Chockler, Hana},
  journal={arXiv preprint arXiv:2512.03730},
  year={2025}
}

Acknowledgments

Main Repositories Used:

About

A black-box algorithm(s) and tool, which uses minimal, causally sufficient pixel sets to construct imperceptible, reproducible, architecture-agnostic attacks on object detectors

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages