class_docstr: The object detection naive strategy.
  
  The simplest (and least effective) Continual Learning strategy. Naive just
  incrementally fine-tunes a single model without employing any method
  to contrast the catastrophic forgetting of previous knowledge.
  This strategy does not use task identities.
  
  Naive is easy to set up and its results are commonly used to show the worst
  performing baseline.
  
  This strategy can be used as a template for any object detection strategy.
  This template assumes that the provided model follows the same interface
  of torchvision detection models.
  
  For more info, refer to "TorchVision Object Detection Finetuning Tutorial":
  https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html
class_docstr_tok: ["The","object","detection","naive","strategy",".","The","simplest","(","and","least","effective",")","Continual","Learning","strategy",".","Naive","just","incrementally","fine-tunes","a","single","model","without","employing","any","method","to","contrast","the","catastrophic","forgetting","of","previous","knowledge",".","This","strategy","does","not","use","task","identities",".","Naive","is","easy","to","set","up","and","its","results","are","commonly","used","to","show","the","worst","performing","baseline",".","This","strategy","can","be","used","as","a","template","for","any","object","detection","strategy",".","This","template","assumes","that","the","provided","model","follows","the","same","interface","of","torchvision","detection","models",".","For","more","info",",","refer","to","``","TorchVision","Object","Detection","Finetuning","Tutorial","''",":","https",":","\/\/pytorch.org\/tutorials\/intermediate\/torchvision_tutorial.html"]
docstr: Creates a naive detection strategy instance.
  
  :param model: The PyTorch detection model. This strategy accepts model
      from the torchvision library (as well as all model sharing the same
      interface/behavior)
  :param optimizer: PyTorch optimizer.
  :param train_mb_size: mini-batch size for training.
  :param train_epochs: number of training epochs.
  :param eval_mb_size: mini-batch size for eval.
  :param evaluator: (optional) instance of EvaluationPlugin for logging
      and metric computations. None to remove logging.
  :param eval_every: the frequency of the calls to `eval` inside the
      training loop. -1 disables the evaluation. 0 means `eval` is called
      only at the end of the learning experience. Values >0 mean that
      `eval` is called every `eval_every` epochs and at the end of the
      learning experience.
  :param peval_mode: one of {'epoch', 'iteration'}. Decides whether the
      periodic evaluation during training should execute every
      `eval_every` epochs or iterations (Default='epoch').
  :param scaler: The scaler from PyTorch Automatic Mixed Precision
      package. More info here: https://pytorch.org/docs/stable/amp.html.
      Defaults to None.
docstr_tok: ["Creates","a","naive","detection","strategy","instance",".",":","param","model",":","The","PyTorch","detection","model",".","This","strategy","accepts","model","from","the","torchvision","library","(","as","well","as","all","model","sharing","the","same","interface\/behavior",")",":","param","optimizer",":","PyTorch","optimizer",".",":","param","train_mb_size",":","mini-batch","size","for","training",".",":","param","train_epochs",":","number","of","training","epochs",".",":","param","eval_mb_size",":","mini-batch","size","for","eval",".",":","param","evaluator",":","(","optional",")","instance","of","EvaluationPlugin","for","logging","and","metric","computations",".","None","to","remove","logging",".",":","param","eval_every",":","the","frequency","of","the","calls","to","`","eval","`","inside","the","training","loop",".","-1","disables","the","evaluation",".","0","means","`","eval","`","is","called","only","at","the","end","of","the","learning","experience",".","Values",">","0","mean","that","`","eval","`","is","called","every","`","eval_every","`","epochs","and","at","the","end","of","the","learning","experience",".",":","param","peval_mode",":","one","of","{","'epoch","'",",","'iteration","'","}",".","Decides","whether","the","periodic","evaluation","during","training","should","execute","every","`","eval_every","`","epochs","or","iterations","(","Default='epoch","'",")",".",":","param","scaler",":","The","scaler","from","PyTorch","Automatic","Mixed","Precision","package",".","More","info","here",":","https",":","\/\/pytorch.org\/docs\/stable\/amp.html",".","Defaults","to","None","."]
code: def __init__(
      self,
      model: Module,
      optimizer: Optimizer,
      train_mb_size: int = 1,
      train_epochs: int = 1,
      eval_mb_size: int = 1,
      device: Union[str, torch.device] = "cpu",
      plugins: Optional[Sequence["SupervisedPlugin"]] = None,
      evaluator: Union[
          EvaluationPlugin, Callable[[], EvaluationPlugin]
      ] = default_evaluator,
      eval_every=-1,
      peval_mode="epoch",
      scaler=None,
  ):
      """
      Creates a naive detection strategy instance.
  
      :param model: The PyTorch detection model. This strategy accepts model
          from the torchvision library (as well as all model sharing the same
          interface/behavior)
      :param optimizer: PyTorch optimizer.
      :param train_mb_size: mini-batch size for training.
      :param train_epochs: number of training epochs.
      :param eval_mb_size: mini-batch size for eval.
      :param evaluator: (optional) instance of EvaluationPlugin for logging
          and metric computations. None to remove logging.
      :param eval_every: the frequency of the calls to `eval` inside the
          training loop. -1 disables the evaluation. 0 means `eval` is called
          only at the end of the learning experience. Values >0 mean that
          `eval` is called every `eval_every` epochs and at the end of the
          learning experience.
      :param peval_mode: one of {'epoch', 'iteration'}. Decides whether the
          periodic evaluation during training should execute every
          `eval_every` epochs or iterations (Default='epoch').
      :param scaler: The scaler from PyTorch Automatic Mixed Precision
          package. More info here: https://pytorch.org/docs/stable/amp.html.
          Defaults to None.
      """
      super().__init__(
          model=model,
          optimizer=optimizer,
          train_mb_size=train_mb_size,
          train_epochs=train_epochs,
          eval_mb_size=eval_mb_size,
          device=device,
          plugins=plugins,
          evaluator=evaluator,
          eval_every=eval_every,
          peval_mode=peval_mode,
      )
      self.scaler = scaler  # torch.cuda.amp.autocast scaler
      """
          The scaler from PyTorch Automatic Mixed Precision package.
          More info here: https://pytorch.org/docs/stable/amp.html
          """
  
      # Object Detection attributes
      self.detection_loss_dict = None
      """
          A dictionary of detection losses.
  
          Only valid during the training phase.
          """
  
      self.detection_predictions = None
      """
          A list of detection predictions.
  
          This is different from mb_output: mb_output is a list of dictionaries 
          (one dictionary for each image in the input minibatch), 
          while this field, which is populated after calling `criterion()`,
          will be a dictionary {image_id: list_of_predictions}.
  
          Only valid during the evaluation phase. 
          """
  
imports: from typing import Callable, Optional, Sequence, Union
  import torch
  from torch.nn import Module
  from torch.optim import Optimizer
  from torch.utils.data import DataLoader
  from avalanche.benchmarks.utils.data_loader import collate_from_data_or_kwargs, TaskBalancedDataLoader
  from avalanche.benchmarks.utils import detection_collate_fn
  from avalanche.core import SupervisedPlugin
  from avalanche.training.plugins import EvaluationPlugin
  from avalanche.training.plugins.evaluation import default_evaluator
  from avalanche.training.templates import SupervisedTemplate
label_desc: Use image node_id 1 to create a new ObjectDetectionTemplate object from inherited base classes: SupervisedTemplate with example: obj = ObjectDetectionTemplate(model, optimizer, train_mb_size, train_epochs, eval_mb_size, device, plugins, evaluator, eval_every, peval_mode, scaler)