code: def obtain_base_model(segmentation: bool):
      torchvision_is_old_version = parse(torch.__version__) < parse(
          "0.13"
      )
  
      pretrain_argument = dict()
  
      if torchvision_is_old_version:
          pretrain_argument["pretrained"] = True
      else:
          if segmentation:
              pretrain_argument[
                  "weights"
              ] = (
                  torchvision.models.detection.mask_rcnn.MaskRCNN_ResNet50_FPN_Weights.DEFAULT
              )
          else:
              pretrain_argument[
                  "weights"
              ] = (
                  torchvision.models.detection.faster_rcnn.FasterRCNN_ResNet50_FPN_Weights.DEFAULT
              )
  
      if segmentation:
          model = torchvision.models.detection.maskrcnn_resnet50_fpn(
              **pretrain_argument
          )
      else:
          model = torchvision.models.detection.fasterrcnn_resnet50_fpn(
              **pretrain_argument
          )
      return model
  
file_path: avalanche/examples/detection_lvis.py
imports: import logging
  from pathlib import Path
  from typing import Union
  from packaging.version import parse
  from avalanche.benchmarks.datasets.lvis_dataset import LvisDataset
  from avalanche.evaluation.metrics.detection import make_lvis_metrics
  from avalanche.training.supervised.naive_object_detection import ObjectDetectionTemplate
  from avalanche.evaluation.metrics import timing_metrics, loss_metrics
  from avalanche.logging import InteractiveLogger
  from avalanche.training.plugins import LRSchedulerPlugin, EvaluationPlugin
  import argparse
  import torch
  from torchvision.transforms import ToTensor
  import torchvision
  from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
  from examples.detection_examples_utils import split_detection_benchmark
label_desc: Use image node_id 2 for calling a global function with example usage: obtain_base_model(segmentation) and returns: model