docs: def forward(self, images, targets=None):
          """
          Arguments:
              images (list[Tensor] or ImageList): images to be processed
              targets (list[BoxList]): ground-truth boxes present in the image (optional)
  
          Returns:
              result (list[BoxList] or dict[Tensor]): the output from the model.
                  During training, it returns a dict[Tensor] which contains the losses.
                  During testing, it returns list[BoxList] contains additional fields
                  like `scores`, `labels` and `mask` (for Mask R-CNN models).
  
          """
          if self.training and targets is None:
              raise ValueError("In training mode, targets should be passed")
          images = to_image_list(images)
          features = self.backbone(images.tensors)
          proposals, proposal_losses = self.rpn(images, features, targets)
          if self.roi_heads:
              x, result, detector_losses = self.roi_heads(features, proposals, targets)
          else:
              # RPN-only models don't have roi_heads
              x = features
              result = proposals
              detector_losses = {}
  
          if self.training:
              losses = {}
              losses.update(detector_losses)
              losses.update(proposal_losses)
              return losses
  
          return result