diff --git a/mmocr/evaluation/evaluator/multi_datasets_evaluator.py b/mmocr/evaluation/evaluator/multi_datasets_evaluator.py index 954a77c04..f01aa70f6 100644 --- a/mmocr/evaluation/evaluator/multi_datasets_evaluator.py +++ b/mmocr/evaluation/evaluator/multi_datasets_evaluator.py @@ -9,7 +9,7 @@ from mmengine.evaluator.metric import _to_cpu from mmocr.registry import EVALUATOR -from mmocr.utils.typing import ConfigType +from mmocr.utils.typing_utils import ConfigType @EVALUATOR.register_module() diff --git a/mmocr/models/textdet/detectors/base.py b/mmocr/models/textdet/detectors/base.py index e5e6ab79b..a81ba0214 100644 --- a/mmocr/models/textdet/detectors/base.py +++ b/mmocr/models/textdet/detectors/base.py @@ -6,8 +6,8 @@ from mmengine.model import BaseModel from torch import Tensor -from mmocr.utils.typing import (DetSampleList, OptConfigType, OptDetSampleList, - OptMultiConfig) +from mmocr.utils.typing_utils import (DetSampleList, OptConfigType, + OptDetSampleList, OptMultiConfig) ForwardResults = Union[Dict[str, torch.Tensor], DetSampleList, Tuple[torch.Tensor], torch.Tensor] diff --git a/mmocr/models/textdet/detectors/mmdet_wrapper.py b/mmocr/models/textdet/detectors/mmdet_wrapper.py index d40910608..1d6be8caa 100644 --- a/mmocr/models/textdet/detectors/mmdet_wrapper.py +++ b/mmocr/models/textdet/detectors/mmdet_wrapper.py @@ -11,7 +11,7 @@ from mmocr.registry import MODELS from mmocr.utils.bbox_utils import bbox2poly -from mmocr.utils.typing import DetSampleList +from mmocr.utils.typing_utils import DetSampleList ForwardResults = Union[Dict[str, torch.Tensor], List[DetDataSample], Tuple[torch.Tensor], torch.Tensor] diff --git a/mmocr/models/textdet/heads/base.py b/mmocr/models/textdet/heads/base.py index 0e06b5974..7fb9f861d 100644 --- a/mmocr/models/textdet/heads/base.py +++ b/mmocr/models/textdet/heads/base.py @@ -6,7 +6,7 @@ from torch import Tensor from mmocr.registry import MODELS -from mmocr.utils.typing import DetSampleList +from mmocr.utils.typing_utils import DetSampleList @MODELS.register_module() diff --git a/mmocr/models/textdet/heads/db_head.py b/mmocr/models/textdet/heads/db_head.py index c67c55a86..848843e87 100644 --- a/mmocr/models/textdet/heads/db_head.py +++ b/mmocr/models/textdet/heads/db_head.py @@ -9,7 +9,7 @@ from mmocr.models.textdet.heads import BaseTextDetHead from mmocr.registry import MODELS from mmocr.structures import TextDetDataSample -from mmocr.utils.typing import DetSampleList +from mmocr.utils.typing_utils import DetSampleList @MODELS.register_module() diff --git a/mmocr/models/textdet/module_losses/base.py b/mmocr/models/textdet/module_losses/base.py index a884b69ce..b65c5c5ec 100644 --- a/mmocr/models/textdet/module_losses/base.py +++ b/mmocr/models/textdet/module_losses/base.py @@ -6,7 +6,7 @@ from torch import nn from mmocr.registry import MODELS -from mmocr.utils.typing import DetSampleList +from mmocr.utils.typing_utils import DetSampleList INPUT_TYPES = Union[torch.Tensor, Sequence[torch.Tensor], Dict] diff --git a/mmocr/models/textdet/module_losses/db_module_loss.py b/mmocr/models/textdet/module_losses/db_module_loss.py index f611e7686..0c14ef2bd 100644 --- a/mmocr/models/textdet/module_losses/db_module_loss.py +++ b/mmocr/models/textdet/module_losses/db_module_loss.py @@ -11,7 +11,7 @@ from mmocr.registry import MODELS from mmocr.structures import TextDetDataSample from mmocr.utils import offset_polygon -from mmocr.utils.typing import ArrayLike +from mmocr.utils.typing_utils import ArrayLike from .seg_based_module_loss import SegBasedModuleLoss diff --git a/mmocr/models/textdet/module_losses/fce_module_loss.py b/mmocr/models/textdet/module_losses/fce_module_loss.py index 466f2a860..c833c1778 100644 --- a/mmocr/models/textdet/module_losses/fce_module_loss.py +++ b/mmocr/models/textdet/module_losses/fce_module_loss.py @@ -10,7 +10,7 @@ from mmocr.registry import MODELS from mmocr.structures import TextDetDataSample -from mmocr.utils.typing import ArrayLike +from mmocr.utils.typing_utils import ArrayLike from .textsnake_module_loss import TextSnakeModuleLoss diff --git a/mmocr/models/textrecog/backbones/mobilenet_v2.py b/mmocr/models/textrecog/backbones/mobilenet_v2.py index f15d001ee..b0c671645 100644 --- a/mmocr/models/textrecog/backbones/mobilenet_v2.py +++ b/mmocr/models/textrecog/backbones/mobilenet_v2.py @@ -6,7 +6,7 @@ from torch import Tensor from mmocr.registry import MODELS -from mmocr.utils.typing import InitConfigType +from mmocr.utils.typing_utils import InitConfigType @MODELS.register_module() diff --git a/mmocr/models/textrecog/recognizers/encoder_decoder_recognizer.py b/mmocr/models/textrecog/recognizers/encoder_decoder_recognizer.py index 9be410b02..2696ac70e 100644 --- a/mmocr/models/textrecog/recognizers/encoder_decoder_recognizer.py +++ b/mmocr/models/textrecog/recognizers/encoder_decoder_recognizer.py @@ -5,9 +5,9 @@ import torch from mmocr.registry import MODELS -from mmocr.utils.typing import (ConfigType, InitConfigType, OptConfigType, - OptRecSampleList, RecForwardResults, - RecSampleList) +from mmocr.utils.typing_utils import (ConfigType, InitConfigType, + OptConfigType, OptRecSampleList, + RecForwardResults, RecSampleList) from .base import BaseRecognizer diff --git a/mmocr/utils/__init__.py b/mmocr/utils/__init__.py index 39dfabef4..c32402882 100644 --- a/mmocr/utils/__init__.py +++ b/mmocr/utils/__init__.py @@ -20,11 +20,11 @@ sort_vertex, sort_vertex8) from .setup_env import register_all_modules from .string_utils import StringStripper -from .typing import (ColorType, ConfigType, DetSampleList, InitConfigType, - KIESampleList, MultiConfig, OptConfigType, - OptDetSampleList, OptInitConfigType, OptKIESampleList, - OptMultiConfig, OptRecSampleList, OptTensor, - RecForwardResults, RecSampleList) +from .typing_utils import (ColorType, ConfigType, DetSampleList, + InitConfigType, KIESampleList, MultiConfig, + OptConfigType, OptDetSampleList, OptInitConfigType, + OptKIESampleList, OptMultiConfig, OptRecSampleList, + OptTensor, RecForwardResults, RecSampleList) __all__ = [ 'collect_env', 'is_3dlist', 'is_type_list', 'is_none_or_type', 'equal_len', diff --git a/mmocr/utils/bbox_utils.py b/mmocr/utils/bbox_utils.py index ac010e811..19b28f62e 100644 --- a/mmocr/utils/bbox_utils.py +++ b/mmocr/utils/bbox_utils.py @@ -7,7 +7,7 @@ from mmocr.utils.check_argument import is_2dlist, is_type_list from mmocr.utils.point_utils import point_distance, points_center -from mmocr.utils.typing import ArrayLike +from mmocr.utils.typing_utils import ArrayLike def rescale_bbox(bbox: np.ndarray, diff --git a/mmocr/utils/mask_utils.py b/mmocr/utils/mask_utils.py index afd9c740c..a6903072f 100644 --- a/mmocr/utils/mask_utils.py +++ b/mmocr/utils/mask_utils.py @@ -2,7 +2,7 @@ import cv2 import numpy as np -from mmocr.utils.typing import ArrayLike +from mmocr.utils.typing_utils import ArrayLike def fill_hole(input_mask: ArrayLike) -> np.array: diff --git a/mmocr/utils/point_utils.py b/mmocr/utils/point_utils.py index f3a25c419..809805f2e 100644 --- a/mmocr/utils/point_utils.py +++ b/mmocr/utils/point_utils.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. import numpy as np -from mmocr.utils.typing import ArrayLike +from mmocr.utils.typing_utils import ArrayLike def points_center(points: ArrayLike) -> np.ndarray: diff --git a/mmocr/utils/polygon_utils.py b/mmocr/utils/polygon_utils.py index 6ec68331f..21647c78e 100644 --- a/mmocr/utils/polygon_utils.py +++ b/mmocr/utils/polygon_utils.py @@ -10,7 +10,7 @@ from mmocr.utils import bbox2poly, valid_boundary from mmocr.utils.check_argument import is_2dlist -from mmocr.utils.typing import ArrayLike +from mmocr.utils.typing_utils import ArrayLike def rescale_polygon(polygon: ArrayLike, diff --git a/mmocr/utils/typing.py b/mmocr/utils/typing_utils.py similarity index 100% rename from mmocr/utils/typing.py rename to mmocr/utils/typing_utils.py