Home

Awesome

UNICORN

This repository is the source code for "UNICORN: A Unified Backdoor Trigger Inversion Framework" (ICLR 2023).

<div align="center"> <img src=./image/vis.png width=75% /> </div>

The above figure is the visualization of the inverted triggers as well as the ground-truth triggers. This work formally defines and analyzes the triggers injected in different spaces and the inversion problem. Then, it proposes a unified framework to invert backdoor triggers based on the formalization of triggers and the identified inner behaviors of backdoor models from our analysis.

Environment

see requirements.txt

Data

Generating backdoored models

Backdoored models can be generated by using the code in the following links:

Pretrained backdoored models

[TODO] Providing the pretrained backdoored models.

Inversion

python unicorn.py \
--dataset cifar10 --epoch 1000 --arch resnet18 \
--model_path </path_to_pth_file> \
--data_fraction 0.01 \
--bs 256 \
--all2one_target <target_label> \
--ssim_loss_bound 0.15