class_docstr: Module to be used for object detection purposes.
  
  The module subclasses :py:class:`~kornia.x.Trainer` and overrides the
  :py:func:`~kornia.x.Trainer.evaluate` function implementing IoU :py:func:`~kornia.metrics.mean_iou`.
  
  .. seealso::
      Learn how to use this class in the following
      `example <https://github.com/kornia/tutorials/tree/master/scripts/training/object_detection/>`__.
class_docstr_tok: ["Module","to","be","used","for","object","detection","purposes",".","The","module","subclasses",":","py",":","class",":","`","~kornia.x.Trainer","`","and","overrides","the",":","py",":","func",":","`","~kornia.x.Trainer.evaluate","`","function","implementing","IoU",":","py",":","func",":","`","~kornia.metrics.mean_iou","`",".","..","seealso",":",":","Learn","how","to","use","this","class","in","the","following","`","example","<","https",":","\/\/github.com\/kornia\/tutorials\/tree\/master\/scripts\/training\/object_detection\/",">","`","__","."]
code: def on_model(
      self, model: Module, sample: Dict[str, Tensor]
  ) -> Tensor:
      if self.loss_computed_by_model and model.training:
          return model(sample["input"], sample["target"])
      return model(sample["input"])
  
file_path: kornia/kornia/x/trainers.py
imports: from typing import Any, Callable, Dict, Optional, Tuple
  from torch.optim import Optimizer, lr_scheduler
  from torch.utils.data import DataLoader
  from kornia.core import Module, Tensor, stack
  from kornia.metrics import accuracy, mean_average_precision, mean_iou
  from .trainer import Trainer
  from .utils import Configuration
label_desc: Use image node_id 2 for calling the ObjectDetectionTrainer obj's underlying member method code with example usage: obj.on_model(model, sample) and returns: model, model