Skip to main content
. 2022 Sep 27;24(10):1377. doi: 10.3390/e24101377
Algorithm 1 Simulator Attack+ under the lpnorm condition

Input: The input image xRD, where D means the image dimension, the label of the image x with groundtruth, the pre-trained simulator model M, the forward function of the black-box target model interface f, and the finetuning loss function LMSE.

Parameters: Warm-up iteration steps t, the adaptive predict-interval of LSSIM Madp, Bandits Attack parameter τ, noise exploration parameter δ, Bandits prior learning rate ηg, image updating rate η, the momentum factor θ of FABM, group numbers Ngroup of unsupervised clustering results, the center beginning perturbations Pcenters, batch_size of input images, attack type Tattack, project function fproj_p(·), and image update function fimg_upd_p(·).

Output: Adversarial image xadv that meets the requirements of ϵ norm-set attack, as xadvxpϵ.

  • 1:

    Initialize the adversarial example xadvx and the estimated gradient g0. Initialize the simulator model M for each image. Initialize finetune dequeue D with maximum length of t for coming finetuning query pairs. Initialize Ngroup clustering centers randomly. Initialize empty perturbation Pall, the size of which is the same as the batch. Initialize empty perturbation Pcenters, which has the same size as the clustering centers.

  • 2:

    ifTattack==targetedthen

  • 3:

        The central prior knowledge of other images in the same group is found using UCM.

  • 4:

    fori1toNdo

  • 5:

          uN(0,1DI)

  • 6:

          q1g+τu/g+τu2

  • 7:

          q2gτu/gτu2

  • 8:

          if itor(it)modMadp=0 then

  • 9:

                 y1^f(xadv+δ·q1)

  • 10:

               y2^f(xadv+δ·q2)

  • 11:

               Append above query pairs into dequeue D.

  • 12:

               if it then

  • 13:

                      Finetune the simulator model M with LMSE using the query pairs in dequeue D.

  • 14:

                      Extract feature attentional region Ratten.

  • 15:

        else

  • 16:

                 y1^M(xadv+δ·q1)

  • 17:

                 y2^M(xadv+δ·q2)

  • 18:

        ΔdirL(y1^,y)L(y2^,y)τ·δ·u

  • 19:

        Use Pfinal to enhance the Δdir of Ratten.

  • 20:

        gfproj_p(g,ηg,Δdir)

  • 21:

        xadvfimg_upd_p(xadv,η,g)

  • 22:

        xadvClip(xadv,0,1)

  • 23:

    returnxadv