This is a simple Resnet for CIFAR implementation supporting the detection of backdoor attacks with spectral signatures.
train.pytrainseval.pyevals once (--loopflag for infinite loop)config.jsonhas all the optionscompute_corrperforms the spectral signature detection
The simplest usage is to change the "data" section of the config.json file.
poison_methodcan bepixel,pattern, orellpoison_epsrefers to how many corrupted images are addedclean_labelrefers to the class of images to which a mark is addedtarget_labelrefers to the label assigned to corrupted imagespositionandcolorare the parameters for the backdoor triggerpercentilerepresents how many images to keep
The compute_corr.py file will load the latest checkpoint from the given output
directory in the config file and perform the spectral signature detection.
The code will print (to stdout) the top singular values with and without
the corrupted inputs, as well as the number of corrupted images removed as
having a high score.
The model directory is then updated with a numpy file containing the indices
of the top scores, so that if the train file was run again, the model would
be trained without training inputs corresponding to the removed indices.