code: def build_model_attack_graph(self):
      if self.disp_console:
          print("Building attack graph...")
      # compute the EOT-transformed masked inter in a batch,
      if self.useEOT == True:
          print("Building EOT Model graph!")
          self.EOT_transforms = transformation.target_sample()
          self.num_of_EOT_transforms = len(self.EOT_transforms)
          print(f"EOT transform number: {self.num_of_EOT_transforms}")
  
      # x is the image
      self.x = tf.placeholder(
          "float32", [self.num_of_EOT_transforms, 448, 448, 3]
      )
      self.mask = tf.placeholder("float32", [1, 448, 448, 3])
  
      self.punishment = tf.placeholder("float32", [1])
      self.smoothness_punishment = tf.placeholder("float32", [1])
  
      # original
      # init_inter = tf.constant_initializer(0.001*np.random.random([1,448,448,3]))
  
      # improved
      # think of it, we want ad sticker starts at somewhere easy
      init_inter = tf.constant_initializer(
          0.7 * np.random.normal(scale=0.8, size=[1, 448, 448, 3])
      )
  
      self.inter = tf.get_variable(
          name="inter",
          shape=[1, 448, 448, 3],
          dtype=tf.float32,
          initializer=init_inter,
      )
  
      # box constraints ensure self.x within(0,1)
      self.w = tf.atanh(self.x)
      # add mask
      self.masked_inter = tf.multiply(self.mask, self.inter)
  
      # compute the EOT-transformed masked inter in a batch,
      if self.useEOT == True:
          # broadcast self.masked_inter [1,448,448,3] into [num_of_EOT_transforms, 448, 448, 3]
          self.masked_inter_batch = self.masked_inter
          for i in range(self.num_of_EOT_transforms):
              if i == self.num_of_EOT_transforms - 1:
                  break
              self.masked_inter_batch = tf.concat(
                  [self.masked_inter_batch, self.masked_inter], 0
              )
  
          # interpolation choices "NEAREST", "BILINEAR"
          self.masked_inter_batch = tf.contrib.image.transform(
              self.masked_inter_batch,
              self.EOT_transforms,
              interpolation="BILINEAR",
          )
  
      else:
          self.masked_inter_batch = self.masked_inter
          print("EOT mode disabled!")
  
      # tf.add making self.w [1,448,448,3] broadcast into [num_of_EOT_transforms, 448, 448, 3]
      self.shuru = tf.add(self.w, self.masked_inter_batch)
      self.constrained = tf.tanh(self.shuru)
  
      # create session
      self.sess = (
          tf.Session()
      )  # config=tf.ConfigProto(log_device_placement=True)
  
      init_dict = {
          "yolo_model_input": self.constrained,
          "yolo_mode": "init_model",
          "yolo_disp_console": self.disp_console,
          "session": self.sess,
      }
  
      # init a model instance
      self.object_detector = self.model(init_dict)
      self.C_target = self.object_detector.get_output_tensor()
  
      MODEL_variables = self.object_detector.get_yolo_variables()
      # Alternatives:
      # leave out tf.inter variable which is not part of yolo model
      # MODEL_variables = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES)[1:]
      # MODEL_variables = tf.contrib.framework.get_variables()[1:]
  
      # unused
      MODEL_variables_name = [
          variable.name for variable in MODEL_variables
      ]
  
      # computer graph for norm 2 distance
      # init an ad example
      self.perturbation = self.x - self.constrained
      self.distance_L2 = tf.norm(self.perturbation, ord=2)
      self.punishment = tf.placeholder("float32", [1])
  
      # non-smoothness
      self.lala1 = self.masked_inter[0:-1, 0:-1]
      self.lala2 = self.masked_inter[1:, 1:]
      self.sub_lala1_2 = self.lala1 - self.lala2
      self.non_smoothness = tf.norm(self.sub_lala1_2, ord=2)
  
      # loss is maxpooled sum confidence from batch dimension + distance_L2 + print smoothness
      self.loss = (
          self.C_target
          + self.punishment * self.distance_L2
          + self.smoothness_punishment * self.non_smoothness
      )
  
      # set optimizer
      self.optimizer = tf.train.AdamOptimizer(
          self.learning_rate
      )  # GradientDescentOptimizerAdamOptimizer
      self.attackoperator = self.optimizer.minimize(
          self.loss, var_list=[self.inter]
      )
  
      # init and load weights by variables
      self.sess.run(tf.global_variables_initializer())
  
      # restore model variable
      saver = tf.train.Saver(MODEL_variables)
      saver.restore(self.sess, self.weights_file)
  
      if self.disp_console:
          print("Loading complete!" + "\n")
  
imports: from __future__ import division
  from __future__ import print_function
  from builtins import str
  from builtins import range
  from past.utils import old_div
  import numpy
  import cv2
  import tensorflow
  import time
  import os
  from EOT_simulation import transformation
  from attack_methods.base_logic import ODD_logic
  import pdb
label_desc: Use image node_id 3 for calling the EOTB_attack obj's underlying member method code with example usage: obj.build_model_attack_graph() without return types