class_docstr: Rescale the image to the height according to setting and keep the aspect
  ratio unchanged if possible. However, if any of ``min_width``,
  ``max_width`` or ``width_divisor`` are specified, aspect ratio may still be
  changed to ensure the width meets these constraints.
  
  Required Keys:
  
  - img
  
  Modified Keys:
  
  - img
  - img_shape
  
  Added Keys:
  
  - scale
  - scale_factor
  - keep_ratio
  
  Args:
      height (int): Height of rescaled image.
      min_width (int, optional): Minimum width of rescaled image. Defaults
          to None.
      max_width (int, optional): Maximum width of rescaled image. Defaults
          to None.
      width_divisor (int): The divisor of width size. Defaults to 1.
      resize_type (str): The type of resize class to use. Defaults to
          "Resize".
      **resize_kwargs: Other keyword arguments for the ``resize_type``.
class_docstr_tok: ["Rescale","the","image","to","the","height","according","to","setting","and","keep","the","aspect","ratio","unchanged","if","possible",".","However",",","if","any","of","``","min_width","``",",","``","max_width","``","or","``","width_divisor","``","are","specified",",","aspect","ratio","may","still","be","changed","to","ensure","the","width","meets","these","constraints",".","Required","Keys",":","-","img","Modified","Keys",":","-","img","-","img_shape","Added","Keys",":","-","scale","-","scale_factor","-","keep_ratio","Args",":","height","(","int",")",":","Height","of","rescaled","image",".","min_width","(","int",",","optional",")",":","Minimum","width","of","rescaled","image",".","Defaults","to","None",".","max_width","(","int",",","optional",")",":","Maximum","width","of","rescaled","image",".","Defaults","to","None",".","width_divisor","(","int",")",":","The","divisor","of","width","size",".","Defaults","to","1.","resize_type","(","str",")",":","The","type","of","resize","class","to","use",".","Defaults","to","``","Resize","''",".","*","*","resize_kwargs",":","Other","keyword","arguments","for","the","``","resize_type","``","."]
code: def __init__(
      self,
      height: int,
      min_width: Optional[int] = None,
      max_width: Optional[int] = None,
      width_divisor: int = 1,
      resize_type: str = "Resize",
      **resize_kwargs,
  ) -> None:
      super().__init__()
      assert isinstance(height, int)
      assert isinstance(width_divisor, int)
      if min_width is not None:
          assert isinstance(min_width, int)
      if max_width is not None:
          assert isinstance(max_width, int)
      self.width_divisor = width_divisor
      self.height = height
      self.min_width = min_width
      self.max_width = max_width
      self.resize_cfg = dict(type=resize_type, **resize_kwargs)
      self.resize_cfg.update(dict(scale=0))
      self.resize = TRANSFORMS.build(self.resize_cfg)
  
imports: import math
  import random
  from typing import Dict, List, Optional, Tuple
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms.base import BaseTransform
  from mmcv.transforms.utils import cache_randomness
  from mmocr.registry import TRANSFORMS
label_desc: Use image node_id 1 to create a new RescaleToHeight object from inherited base classes: BaseTransform with example: obj = RescaleToHeight(height, min_width, max_width, width_divisor, resize_type)