docstr: Search an adversarial example from given information with attack graph.
  
  Args:
  sample_folder: The complete path for base information.
  maskfilename: The complete path for mask coordination.
  **kwargs: Other named arguments.
docstr_tok: ["Search","an","adversarial","example","from","given","information","with","attack","graph",".","Args",":","sample_folder",":","The","complete","path","for","base","information",".","maskfilename",":","The","complete","path","for","mask","coordination",".","*","*","kwargs",":","Other","named","arguments","."]
code: def _attack_from_file(
      self, sample_folder, maskfilename, logo_filename=None, **kwargs
  ):
      """
      Search an adversarial example from given information with attack graph.
  
      Args:
      sample_folder: The complete path for base information.
      maskfilename: The complete path for mask coordination.
      **kwargs: Other named arguments.
      """
      if self.disp_console:
          print("Generating from " + sample_folder + "...")
  
      sample_list = self._get_sample_list(sample_folder)
      # record scale of the orginal images
      self.h_img, self.w_img, self.d_img = sample_list[0][1].shape
      mask = self.very_small * np.ones(shape=sample_list[0][1].shape)
  
      # if there is logo file, prepare logo_mask
      logo_mask = None
      if logo_filename is not None:
          logopic = cv2.imread(logo_filename)
          # flag indicates where the pixels' value will spared from ad perturbation
          flag = 100
          logo_mask = self._generate_logomask(logopic, flag)
  
      print("Generating Mask...")
      self.mask_list = self._parse_mask(maskfilename)
      resized_logo_mask_list = []
      for _object in self.mask_list:
          xmin, ymin, xmax, ymax = self._get_mask_coordination(_object)
          mask = self._generate_MaskArea(mask, xmin, ymin, xmax, ymax)
  
          # if there is logo file, draw logo where there is flags
          if logo_filename is not None:
              mask, resized_logo_mask = self._add_logomask(
                  mask, logo_mask, xmin, ymin, xmax, ymax
              )
              resized_logo_mask_list.append(resized_logo_mask)
  
      # usually the first area is what we need, the other one(for confusing tool-box users) is too small
      if logo_mask is not None:
          adversarial_output = self.attack_optimize(
              sample_list, mask, logo_mask, resized_logo_mask_list[0]
          )
          # reconstruct image from perturbation
          adversarial_sticker = self._save_np_as_jpg(
              "final_adsticker.jpg",
              adversarial_output,
              logo_mask,
              resized_logo_mask_list[0],
          )
  
      else:
          adversarial_output = self.attack_optimize(sample_list, mask)
          # reconstruct image from perturbation
          adversarial_sticker = self._save_np_as_jpg(
              "final_adsticker.jpg", adversarial_output
          )
  
      return adversarial_sticker
  
imports: from __future__ import division
  from __future__ import print_function
  from builtins import input
  from builtins import range
  from builtins import object
  from past.utils import old_div
  from abc import ABCMeta
  from abc import abstractmethod
  import numpy
  import cv2
  import os
  import xmltodict
  import pdb
  from future.utils import with_metaclass
label_desc: Use image node_id 8 for calling the ODD_logic obj's underlying member method code with example usage: obj._attack_from_file(sample_folder, maskfilename, logo_filename) and returns: adversarial_sticker