EvadeML-Zoo
EvadeML-Zoo copied to clipboard
How can I use custom models rather than pre-trained models?
To cite your paper(Feature Squeezing), I would like to do separate training and detection tests on the CIFAR10 and MNIST datasets using different models, without pre-trained models.
For the model for the CIFAR10 dataset, I want to experiment using the Classifiers.get('resnet34') model provided in from classification_models.keras import Classifiers.
And for the model for the MNIST dataset, I want to experiment using a simple CUSTOM MODEL as shown below. model = Sequential() model.add(Convolution2D(32, 5, 5, input_shape=(1, img_rows, img_cols), activation='relu')) model.add(MaxPooling2D(pool_size=(2,2))) model.add(Flatten()) model.add(Dense(64, activation='relu')) model.add(Dense(nb_classes, activation='softmax'))
I hope you can help. regards
########################################################################
python main.py --dataset_name CIFAR-10 --model_name RESNET34
--nb_examples 7329 --balance_sampling True
--attacks "FGSM?eps=0.2;"
--clip 1
--robustness "none;FeatureSqueezing?squeezer=median_filter_3_3;"
--detection "FeatureSqueezing?squeezers=median_filter_3_3&distance_measure=l1&fpr=0.05;"
python main.py --dataset_name MNIST --model_name CUSTOM_MODEL
--nb_examples 9790 --balance_sampling True
--attacks "FGSM?eps=0.4;"
--clip 1
--robustness "none;FeatureSqueezing?squeezer=bit_depth_1;"
--detection "FeatureSqueezing?squeezers=bit_depth_1&distance_measure=l1&fpr=0.05;"
########################################################################
Hi @taeu-bahk , you would need to change the code for this.
Please follow the implementation of our example models:
https://github.com/mzweilin/EvadeML-Zoo/blob/master/main.py#L92