class_docstr: Implementation of the ShapeShifter attack. This is a robust physical adversarial attack on Faster R-CNN object
  detector and is developed in TensorFlow.
  
  | Paper link: https://arxiv.org/abs/1804.05810
class_docstr_tok: ["Implementation","of","the","ShapeShifter","attack",".","This","is","a","robust","physical","adversarial","attack","on","Faster","R-CNN","object","detector","and","is","developed","in","TensorFlow",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1804.05810"]
docstr: Create the partial loss tensor of this attack from losses of the object detector.
  
  :return: Attack partial loss tensor.
docstr_tok: ["Create","the","partial","loss","tensor","of","this","attack","from","losses","of","the","object","detector",".",":","return",":","Attack","partial","loss","tensor","."]
code: def _create_faster_rcnn_loss(self) -> "Tensor":
      """
      Create the partial loss tensor of this attack from losses of the object detector.
  
      :return: Attack partial loss tensor.
      """
      import tensorflow as tf
  
      # Compute RPN classifier loss
      rpn_classifier_weight = tf.placeholder(
          dtype=tf.float32, shape=[], name="rpn_classifier_weight"
      )
  
      rpn_classifier_loss = self.estimator.losses[
          "Loss/RPNLoss/objectness_loss"
      ]
      weight_rpn_classifier_loss = tf.multiply(
          x=rpn_classifier_loss,
          y=rpn_classifier_weight,
          name="weight_rpn_classifier_loss",
      )
  
      # Compute RPN localizer loss
      rpn_localizer_weight = tf.placeholder(
          dtype=tf.float32, shape=[], name="rpn_localizer_weight"
      )
  
      rpn_localizer_loss = self.estimator.losses[
          "Loss/RPNLoss/localization_loss"
      ]
      weight_rpn_localizer_loss = tf.multiply(
          x=rpn_localizer_loss,
          y=rpn_localizer_weight,
          name="weight_rpn_localizer_loss",
      )
  
      # Compute box classifier loss
      box_classifier_weight = tf.placeholder(
          dtype=tf.float32, shape=[], name="box_classifier_weight"
      )
  
      box_classifier_loss = self.estimator.losses[
          "Loss/BoxClassifierLoss/classification_loss"
      ]
      weight_box_classifier_loss = tf.multiply(
          x=box_classifier_loss,
          y=box_classifier_weight,
          name="weight_box_classifier_loss",
      )
  
      # Compute box localizer loss
      box_localizer_weight = tf.placeholder(
          dtype=tf.float32, shape=[], name="box_localizer_weight"
      )
  
      box_localizer_loss = self.estimator.losses[
          "Loss/BoxClassifierLoss/localization_loss"
      ]
      weight_box_localizer_loss = tf.multiply(
          x=box_localizer_loss,
          y=box_localizer_weight,
          name="weight_box_localizer_loss",
      )
  
      # Compute partial loss
      partial_loss = tf.add_n(
          [
              weight_rpn_classifier_loss,
              weight_rpn_localizer_loss,
              weight_box_classifier_loss,
              weight_box_localizer_loss,
          ],
          name="partial_faster_rcnn_loss",
      )
  
      return partial_loss
  
file_path: adversarial-robustness-toolbox/art/attacks/evasion/shapeshifter.py
imports: import logging
  from typing import List, Dict, Optional, Tuple, TYPE_CHECKING
  import numpy
  from art.attacks.attack import EvasionAttack
  from art.estimators.object_detection.tensorflow_faster_rcnn import TensorFlowFasterRCNN
label_desc: Use image node_id 7 for calling the ShapeShifter obj's underlying member method code with example usage: obj._create_faster_rcnn_loss() and returns: partial_loss