class_docstr: Base class for instance masks.
class_docstr_tok: ["Base","class","for","instance","masks","."]
docstr: Crop and resize masks by the given bboxes.
  
  This function is mainly used in mask targets computation.
  It firstly align mask to bboxes by assigned_inds, then crop mask by the
  assigned bbox and resize to the size of (mask_h, mask_w)
  
  Args:
      bboxes (Tensor): Bboxes in format [x1, y1, x2, y2], shape (N, 4)
      out_shape (tuple[int]): Target (h, w) of resized mask
      inds (ndarray): Indexes to assign masks to each bbox
      device (str): Device of bboxes
      interpolation (str): See `mmcv.imresize`
  
  Return:
      BaseInstanceMasks: the cropped and resized masks.
docstr_tok: ["Crop","and","resize","masks","by","the","given","bboxes",".","This","function","is","mainly","used","in","mask","targets","computation",".","It","firstly","align","mask","to","bboxes","by","assigned_inds",",","then","crop","mask","by","the","assigned","bbox","and","resize","to","the","size","of","(","mask_h",",","mask_w",")","Args",":","bboxes","(","Tensor",")",":","Bboxes","in","format","[","x1",",","y1",",","x2",",","y2","]",",","shape","(","N",",","4",")","out_shape","(","tuple","[","int","]",")",":","Target","(","h",",","w",")","of","resized","mask","inds","(","ndarray",")",":","Indexes","to","assign","masks","to","each","bbox","device","(","str",")",":","Device","of","bboxes","interpolation","(","str",")",":","See","`","mmcv.imresize","`","Return",":","BaseInstanceMasks",":","the","cropped","and","resized","masks","."]
code: def crop_and_resize(
      self, bboxes, out_shape, inds, device, interpolation="bilinear"
  ):
      """Crop and resize masks by the given bboxes.
  
      This function is mainly used in mask targets computation.
      It firstly align mask to bboxes by assigned_inds, then crop mask by the
      assigned bbox and resize to the size of (mask_h, mask_w)
  
      Args:
          bboxes (Tensor): Bboxes in format [x1, y1, x2, y2], shape (N, 4)
          out_shape (tuple[int]): Target (h, w) of resized mask
          inds (ndarray): Indexes to assign masks to each bbox
          device (str): Device of bboxes
          interpolation (str): See `mmcv.imresize`
  
      Return:
          BaseInstanceMasks: the cropped and resized masks.
      """
      pass
  
imports: from abc import ABCMeta, abstractmethod
  import cv2
  import mmcv
  import numpy
  import pycocotools.mask
  import torch
  from mmcv.ops.roi_align import roi_align
label_desc: Use image node_id 6 for calling the BaseInstanceMasks obj's underlying member method code with example usage: obj.crop_and_resize(bboxes, out_shape, inds, device, interpolation) without return types