typing_utils.py 737 B

12345678910111213141516171819202122
  1. # Copyright (c) OpenMMLab. All rights reserved.
  2. """Collecting some commonly used type hint in mmdetection."""
  3. from typing import List, Optional, Sequence, Tuple, Union
  4. from mmengine.config import ConfigDict
  5. from mmengine.structures import InstanceData, PixelData
  6. # TODO: Need to avoid circular import with assigner and sampler
  7. # Type hint of config data
  8. ConfigType = Union[ConfigDict, dict]
  9. OptConfigType = Optional[ConfigType]
  10. # Type hint of one or more config data
  11. MultiConfig = Union[ConfigType, List[ConfigType]]
  12. OptMultiConfig = Optional[MultiConfig]
  13. InstanceList = List[InstanceData]
  14. OptInstanceList = Optional[InstanceList]
  15. PixelList = List[PixelData]
  16. OptPixelList = Optional[PixelList]
  17. RangeType = Sequence[Tuple[int, int]]