class_docstr: This class implements a model-specific object detector using Faster-RCNN and TensorFlow.
class_docstr_tok: ["This","class","implements","a","model-specific","object","detector","using","Faster-RCNN","and","TensorFlow","."]
docstr: Compute all loss components.
  
  :param x: Samples of shape (nb_samples, nb_features) or (nb_samples, nb_pixels_1, nb_pixels_2,
            nb_channels) or (nb_samples, nb_channels, nb_pixels_1, nb_pixels_2).
  :param y: Target values (class labels) one-hot-encoded of shape `(nb_samples, nb_classes)` or indices
            of shape `(nb_samples,)`.
  :return: Dictionary of loss components.
docstr_tok: ["Compute","all","loss","components",".",":","param","x",":","Samples","of","shape","(","nb_samples",",","nb_features",")","or","(","nb_samples",",","nb_pixels_1",",","nb_pixels_2",",","nb_channels",")","or","(","nb_samples",",","nb_channels",",","nb_pixels_1",",","nb_pixels_2",")",".",":","param","y",":","Target","values","(","class","labels",")","one-hot-encoded","of","shape","`","(","nb_samples",",","nb_classes",")","`","or","indices","of","shape","`","(","nb_samples",",",")","`",".",":","return",":","Dictionary","of","loss","components","."]
code: def compute_losses(self, x: np.ndarray, y: np.ndarray) -> Dict[str, np.ndarray]:  # type: ignore
      """
      Compute all loss components.
  
      :param x: Samples of shape (nb_samples, nb_features) or (nb_samples, nb_pixels_1, nb_pixels_2,
                nb_channels) or (nb_samples, nb_channels, nb_pixels_1, nb_pixels_2).
      :param y: Target values (class labels) one-hot-encoded of shape `(nb_samples, nb_classes)` or indices
                of shape `(nb_samples,)`.
      :return: Dictionary of loss components.
      """
      # Apply preprocessing
      x_preprocessed, _ = self._apply_preprocessing(
          x, y=None, fit=False
      )
  
      # Create feed_dict
      feed_dict = {self.images: x_preprocessed}
  
      for placeholder, value in zip(self._groundtruth_boxes_list, y):
          feed_dict[placeholder] = value["boxes"]
  
      for placeholder, value in zip(self._groundtruth_classes_list, y):
          feed_dict[placeholder] = value["labels"]
  
      for placeholder, value in zip(self._groundtruth_weights_list, y):
          feed_dict[placeholder] = value["scores"]
  
      # Get the losses graph
      if not hasattr(self, "_losses_dict"):
          self._losses_dict = {}
          for loss_name in self.attack_losses:
              self._losses_dict[loss_name] = self._losses[loss_name]
  
      losses: Dict[str, np.ndarray] = {}
      for loss_name in self.attack_losses:
          loss_value = self._sess.run(
              self._losses_dict[loss_name], feed_dict=feed_dict
          )
          losses[loss_name] = loss_value
  
      return losses
  
imports: import logging
  from typing import List, Dict, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from art.estimators.object_detection.object_detector import ObjectDetectorMixin
  from art.estimators.tensorflow import TensorFlowEstimator
  from art.utils import get_file
  from art import config
label_desc: Use image node_id 14 for calling the TensorFlowFasterRCNN obj's underlying member method code with example usage: obj.compute_losses(x, y) and returns: losses