code: def evaluate_lvis(
      model,
      data_loader,
      device,
      lvis: LVIS,
      metric_logger,
      cpu_device,
      iou_types,
  ):
      # Lorenzo: implemented by taking inspiration from COCO code
      lvis_evaluator = LvisEvaluator(lvis, iou_types)
      header = "Test:"
  
      for images, targets, *_ in metric_logger.log_every(
          data_loader, 100, header
      ):
          images = list(img.to(device) for img in images)
  
          if torch.cuda.is_available():
              torch.cuda.synchronize()
          model_time = time.time()
          outputs = model(images)
          outputs = [
              {k: v.to(cpu_device) for k, v in t.items()}
              for t in outputs
          ]
          model_time = time.time() - model_time
  
          res = {
              target["image_id"].item(): output
              for target, output in zip(targets, outputs)
          }
          evaluator_time = time.time()
          lvis_evaluator.update(res)
          evaluator_time = time.time() - evaluator_time
          metric_logger.update(
              model_time=model_time, evaluator_time=evaluator_time
          )
  
      # gather the stats from all processes
      metric_logger.synchronize_between_processes()
      print("Averaged stats:", metric_logger)
      lvis_eval_per_iou = lvis_evaluator.evaluate()
      lvis_evaluator.summarize()
  
      return lvis_eval_per_iou
  
file_path: avalanche/examples/tvdetection/engine.py
imports: import math
  import sys
  import time
  import torch
  import torchvision.models.detection.mask_rcnn
  from lvis import LVIS
  from pycocotools.coco import COCO
  from torch.utils.data import Subset
  from avalanche.benchmarks.utils import _make_taskaware_classification_dataset, _taskaware_classification_subset, _concat_taskaware_classification_datasets
  from examples.tvdetection.coco_eval import CocoEvaluator
  from examples.tvdetection.coco_utils import CocoDetection, convert_to_coco_api
  from examples.tvdetection.lvis_eval import LvisEvaluator
  from examples.tvdetection.utils import MetricLogger, SmoothedValue, reduce_dict
label_desc: Use image node_id 4 for calling a global function with example usage: evaluate_lvis(model, data_loader, device, lvis, metric_logger, cpu_device, iou_types) and returns: lvis_eval_per_iou