From: @jxlang910 Reviewed-by: @pkuliuliu,@liu_luobin Signed-off-by: @pkuliuliutags/v1.1.0
@@ -110,7 +110,7 @@ def test_pointwise_attack_on_mnist(): | |||||
test_labels_onehot = np.eye(10)[true_labels] | test_labels_onehot = np.eye(10)[true_labels] | ||||
attack_evaluate = AttackEvaluate(np.concatenate(test_images), | attack_evaluate = AttackEvaluate(np.concatenate(test_images), | ||||
test_labels_onehot, adv_data, | test_labels_onehot, adv_data, | ||||
adv_preds, targeted=is_target, | |||||
np.array(adv_preds), targeted=is_target, | |||||
target_label=targeted_labels) | target_label=targeted_labels) | ||||
LOGGER.info(TAG, 'mis-classification rate of adversaries is : %s', | LOGGER.info(TAG, 'mis-classification rate of adversaries is : %s', | ||||
attack_evaluate.mis_classification_rate()) | attack_evaluate.mis_classification_rate()) | ||||
@@ -39,6 +39,7 @@ from examples.common.dataset.data_processing import generate_mnist_dataset | |||||
from examples.common.networks.lenet5.lenet5_net import LeNet5 | from examples.common.networks.lenet5.lenet5_net import LeNet5 | ||||
LOGGER = LogUtil.get_instance() | LOGGER = LogUtil.get_instance() | ||||
LOGGER.set_level('INFO') | |||||
TAG = 'Defense_Evaluate_Example' | TAG = 'Defense_Evaluate_Example' | ||||
@@ -30,6 +30,7 @@ from examples.common.dataset.data_processing import generate_mnist_dataset | |||||
from examples.common.networks.lenet5.lenet5_net import LeNet5 | from examples.common.networks.lenet5.lenet5_net import LeNet5 | ||||
LOGGER = LogUtil.get_instance() | LOGGER = LogUtil.get_instance() | ||||
LOGGER.set_level('INFO') | |||||
TAG = 'Similarity Detector test' | TAG = 'Similarity Detector test' | ||||
@@ -152,10 +152,12 @@ class DeepFool(Attack): | |||||
Generate adversarial examples based on input samples and original labels. | Generate adversarial examples based on input samples and original labels. | ||||
Args: | Args: | ||||
inputs (Union[numpy.ndarray, tuple]): Input samples. The format of inputs can be (inputs1, input2, ...) \ | |||||
or only one array if model_type='detection' | |||||
labels (Union[numpy.ndarray, tuple]): Original labels. The format of labels should be \ | |||||
(gt_boxes, gt_labels) if model_type='detection'. | |||||
inputs (Union[numpy.ndarray, tuple]): Input samples. The format of inputs should be numpy.ndarray if | |||||
model_type='classification'. The format of inputs can be (input1, input2, ...) or only one array if | |||||
model_type='detection'. | |||||
labels (Union[numpy.ndarray, tuple]): Targeted labels or ground-truth labels. The format of labels should | |||||
be numpy.ndarray if model_type='classification'. The format of labels should be (gt_boxes, gt_labels) | |||||
if model_type='detection'. | |||||
Returns: | Returns: | ||||
numpy.ndarray, adversarial examples. | numpy.ndarray, adversarial examples. | ||||