{'fraction_non_alphanumeric': 0.027218441883071796, 'fraction_numerical': 0.010183770772577882, 'mean_word_length': 4.873844480696031, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Perlin Noise Improve Adversarial Robustness

Adversarial examples are some special input that can perturb the output of a deep neural network, in order to make produce intentional errors in the learning algorithms in the production environment. Most of the present methods for generating adversarial examples require gradient information. Even universal perturbations that are not relevant to the generative model rely to some extent on gradient information. Procedural noise adversarial examples is a new way of adversarial example generation, which uses computer graphics noise to generate universal adversarial perturbations quickly while not relying on gradient information. Combined with the defensive idea of adversarial training, we use Perlin noise to train the neural network to obtain a model that can defend against procedural noise adversarial examples. In combination with the use of model fine-tuning methods based on pre-trained models, we obtain faster training as well as higher accuracy. Our study shows that procedural noise adversarial examples are defensible, but why procedural noise can generate adversarial examples and how to defend against other kinds of procedural noise adversarial examples that may emerge in the future remain to be investigated.


I. INTRODUCTION
Convolutional neural networks are widely used in the domain of computer vision, such as image recognition [1] due to their powerful representation capabilities. However, as image features become more complex, more extensive scale, in particular, deeper layers of neural networks are in demand. Unfortunately, neural networks seem to have a bug of being vulnerable to adversarial examples, which uses almost invisible perturbations to make the neural network change its output. [2] Early methods of generating adversarial samples are usually based on the gradient information of neural networks, such as PGD and FGSM. [2], [3] Although these adversarial example can be successfully attacked with small perturbations, these adversarial samples usually cannot be migrated to other models nor applied to physical objects. Procedural noise functions can generate adversarial examples that can successfully perturb almost all model. [4] This technique allows the application of computer graphics techniques to the neural networks of computer vision. There is no good defense method for procedural noise adversarial example. In Co et al.'s work [4] , they provide a preliminary defense, denoising, which cannot and even will not be able to successfully defend against this attack. We can give a theoretical proof of it. Therefore, this paper proposes a method similar to noise training and adversarial training, which can effectively defend against procedural noise adversarial example. However, this method cannot provide an effective defense against gradient-based methods such as FGSM. We therefore propose a method based on Perlin noise masking to try to obfuscate the adversarial input. The defense rate of this method is too low and therefore not practical enough, but it is still relevant for discussion.
In this paper, we redefine the procedural noise adversarial examples of our improved version. We use transfer learning and model fine-tuning in our experiments. Then we explain our Perlin noise training model for the defence of procedural noise adversarial example. Finally we give the solution based on stacked and achie accuracy that matches the ensemble adversarial training [5].

II. RELATED WORKS
Yang et al. and Huang et al. use some computer graphics technologies to simulate real scene, thus enabling physical attacks. [6], [7] Perlin noise is also an computer graphics technology and Perlin noise also can be used for physical attacks, which inspired us to use more computer graphics methods to enhance the task of computer vision. Cihang et al.'s work show that input diversity could improve adversarial transferability. [8] Our Perlin noise mask can improve input diversity for defense. What input diversity means for neural networks is still an element worth investigating. We use a model finetuning technique to solve the problem that Perlin noise training from scratch fails to converge. Chen et al. discusses a method based on model fine-tuning that can simultaneously improve the accuracy and robustness of the model. [9] Other data augmentation methods that lead to difficult model convergence may be able to make progress in combination with model finetuning. AutoAugment manifests a great effect on the accuracy improvement of image classification neural networks. [10] Our network trained with only Perlin noise augmentation also achieves an accuracy close to that of EfficentNet using many training techniques, including AutoAugment. [11] A. Noise training and Perlin noise Most related to our work in noise training is RazorNet introduced by Taheri et al. [12]. RazorNet uses Perlin noise in the training of neural networks to improve accuracy and robust, but they did not discuss why Perlin noise was used or the difference between Perlin noise and other noise. Perlin noise was first proposed by Ken Perlin in 1985 as an image synthesizer rather than a type of noise [13]. Perlin noise was used as a texture generator in games to simulate objects such as smoke. [14] Bae et al. used Perlin noise in data augmentation to solve small data samples of HRCT (highresolution computed tomography) images. [15] However, they have no more in-depth experimental experiment on how to mix the augmented data with the original data and how Perlin noise interacts with the original image. The work of Lecuyer et al. [16] is most well known, where they inserted additive noise into neural networks based on differential privacy theory to obtain models with certified robustness. The effect of additive Gaussian noise in the robustness of neural networks was well investigated by Li et al. [17] B. Adversarial attack and adversarial training Co et al. black-box adversarial example attacks and gives a defense method based on denoise, which did not work so well. [4] They also did not mention any experiments on low-resolution datasets. And according to our experiments, procedural noise adversarial examples behave very differently on low-resolution datasets. Specifically, it does not have a similar perturbation universality as on the high-resolution dataset, which requires further research. Free Adversarial Training and [18] Fast Adversarial Training [19], YOPO [20]  improve speed of adversarial training. Our approach uses Perlin noise, a universal adversarial perturbation, for training and masking, which is faster than them. But it didn't achieve the defensive effect to match. Other universal adversarial perturbations should perhaps be equally noted for application in adversarial training. The work of Zhang et al. shows that the adversarially trained network recognizes shapes more than textures, which explains the resistance of the adversarially trained model to Perlin noise attacks, because Perlin noise is a texture generation method. [21] The success of our approach encourages the use of other texture generation methods to augment the data.

III. PROCEDURAL NOISE ADVERSARIAL EXAMPLES
Co et al. introduced procedural noise functions as an intuitive and computationally efficient approach to generate adversarial examples in black-box settings. [4] As a kind of lattice noise, Perlin noise determines noise at a point in space by computing a pseudo-random gradient at each of the eight nearest vertices on the integer cubic lattice and then doing a splined interpolation. [13], [22] As Bishop et al.'s work, adding random noise with zero mean and uncorrelated between different inputs is equivalent to Tikhonov Regularization. [23] After adding Perlin noise ξand expand the network function as a Taylor series powers of ξ we can get: Different from Bishop et al.'s, although we add Perlin noise ξ with zero mean and to be uncorrelated between different inputs, we have no O ξ 3 = 0. So adding randomly Perlin Noise is different from noise training with Gauss Noise.

IV. METHODS
In this section, we elaborate our method for improving adversarial robustness. As described in Section IV-A0b, Perlin noise is used to generate adversarial examples or augment data stochastically. We introduce an improved method that adds transform operation to Co et al.'s [4]. Different ratios of augmented data is tried to observe the performance. In robust metrics, attacks are considered, including Fast Gradient Sign Method (FGSM) [2], Projected Gradient Descent (PGD) [3], Carlini and Wagner L 2 and L ∞ Attack [24].
A. Training methods a) Transfer learning and fine-tuning: Transfer learning, in other words, pretraining, is another exciting paradigm to improve robustness and save much training time. [25], [26] In this work, pretraining uses a network on the big dataset ImageNet and then using its weights as the initial weights in subsequent noise training and adversarial training. Adding noises or adversarial examples at the beginning can easily make training harder to converge and have a more considerable bias, but smaller variance, which means better robustness most of the time. [27] Transfer learning can reduce the time training a neural network from scratch on ImageNet dataset. Comparing a transfer learning trained model with a model trained from scratch can explain why adversarial examples appear and how adversarial training affects the neural network.
In this work, we define the neural network as a function stacked by some functions H i called layers, and each layer has a set of trainable parameters, W i . i.e., H n (H n−1 (...), W n ).
(In fact, there may some connections cross layers, but we still describe it this way for simplicity. ) For the outermost layer H n we call it the top layer. In our solution, we freeze the weights other than the top layer and thus fine-tuning.
b) Adversarial training and noise training: As described in III, Perlin Noise can be used as a procedural noise or a method to generate adversarial samples. Using Bayesian optimization to optimize the Perlin Noise function parameters can be used to generate adversarial examples for adversarial training. Using random parameters to generate Perlin noise, which is added into the train set, can be regarded as an implementation of noise training. Comparing the results of adversarial training and noise training using Perlin noise can interpret the difference between them.

B. Robustness metrics
How to measure the robustness of the model is a topic worth discussing. Local loss sensitivity is estimated through the gradients of the prediction at points in the dataset. [28] Weng et al.'s method CLEVER can be better quantified than loss sensitivity to compare different models' robustness. However, local methods may have specific limitations. Using attack methods to measure the accuracy under attack can also be used as a robust metric. So Fast Gradient Sign Method (FGSM) [2], Projected Gradient Descent (PGD) [3], Carlini and Wagner L 2 and L ∞ Attack [24] are selected.

V. EXPERIMENTS
In this section, we describe our experiment settings firstly. Due to the differences in the performance of procedural noise adversarial examples on different resolution data sets, we divide the experimental discussion into two parts: highresolution data sets and low-resolution data sets. In each part, every models' robustness is evaluated by attacks, robustness metrics and robustness datasets.
A. Experiments Settings a) High Resolution Dataset: We conduct experiments on ImageNet 2012 ILSVRC challenge prediction task since it has been considered one of the most heavily benchmarked datasets in computer vision and there are some sub datasets such as ImageNet-A which could be used to evacuate robustness. b) Low Resolution Dataset: Perlin noise looks very different at low resolution than at high resolution. So CIFAR10 with 32x32 low resolution has been considered one of the most benchmarked datasets in computer vision image classify. CIFAR10 has 10 classes containing 6000 images each. There are 5000 training images and 1000 testing images per class.
c) Architecture: We use EfficientNets [11] as the SOAT model of image classify. And for more interpretability, we also use ResNets [29] as one of the most widely used models with lesser confusing hyperparameter adjustment. The ResNet50 and EfficientNet-B0 were chosen for the main experiment due to the computing capacity limitations of the experimental equipment. More trainable parameters are of little relevance to our conclusions. d) Training Settings: For low resolution dataset, we use batch size of 128 by default because larger batch size even makes models slower to converge. For high resolution dataset, we use batch size of 32 to pre, because of the memory limit of experiment equipment. We use NAdam optimizer [30] for all our experiments but adjust learning rate and use decay at different experiments. e) Noise or Adversarial Training: For noise training we add a random noise to each image sample. Generating procedural noise adversarial examples requires a lot of computational capacity, so a cache is used. If a noise can effectively perturb the model's output, then this noise is cached and will be firstly tried in subsequent searches.

B. Experiments on High Resolution Dataset a) Pre-experiments on Parameters' Bayesian Optimization.:
In order to make a preliminary comparison between the Bayesian optimization method in Co. et al. [4] and the direct random generation of procedural noise, the two methods were used to generate perturbed images, and finally a karate-test was used to compare the misclassification of the samples generated by the two methods.
H 0 : Additional Bayesian optimization has no effect χ 2 = 443.98,P (χ 2 ) = 0.00, reject H 0 . Additional Bayesian optimization is effective. We then plot a scatter of the Bayesian optimized parameters which is shown in figure 2. Observation of the scatter plot shows that Freq is distributed centrally around the levels of 26, 17, and 7. Meanwhile Period is concentrated at the level of 2.5 and 40 on both sides. Further labeling estimates based on this phenomenon were imposed.
b) Pre-experiments on Label Search.: According to the distribution of the attack success parameters, they are divided into three components, which are estimated separately using  normal distribution. Randomly generate noise samples according to each of the three estimated normal distributions. The label shifts due to perturbation of the input by the noise generated by the three distributions are counted separately. We found that the predicted labels of one group of distributions were concentrated in doormat and fountain, rather than brain coral and shower curtain, which were similar to the other distributions.
c) Pre-experiments on Pretraining model.: We first train the EfficentNetB0 model with Perlin noise augmentation directly from scratch, but the model accuracy stays below 60%. This is not only true for natural data, but also for augmented data. This leads us to believe that adding Perlin noise for training makes the model difficult to converge. Our attempts to reduce the proportion of data containing the augmented data and our attempts to train using the adversarial examples obtained from the Bayesian optimization search described previously did not work. Since training Imagenet [1] data from scratch is difficult to converge (which is shown in Figure 3), it is an exploration of how to use with the training model for finetuning. We use three types of fine-tuning, initializing the top layer randomly and then fine-tuning only the top layer, finetuning only the top layer, and fine-tuning the whole model. We use the NAdam optimizer [30] to fine tune with a learning rate of 0.0001. Finally, we find that full-layer fine-tuning is more accurate on both clean and noise augmented data.  d) Comparison Experiment: Adversarial Training vs. Noise Training.: We now evaluate our Perlin Noise Training and Adversarial Training strategy described in Section IV-A0b. Repeating our strategy, we use randomly generated Perlin noise and the disturbance sample obtained from Bayesian optimization to training models. The parameters of the randomly generated Perlin noise are determined according to the distributions obtained from the search in this section. The frequencies were set to a normal distribution with a mean of 40, while the periods' were set to 2.5 and 60, respectively. It took too much time to search for the perturbation that caused the largest drop in confidence in the correct classification for each example (we spent about 80 hours with 20 initialization queries and 20 maximum iterations for the 50,000 validation set of Imagenet [1]) so we stopped the perturbation once we got a prediction label that would cause the model to output an error and cached the data. Most of the data were perturbed with successful examples during the initialization query. According to such a strategy, the training sets for adversarial and noisy training should differ only by a small number of samples. But in fact, the accuracy of the model trained against the sample is always lower than that of the noise trained. This is the case in both full model and top layer fine-tuning. e) Solution with Perlin noise mask: Based on the above experimental results, we choose the model after 2 epochs' full-layer fine-tuning training as our final adopted model. As shown in Table III, since our model is robust to procedural noise adversarial examples, perturbing the input of the model with procedural noise may be able to perturb the adversarial examples generated by other attack methods so that they can be defended against. Let the Perlin noise trained neural model as H per , and Perlin noise mask as G per , raw image as I, then we have H per (min(I + G per , 1)) as the solution's output, which is shown in Figure4. We finally tested its accuracy under some attack methods, as shown in Table IV. The model after   [19] improvements inevitably require the evaluation of the FGSM [2] at least once. Therefore, we compare the time to compute the FGSM algorithm once by the backpropagation algorithm with the time we take to generate a random Perlin noise. The Perlin noise algorithm in our experiments is an CPU implementation. We therefore tested the time to calculate FGSM once on the CPU and once on the GPU separately for comparison. As shown in Table V

C. Experiments on Low Resolution Dataset
There are no experiments on datasets other than ImageNet [1] in the paper of Co et al. [4]. And Perlin Noise looks different in low resolution, which is shown in Figure5. Co et al. proposed a sine color map in order to generate more distinguishable textures, while the low resolution corrupts it. First we trained a ResNet50 [29] network based on the CIFAR10 dataset [31]. The network can achieve 80% accuracy on the clean CIFAR10 dataset. We then attack the entire test set using the Bayesian optimization method mentioned in Section III. This eventually allowed 9,997 out of 10,000 samples to be successfully perturbed for output. Moreover, the success rate of the attack for the original model to output the results correctly is 100%. However, our attention was drawn because the randomly generated perturbation using the distribution obtained based on Bayesian optimization had only a 29.16% success rate. This means that procedural noise adversarial examples are no longer available as a universal adversarial perturbation on low-resolution datasets like CI-FAR10. Repeating our defense method, which is mentioned in Section V-B0e, on the low-resolution dataset. It is found that noise masks reduce the accuracy rather than prevent model from adversarial attack.

D. Stacked Solution
In TableIV we find our Perlin noise training model and Perlin noise mask solution have low accuracy over FGSM or PGD attack. In order to solve this problem we apply our transfer learning method on Kurakin et al. [32]'s Inception v3 on ensemble of 4 models model which based on Tramèr et al. [5]'s method. And we gain about seventy percent accuracy over FGSM [2] The accuracy of the model trained by this method still has a certain gap compared to Kurakin et al. [32]'s model. So we train a Perlin noise detection model. Then we use the stacked [33], [34] method to train a decision tree model by combining the outputs of Kurakin et al. [32]'s model and Perlin noise detection model, and finally we can get the accuracy matching it, which is shown in TableVI.
VI. CONCLUSION Procedural noise adversarial examples lack effective defense methods. In this paper, a method between noise training and adversarial training is proposed for its defense. Model finetuning training is performed after data enhancement using random Perlin noise. Not similar to the model trained by ensemble adversarial training [5] has can defense against Perlin noise adversarial examples in some extent, this approach does not directly defend against gradient-based attacks such as PGD [3]. Therefore, we propose a masking method using Perlin noise to confuse the gradient-based adversarial perturbations, which achieved some results but it is insignificant when compared to ensemble adversarial training. In addition, we found that Perlin noise behaves differently at high and low resolution. At high resolution it is a universal adversarial perturbation while at low resolution it is not. We think it is an issue to explore whether Perlin noise enhancement can be used to improve accuracy.