class_docstr: Close implementation of Feature Collision Poisoning Attack by Shafahi, Huang, et al 2018.
  "Poison Frogs! Targeted Clean-Label Poisoning Attacks on Neural Networks"
  
  This implementation dynamically calculates the dimension of the feature layer, and doesn't hardcode this
  value to 2048 as done in the paper. Thus we recommend using larger values for the similarity_coefficient.
  
  | Paper link: https://arxiv.org/abs/1804.00792
class_docstr_tok: ["Close","implementation","of","Feature","Collision","Poisoning","Attack","by","Shafahi",",","Huang",",","et","al","2018",".","``","Poison","Frogs","!","Targeted","Clean-Label","Poisoning","Attacks","on","Neural","Networks","''","This","implementation","dynamically","calculates","the","dimension","of","the","feature","layer",",","and","does","n't","hardcode","this","value","to","2048","as","done","in","the","paper",".","Thus","we","recommend","using","larger","values","for","the","similarity_coefficient",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1804.00792"]
docstr: Objective function of the attack
  
  :param poison_feature_rep: The numpy activations of the poison image.
  :param target_feature_rep: The numpy activations of the target image.
  :param base_image: The initial image used to poison.
  :param poison: The current poison image.
  :return: The objective of the optimization.
docstr_tok: ["Objective","function","of","the","attack",":","param","poison_feature_rep",":","The","numpy","activations","of","the","poison","image",".",":","param","target_feature_rep",":","The","numpy","activations","of","the","target","image",".",":","param","base_image",":","The","initial","image","used","to","poison",".",":","param","poison",":","The","current","poison","image",".",":","return",":","The","objective","of","the","optimization","."]
code: def objective(
      self,
      poison_feature_rep: np.ndarray,
      target_feature_rep: np.ndarray,
      base_image: np.ndarray,
      poison: np.ndarray,
  ) -> float:
      """
      Objective function of the attack
  
      :param poison_feature_rep: The numpy activations of the poison image.
      :param target_feature_rep: The numpy activations of the target image.
      :param base_image: The initial image used to poison.
      :param poison: The current poison image.
      :return: The objective of the optimization.
      """
      num_features = base_image.size
      num_activations = poison_feature_rep.size
      beta = (
          self.similarity_coeff * (num_activations / num_features) ** 2
      )
      return float(
          np.linalg.norm(poison_feature_rep - target_feature_rep)
          + beta * np.linalg.norm(poison - base_image)
      )
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from functools import reduce
  import logging
  from typing import Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from tqdm.auto import trange
  from art.attacks.attack import PoisoningAttackWhiteBox
  from art.estimators import BaseEstimator, NeuralNetworkMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.estimators.classification.keras import KerasClassifier
  from art.estimators.classification.pytorch import PyTorchClassifier
label_desc: Use image node_id 5 for calling the FeatureCollisionAttack obj's underlying member method code with example usage: obj.objective(poison_feature_rep, target_feature_rep, base_image, poison) and returns: float