class_docstr: CFA: Coupled-hypersphere-based Feature Adaptation for Target-Oriented Anomaly Localization.
  
  Args:
      input_size (tuple[int, int]): Size of the model input.
      backbone (str): Backbone CNN network
      gamma_c (int, optional): gamma_c value from the paper. Defaults to 1.
      gamma_d (int, optional): gamma_d value from the paper. Defaults to 1.
      num_nearest_neighbors (int): Number of nearest neighbors.
      num_hard_negative_features (int): Number of hard negative features.
      radius (float): Radius of the hypersphere to search the soft boundary.
class_docstr_tok: ["CFA",":","Coupled-hypersphere-based","Feature","Adaptation","for","Target-Oriented","Anomaly","Localization",".","Args",":","input_size","(","tuple","[","int",",","int","]",")",":","Size","of","the","model","input",".","backbone","(","str",")",":","Backbone","CNN","network","gamma_c","(","int",",","optional",")",":","gamma_c","value","from","the","paper",".","Defaults","to","1.","gamma_d","(","int",",","optional",")",":","gamma_d","value","from","the","paper",".","Defaults","to","1.","num_nearest_neighbors","(","int",")",":","Number","of","nearest","neighbors",".","num_hard_negative_features","(","int",")",":","Number","of","hard","negative","features",".","radius","(","float",")",":","Radius","of","the","hypersphere","to","search","the","soft","boundary","."]
code: def __init__(
      self,
      input_size: tuple[int, int],
      backbone: str,
      gamma_c: int = 1,
      gamma_d: int = 1,
      num_nearest_neighbors: int = 3,
      num_hard_negative_features: int = 3,
      radius: float = 1e-5,
  ) -> None:
      super().__init__()
      self.model: CfaModel = CfaModel(
          input_size=input_size,
          backbone=backbone,
          gamma_c=gamma_c,
          gamma_d=gamma_d,
          num_nearest_neighbors=num_nearest_neighbors,
          num_hard_negative_features=num_hard_negative_features,
          radius=radius,
      )
      self.loss = CfaLoss(
          num_nearest_neighbors=num_nearest_neighbors,
          num_hard_negative_features=num_hard_negative_features,
          radius=radius,
      )
  
imports: from __future__ import annotations
  import logging
  import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning import Callback
  from pytorch_lightning.callbacks import EarlyStopping
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from torch import Tensor
  from torch.optim.optimizer import Optimizer
  from anomalib.models.cfa.loss import CfaLoss
  from anomalib.models.cfa.torch_model import CfaModel
  from anomalib.models.components import AnomalyModule
label_desc: Use image node_id 1 to create a new Cfa object from inherited base classes: AnomalyModule with example: obj = Cfa(input_size, backbone, gamma_c, gamma_d, num_nearest_neighbors, num_hard_negative_features, radius)