class_docstr: Callback that evaluates whether there is improvement in the loss function.
  
  The module track the losses and in case of finish patience sends a termination signal to the trainer.
  
  Args:
      monitor: the name of the value to track.
      min_delta: the minimum difference between losses to increase the patience counter.
      patience: the number of times to wait until the trainer does not terminate.
  
  **Usage example:**
  
  .. code:: python
  
      early_stop = EarlyStopping(
          monitor="top5", filepath="early_stop_model.pt"
      )
  
      trainer = ImageClassifierTrainer(...,
          callbacks={"on_checkpoint", early_stop}
      )
class_docstr_tok: ["Callback","that","evaluates","whether","there","is","improvement","in","the","loss","function",".","The","module","track","the","losses","and","in","case","of","finish","patience","sends","a","termination","signal","to","the","trainer",".","Args",":","monitor",":","the","name","of","the","value","to","track",".","min_delta",":","the","minimum","difference","between","losses","to","increase","the","patience","counter",".","patience",":","the","number","of","times","to","wait","until","the","trainer","does","not","terminate",".","*","*","Usage","example",":","*","*","..","code",":",":","python","early_stop","=","EarlyStopping","(","monitor=","''","top5","''",",","filepath=","''","early_stop_model.pt","''",")","trainer","=","ImageClassifierTrainer","(","...",",","callbacks=","{","``","on_checkpoint","''",",","early_stop","}",")"]
code: def __init__(
      self, monitor: str, min_delta: float = 0.0, patience: int = 8
  ) -> None:
      self.monitor = monitor
      self.min_delta = min_delta
      self.patience = patience
  
      self.counter: int = 0
      self.best_score: Optional[float] = None
      self.early_stop: bool = False
  
file_path: kornia/kornia/x/callbacks.py
imports: from pathlib import Path
  from typing import Callable, Dict, Optional, Union
  import torch
  from kornia.core import Module
  from kornia.metrics import AverageMeter
  from .utils import TrainerState
label_desc: Use image node_id 1 to create a new EarlyStopping object  with example: obj = EarlyStopping(monitor, min_delta, patience)