class_docstr: Pseudo mask pre-processor for BoxInst.
  
  Comparing with the :class:`mmdet.DetDataPreprocessor`,
  
  1. It generates masks using box annotations.
  2. It computes the images color similarity in LAB color space.
  
  Args:
      mask_stride (int): The mask output stride in boxinst. Defaults to 4.
      pairwise_size (int): The size of neighborhood for each pixel.
          Defaults to 3.
      pairwise_dilation (int): The dilation of neighborhood for each pixel.
          Defaults to 2.
      pairwise_color_thresh (float): The thresh of image color similarity.
          Defaults to 0.3.
      bottom_pixels_removed (int): The length of removed pixels in bottom.
          It is caused by the annotation error in coco dataset.
          Defaults to 10.
class_docstr_tok: ["Pseudo","mask","pre-processor","for","BoxInst",".","Comparing","with","the",":","class",":","`","mmdet.DetDataPreprocessor","`",",","1",".","It","generates","masks","using","box","annotations",".","2",".","It","computes","the","images","color","similarity","in","LAB","color","space",".","Args",":","mask_stride","(","int",")",":","The","mask","output","stride","in","boxinst",".","Defaults","to","4.","pairwise_size","(","int",")",":","The","size","of","neighborhood","for","each","pixel",".","Defaults","to","3.","pairwise_dilation","(","int",")",":","The","dilation","of","neighborhood","for","each","pixel",".","Defaults","to","2.","pairwise_color_thresh","(","float",")",":","The","thresh","of","image","color","similarity",".","Defaults","to","0.3.","bottom_pixels_removed","(","int",")",":","The","length","of","removed","pixels","in","bottom",".","It","is","caused","by","the","annotation","error","in","coco","dataset",".","Defaults","to","10","."]
docstr: Compute the image color similarity in LAB color space.
code: def get_images_color_similarity(
      self, inputs: Tensor, image_masks: Tensor
  ) -> Tensor:
      """Compute the image color similarity in LAB color space."""
      assert inputs.dim() == 4
      assert inputs.size(0) == 1
  
      unfolded_images = unfold_wo_center(
          inputs,
          kernel_size=self.pairwise_size,
          dilation=self.pairwise_dilation,
      )
      diff = inputs[:, :, None] - unfolded_images
      similarity = torch.exp(-torch.norm(diff, dim=1) * 0.5)
  
      unfolded_weights = unfold_wo_center(
          image_masks[None, None],
          kernel_size=self.pairwise_size,
          dilation=self.pairwise_dilation,
      )
      unfolded_weights = torch.max(unfolded_weights, dim=1)[0]
  
      return similarity * unfolded_weights
  
imports: import random
  from numbers import Number
  from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmengine.dist import barrier, broadcast, get_dist_info
  from mmengine.logging import MessageHub
  from mmengine.model import BaseDataPreprocessor, ImgDataPreprocessor
  from mmengine.structures import PixelData
  from mmengine.utils import is_seq_of
  from torch import Tensor
  from mmdet.models.utils import unfold_wo_center
  from mmdet.models.utils.misc import samplelist_boxtype2tensor
  from mmdet.registry import MODELS
  from mmdet.structures import DetDataSample
  from mmdet.structures.mask import BitmapMasks
  from mmdet.utils import ConfigType
label_desc: Use image node_id 2 for calling the BoxInstDataPreprocessor obj's underlying member method code with example usage: obj.get_images_color_similarity(inputs, image_masks) and returns: unknown