12
12
13
13
from typing_extensions import Literal
14
14
15
- from ..features ._feature import FillType
16
- from ..features ._image import ImageType
17
-
18
15
from ._transform import _RandomApplyTransform
19
16
from ._utils import (
20
17
_check_padding_arg ,
@@ -181,8 +178,8 @@ def __init__(self, size: Union[int, Sequence[int]]) -> None:
181
178
self .size = _setup_size (size , error_msg = "Please provide only two dimensions (h, w) for size." )
182
179
183
180
def _transform (
184
- self , inpt : ImageType , params : Dict [str , Any ]
185
- ) -> Tuple [ImageType , ImageType , ImageType , ImageType , ImageType ]:
181
+ self , inpt : features . ImageType , params : Dict [str , Any ]
182
+ ) -> Tuple [features . ImageType , features . ImageType , features . ImageType , features . ImageType , features . ImageType ]:
186
183
return F .five_crop (inpt , self .size )
187
184
188
185
def forward (self , * inputs : Any ) -> Any :
@@ -203,7 +200,7 @@ def __init__(self, size: Union[int, Sequence[int]], vertical_flip: bool = False)
203
200
self .size = _setup_size (size , error_msg = "Please provide only two dimensions (h, w) for size." )
204
201
self .vertical_flip = vertical_flip
205
202
206
- def _transform (self , inpt : ImageType , params : Dict [str , Any ]) -> List [ImageType ]:
203
+ def _transform (self , inpt : features . ImageType , params : Dict [str , Any ]) -> List [features . ImageType ]:
207
204
return F .ten_crop (inpt , self .size , vertical_flip = self .vertical_flip )
208
205
209
206
def forward (self , * inputs : Any ) -> Any :
@@ -216,7 +213,7 @@ class Pad(Transform):
216
213
def __init__ (
217
214
self ,
218
215
padding : Union [int , Sequence [int ]],
219
- fill : Union [FillType , Dict [Type , FillType ]] = 0 ,
216
+ fill : Union [features . FillType , Dict [Type , features . FillType ]] = 0 ,
220
217
padding_mode : Literal ["constant" , "edge" , "reflect" , "symmetric" ] = "constant" ,
221
218
) -> None :
222
219
super ().__init__ ()
@@ -243,7 +240,7 @@ def _transform(self, inpt: Any, params: Dict[str, Any]) -> Any:
243
240
class RandomZoomOut (_RandomApplyTransform ):
244
241
def __init__ (
245
242
self ,
246
- fill : Union [FillType , Dict [Type , FillType ]] = 0 ,
243
+ fill : Union [features . FillType , Dict [Type , features . FillType ]] = 0 ,
247
244
side_range : Sequence [float ] = (1.0 , 4.0 ),
248
245
p : float = 0.5 ,
249
246
) -> None :
@@ -285,7 +282,7 @@ def __init__(
285
282
degrees : Union [numbers .Number , Sequence ],
286
283
interpolation : InterpolationMode = InterpolationMode .NEAREST ,
287
284
expand : bool = False ,
288
- fill : Union [FillType , Dict [Type , FillType ]] = 0 ,
285
+ fill : Union [features . FillType , Dict [Type , features . FillType ]] = 0 ,
289
286
center : Optional [List [float ]] = None ,
290
287
) -> None :
291
288
super ().__init__ ()
@@ -325,7 +322,7 @@ def __init__(
325
322
scale : Optional [Sequence [float ]] = None ,
326
323
shear : Optional [Union [float , Sequence [float ]]] = None ,
327
324
interpolation : InterpolationMode = InterpolationMode .NEAREST ,
328
- fill : Union [FillType , Dict [Type , FillType ]] = 0 ,
325
+ fill : Union [features . FillType , Dict [Type , features . FillType ]] = 0 ,
329
326
center : Optional [List [float ]] = None ,
330
327
) -> None :
331
328
super ().__init__ ()
@@ -404,7 +401,7 @@ def __init__(
404
401
size : Union [int , Sequence [int ]],
405
402
padding : Optional [Union [int , Sequence [int ]]] = None ,
406
403
pad_if_needed : bool = False ,
407
- fill : Union [FillType , Dict [Type , FillType ]] = 0 ,
404
+ fill : Union [features . FillType , Dict [Type , features . FillType ]] = 0 ,
408
405
padding_mode : Literal ["constant" , "edge" , "reflect" , "symmetric" ] = "constant" ,
409
406
) -> None :
410
407
super ().__init__ ()
@@ -494,7 +491,7 @@ class RandomPerspective(_RandomApplyTransform):
494
491
def __init__ (
495
492
self ,
496
493
distortion_scale : float = 0.5 ,
497
- fill : Union [FillType , Dict [Type , FillType ]] = 0 ,
494
+ fill : Union [features . FillType , Dict [Type , features . FillType ]] = 0 ,
498
495
interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
499
496
p : float = 0.5 ,
500
497
) -> None :
@@ -570,7 +567,7 @@ def __init__(
570
567
self ,
571
568
alpha : Union [float , Sequence [float ]] = 50.0 ,
572
569
sigma : Union [float , Sequence [float ]] = 5.0 ,
573
- fill : Union [FillType , Dict [Type , FillType ]] = 0 ,
570
+ fill : Union [features . FillType , Dict [Type , features . FillType ]] = 0 ,
574
571
interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
575
572
) -> None :
576
573
super ().__init__ ()
@@ -783,7 +780,7 @@ class FixedSizeCrop(Transform):
783
780
def __init__ (
784
781
self ,
785
782
size : Union [int , Sequence [int ]],
786
- fill : Union [FillType , Dict [Type , FillType ]] = 0 ,
783
+ fill : Union [features . FillType , Dict [Type , features . FillType ]] = 0 ,
787
784
padding_mode : str = "constant" ,
788
785
) -> None :
789
786
super ().__init__ ()
0 commit comments