Installation

git clone https://github.com/DAC-Method/DAC.git
cd DAC
conda create --name dac --file conda_requirements.txt
conda activate dac
pip install -r pip_requirements.txt
pip install .

Usage

Get attribution and masks for any image pair:

python dac.py --net <net> --checkpoint <net_checkpoint> --input_shape <dx> <dy> --realimg <real_img_path> --fakeimg <fake_img_path> --realclass <real_class_idx> --fakeclass <fake_class_idx> --downsample_factors <d0 d1 d2 ...> --output_classes <N_output_classes> --<attribution_method_0> --<attribution_method_1> ...

For all flags, see:

python dac.py -h

DAC Resources

Download DAC-Resources here.

Contents:

Instructions

Run attribution & mask extraction on already translated images

cd dac_resources
python experiments/scripts/run_dac.py --config experiments/configs/<experiment>.ini --net <net>

For experiment in {synapses, mnist, disc_1a, disc_1b}, net in {VGG, RES}. Results will be stored in

experiments/results/<experiment>

Default behaviour is to run the script locally using only a single worker. This can be changed via editing the submit command and num_workers in the respective experiment config file at:

experiments/configs/<experiment>.ini

Visualize and calculate DAC scores

python experiments/scripts/plot_dac.py --result_dir experiments/results/<experiment> --experiment <experiment> --net <net>

Plots will be stored at

./dac_plot_<experiment>_<net>.png

AUC scores for each method shown in console.

Train cycle GANs and generate translated datasets from scratch