docstr: Gets a dataset and a model as input and returns losses calculated per image + losses stats.
  In case of faster_rcnn those are loss_classifier, loss_box_reg and loss_total
  (sum of the first 2 plus RPN related losses, e.g. sum of 4 terms).
  
  Arguments
  ---------
  model: nn.Module
  dataset: Dataset
  
  Returns
  -------
  samples_plus_losses: those are the samples (dictionaries) contained in the original dataset
                      enriched with losses.
  losses_stats: dictionary containing losses stats (min, max, mean, 1-25-50-75-99 quantiles)
              for each one of the losses.
docstr_tok: ["Gets","a","dataset","and","a","model","as","input","and","returns","losses","calculated","per","image","+","losses","stats",".","In","case","of","faster_rcnn","those","are","loss_classifier",",","loss_box_reg","and","loss_total","(","sum","of","the","first","2","plus","RPN","related","losses",",","e.g",".","sum","of","4","terms",")",".","Arguments","--","--","--","--","-","model",":","nn.Module","dataset",":","Dataset","Returns","--","--","--","-","samples_plus_losses",":","those","are","the","samples","(","dictionaries",")","contained","in","the","original","dataset","enriched","with","losses",".","losses_stats",":","dictionary","containing","losses","stats","(","min",",","max",",","mean",",","1-25-50-75-99","quantiles",")","for","each","one","of","the","losses","."]
code: def get_losses(
      self,
      model: nn.Module,
      dataset: Dataset,
  ) -> Tuple[List[dict], dict]:
      """
      Gets a dataset and a model as input and returns losses calculated per image + losses stats.
      In case of faster_rcnn those are loss_classifier, loss_box_reg and loss_total
      (sum of the first 2 plus RPN related losses, e.g. sum of 4 terms).
  
      Arguments
      ---------
      model: nn.Module
      dataset: Dataset
  
      Returns
      -------
      samples_plus_losses: those are the samples (dictionaries) contained in the original dataset
                          enriched with losses.
      losses_stats: dictionary containing losses stats (min, max, mean, 1-25-50-75-99 quantiles)
                  for each one of the losses.
      """
      model.train()
      device = model_device(model)
      losses_stats = self.losses_dict
      dl = self.valid_dl(
          dataset, batch_size=1, num_workers=0, shuffle=False
      )
  
      samples_plus_losses, losses_stats = self._loop(
          dl, model, losses_stats, device
      )
  
      losses_stats = {k: get_stats(v) for k, v in losses_stats.items()}
      losses_stats = _prepend_str(losses_stats, "loss")
      return samples_plus_losses, losses_stats
  
file_path: icevision/icevision/models/interpretation.py
imports: from icevision.imports import *
  from icevision.utils import *
  from icevision.core import *
  from icevision.data import *
  from icevision.visualize.show_data import show_preds
  from icevision.core.record_components import LossesRecordComponent
label_desc: Use image node_id 5 for calling the Interpretation obj's underlying member method code with example usage: obj.get_losses(model, dataset) and returns: samples_plus_losses,  losses_stats