nrtk-albumentations 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nrtk-albumentations might be problematic. Click here for more details.
- albumentations/__init__.py +21 -0
- albumentations/augmentations/__init__.py +23 -0
- albumentations/augmentations/blur/__init__.py +0 -0
- albumentations/augmentations/blur/functional.py +438 -0
- albumentations/augmentations/blur/transforms.py +1633 -0
- albumentations/augmentations/crops/__init__.py +0 -0
- albumentations/augmentations/crops/functional.py +494 -0
- albumentations/augmentations/crops/transforms.py +3647 -0
- albumentations/augmentations/dropout/__init__.py +0 -0
- albumentations/augmentations/dropout/channel_dropout.py +134 -0
- albumentations/augmentations/dropout/coarse_dropout.py +567 -0
- albumentations/augmentations/dropout/functional.py +1017 -0
- albumentations/augmentations/dropout/grid_dropout.py +166 -0
- albumentations/augmentations/dropout/mask_dropout.py +274 -0
- albumentations/augmentations/dropout/transforms.py +461 -0
- albumentations/augmentations/dropout/xy_masking.py +186 -0
- albumentations/augmentations/geometric/__init__.py +0 -0
- albumentations/augmentations/geometric/distortion.py +1238 -0
- albumentations/augmentations/geometric/flip.py +752 -0
- albumentations/augmentations/geometric/functional.py +4151 -0
- albumentations/augmentations/geometric/pad.py +676 -0
- albumentations/augmentations/geometric/resize.py +956 -0
- albumentations/augmentations/geometric/rotate.py +864 -0
- albumentations/augmentations/geometric/transforms.py +1962 -0
- albumentations/augmentations/mixing/__init__.py +0 -0
- albumentations/augmentations/mixing/domain_adaptation.py +787 -0
- albumentations/augmentations/mixing/domain_adaptation_functional.py +453 -0
- albumentations/augmentations/mixing/functional.py +878 -0
- albumentations/augmentations/mixing/transforms.py +832 -0
- albumentations/augmentations/other/__init__.py +0 -0
- albumentations/augmentations/other/lambda_transform.py +180 -0
- albumentations/augmentations/other/type_transform.py +261 -0
- albumentations/augmentations/pixel/__init__.py +0 -0
- albumentations/augmentations/pixel/functional.py +4226 -0
- albumentations/augmentations/pixel/transforms.py +7556 -0
- albumentations/augmentations/spectrogram/__init__.py +0 -0
- albumentations/augmentations/spectrogram/transform.py +220 -0
- albumentations/augmentations/text/__init__.py +0 -0
- albumentations/augmentations/text/functional.py +272 -0
- albumentations/augmentations/text/transforms.py +299 -0
- albumentations/augmentations/transforms3d/__init__.py +0 -0
- albumentations/augmentations/transforms3d/functional.py +393 -0
- albumentations/augmentations/transforms3d/transforms.py +1422 -0
- albumentations/augmentations/utils.py +249 -0
- albumentations/core/__init__.py +0 -0
- albumentations/core/bbox_utils.py +920 -0
- albumentations/core/composition.py +1885 -0
- albumentations/core/hub_mixin.py +299 -0
- albumentations/core/keypoints_utils.py +521 -0
- albumentations/core/label_manager.py +339 -0
- albumentations/core/pydantic.py +239 -0
- albumentations/core/serialization.py +352 -0
- albumentations/core/transforms_interface.py +976 -0
- albumentations/core/type_definitions.py +127 -0
- albumentations/core/utils.py +605 -0
- albumentations/core/validation.py +129 -0
- albumentations/pytorch/__init__.py +1 -0
- albumentations/pytorch/transforms.py +189 -0
- nrtk_albumentations-2.1.0.dist-info/METADATA +196 -0
- nrtk_albumentations-2.1.0.dist-info/RECORD +62 -0
- nrtk_albumentations-2.1.0.dist-info/WHEEL +4 -0
- nrtk_albumentations-2.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Module containing type definitions and constants used throughout Albumentations.
|
|
2
|
+
|
|
3
|
+
This module defines common types, constants, and enumerations that are used across the
|
|
4
|
+
Albumentations library. It includes type aliases for numeric types, enumerations for
|
|
5
|
+
targets supported by transforms, and constants that define standard dimensions or values
|
|
6
|
+
used in image and volumetric data processing. These definitions help ensure type safety
|
|
7
|
+
and provide a centralized location for commonly used values.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from enum import Enum
|
|
13
|
+
from typing import TypeVar, Union
|
|
14
|
+
|
|
15
|
+
import cv2
|
|
16
|
+
import numpy as np
|
|
17
|
+
from albucore.utils import MAX_VALUES_BY_DTYPE
|
|
18
|
+
from numpy.typing import NDArray
|
|
19
|
+
from typing_extensions import NotRequired, TypedDict
|
|
20
|
+
|
|
21
|
+
Number = TypeVar("Number", float, int)
|
|
22
|
+
|
|
23
|
+
IntNumType = Union[np.integer, NDArray[np.integer]]
|
|
24
|
+
FloatNumType = Union[np.floating, NDArray[np.floating]]
|
|
25
|
+
|
|
26
|
+
d4_group_elements = ["e", "r90", "r180", "r270", "v", "hvt", "h", "t"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ReferenceImage(TypedDict):
|
|
30
|
+
"""Dictionary-like container for reference image data.
|
|
31
|
+
|
|
32
|
+
A typed dictionary defining the structure of reference image data used within
|
|
33
|
+
Albumentations, including optional components like masks, bounding boxes,
|
|
34
|
+
and keypoints.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
image (np.ndarray): The reference image array.
|
|
38
|
+
mask (np.ndarray | None): Optional mask array.
|
|
39
|
+
bbox (tuple[float, ...] | np.ndarray | None): Optional bounding box coordinates.
|
|
40
|
+
keypoints (tuple[float, ...] | np.ndarray | None): Optional keypoint coordinates.
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
image: np.ndarray
|
|
45
|
+
mask: NotRequired[np.ndarray]
|
|
46
|
+
bbox: NotRequired[tuple[float, ...] | np.ndarray]
|
|
47
|
+
keypoints: NotRequired[tuple[float, ...] | np.ndarray]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Targets(Enum):
|
|
51
|
+
"""Enumeration of supported target types in Albumentations.
|
|
52
|
+
|
|
53
|
+
This enum defines the different types of data that can be augmented
|
|
54
|
+
by Albumentations transforms, including both 2D and 3D targets.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
IMAGE (str): 2D image target.
|
|
58
|
+
MASK (str): 2D mask target.
|
|
59
|
+
BBOXES (str): Bounding box target.
|
|
60
|
+
KEYPOINTS (str): Keypoint coordinates target.
|
|
61
|
+
VOLUME (str): 3D volume target.
|
|
62
|
+
MASK3D (str): 3D mask target.
|
|
63
|
+
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
IMAGE = "Image"
|
|
67
|
+
MASK = "Mask"
|
|
68
|
+
BBOXES = "BBoxes"
|
|
69
|
+
KEYPOINTS = "Keypoints"
|
|
70
|
+
VOLUME = "Volume"
|
|
71
|
+
MASK3D = "Mask3D"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
ALL_TARGETS = (Targets.IMAGE, Targets.MASK, Targets.BBOXES, Targets.KEYPOINTS, Targets.VOLUME, Targets.MASK3D)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
NUM_VOLUME_DIMENSIONS = 4
|
|
78
|
+
NUM_MULTI_CHANNEL_DIMENSIONS = 3
|
|
79
|
+
MONO_CHANNEL_DIMENSIONS = 2
|
|
80
|
+
NUM_RGB_CHANNELS = 3
|
|
81
|
+
|
|
82
|
+
PAIR = 2
|
|
83
|
+
TWO = 2
|
|
84
|
+
THREE = 3
|
|
85
|
+
FOUR = 4
|
|
86
|
+
SEVEN = 7
|
|
87
|
+
EIGHT = 8
|
|
88
|
+
THREE_SIXTY = 360
|
|
89
|
+
|
|
90
|
+
BIG_INTEGER = MAX_VALUES_BY_DTYPE[np.uint32]
|
|
91
|
+
MAX_RAIN_ANGLE = 45 # Maximum angle for rain augmentation in degrees
|
|
92
|
+
|
|
93
|
+
LENGTH_RAW_BBOX = 4
|
|
94
|
+
|
|
95
|
+
PercentType = Union[
|
|
96
|
+
float,
|
|
97
|
+
tuple[float, float],
|
|
98
|
+
tuple[float, float, float, float],
|
|
99
|
+
tuple[
|
|
100
|
+
Union[float, tuple[float, float], list[float]],
|
|
101
|
+
Union[float, tuple[float, float], list[float]],
|
|
102
|
+
Union[float, tuple[float, float], list[float]],
|
|
103
|
+
Union[float, tuple[float, float], list[float]],
|
|
104
|
+
],
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
PxType = Union[
|
|
109
|
+
int,
|
|
110
|
+
tuple[int, int],
|
|
111
|
+
tuple[int, int, int, int],
|
|
112
|
+
tuple[
|
|
113
|
+
Union[int, tuple[int, int], list[int]],
|
|
114
|
+
Union[int, tuple[int, int], list[int]],
|
|
115
|
+
Union[int, tuple[int, int], list[int]],
|
|
116
|
+
Union[int, tuple[int, int], list[int]],
|
|
117
|
+
],
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
REFLECT_BORDER_MODES = {
|
|
122
|
+
cv2.BORDER_REFLECT_101,
|
|
123
|
+
cv2.BORDER_REFLECT,
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
NUM_KEYPOINTS_COLUMNS_IN_ALBUMENTATIONS = 5
|
|
127
|
+
NUM_BBOXES_COLUMNS_IN_ALBUMENTATIONS = 4
|