class_docstr: A `RegionDetector` takes a batch of images, their sizes, and an ordered dictionary
  of image features as input, and finds regions of interest (or "boxes") within those images.
  
  Those regions of interest are described by three values:
  
  - `features` (`List[Tensor]`): A feature vector for each region, which is a tensor of shape
    `(num_boxes, feature_dim)`.
  - `boxes` (`List[Tensor]`): The coordinates of each region within the original image, with shape
    `(num_boxes, 4)`.
  - `class_probs` (`Optional[List[Tensor]]`): Class probabilities from some object
    detector that was used to find the regions of interest, with shape `(num_boxes,)`
    or `(num_boxes, *)` if probabilities for more than one class are given.
  - `class_labels` (`Optional[List[Tensor]]`): The labels corresponding to `class_probs`.
    Each tensor in this list has the same shape as the corresponding tensor in `class_probs`.
class_docstr_tok: ["A","`","RegionDetector","`","takes","a","batch","of","images",",","their","sizes",",","and","an","ordered","dictionary","of","image","features","as","input",",","and","finds","regions","of","interest","(","or","``","boxes","''",")","within","those","images",".","Those","regions","of","interest","are","described","by","three","values",":","-","`","features","`","(","`","List","[","Tensor","]","`",")",":","A","feature","vector","for","each","region",",","which","is","a","tensor","of","shape","`","(","num_boxes",",","feature_dim",")","`",".","-","`","boxes","`","(","`","List","[","Tensor","]","`",")",":","The","coordinates","of","each","region","within","the","original","image",",","with","shape","`","(","num_boxes",",","4",")","`",".","-","`","class_probs","`","(","`","Optional","[","List","[","Tensor","]","]","`",")",":","Class","probabilities","from","some","object","detector","that","was","used","to","find","the","regions","of","interest",",","with","shape","`","(","num_boxes",",",")","`","or","`","(","num_boxes",",","*",")","`","if","probabilities","for","more","than","one","class","are","given",".","-","`","class_labels","`","(","`","Optional","[","List","[","Tensor","]","]","`",")",":","The","labels","corresponding","to","`","class_probs","`",".","Each","tensor","in","this","list","has","the","same","shape","as","the","corresponding","tensor","in","`","class_probs","`","."]
code: def forward(
      self,
      images: FloatTensor,
      sizes: IntTensor,
      image_features: "OrderedDict[str, FloatTensor]",
  ) -> RegionDetectorOutput:
      raise NotImplementedError()
  
imports: import itertools
  import random
  from collections import OrderedDict
  from typing import NamedTuple, Optional, List, Tuple
  import torch
  from torch import nn, FloatTensor, IntTensor, Tensor
  import torch.nn.functional
  import torchvision
  import torchvision.ops.boxes
  from allennlp.common import Registrable
label_desc: Use image node_id 1 for calling the RegionDetector obj's underlying member method code with example usage: obj.forward(images, sizes, image_features) without return types