class_docstr: Binary detector of adversarial samples coming from evasion attacks. The detector uses an architecture provided by
  the user and is trained on the values of the activations of a classifier at a given layer.
class_docstr_tok: ["Binary","detector","of","adversarial","samples","coming","from","evasion","attacks",".","The","detector","uses","an","architecture","provided","by","the","user","and","is","trained","on","the","values","of","the","activations","of","a","classifier","at","a","given","layer","."]
docstr: Perform detection of adversarial data and return prediction as tuple.
  
  :param x: Data sample on which to perform detection.
  :param batch_size: Size of batches.
  :return: (report, is_adversarial):
          where report is a dictionary containing the detector model output predictions;
          where is_adversarial is a boolean list of per-sample prediction whether the sample is adversarial
          or not and has the same `batch_size` (first dimension) as `x`.
docstr_tok: ["Perform","detection","of","adversarial","data","and","return","prediction","as","tuple",".",":","param","x",":","Data","sample","on","which","to","perform","detection",".",":","param","batch_size",":","Size","of","batches",".",":","return",":","(","report",",","is_adversarial",")",":","where","report","is","a","dictionary","containing","the","detector","model","output","predictions",";","where","is_adversarial","is","a","boolean","list","of","per-sample","prediction","whether","the","sample","is","adversarial","or","not","and","has","the","same","`","batch_size","`","(","first","dimension",")","as","`","x","`","."]
code: def detect(
      self, x: np.ndarray, batch_size: int = 128, **kwargs
  ) -> Tuple[dict, np.ndarray]:
      """
      Perform detection of adversarial data and return prediction as tuple.
  
      :param x: Data sample on which to perform detection.
      :param batch_size: Size of batches.
      :return: (report, is_adversarial):
              where report is a dictionary containing the detector model output predictions;
              where is_adversarial is a boolean list of per-sample prediction whether the sample is adversarial
              or not and has the same `batch_size` (first dimension) as `x`.
      """
      x_activations: np.ndarray = self._get_activations(
          x, self._layer_name, batch_size
      )
      predictions = self.detector.predict(
          x_activations, batch_size=batch_size
      )
      is_adversarial = np.argmax(predictions, axis=1).astype(bool)
      report = {"predictions": predictions}
  
      return report, is_adversarial
  
file_path: adversarial-robustness-toolbox/art/defences/detector/evasion/binary_activation_detector.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Tuple, Union, TYPE_CHECKING
  import numpy
  from art.defences.detector.evasion.evasion_detector import EvasionDetector
label_desc: Use image node_id 4 for calling the BinaryActivationDetector obj's underlying member method code with example usage: obj.detect(x, batch_size) and returns: report,  is_adversarial