@@ -201,32 +201,58 @@ def horizontal_flip_bounding_box():
201
201
202
202
@register_kernel_info_from_sample_inputs_fn
203
203
def resize_image_tensor ():
204
- for image , interpolation in itertools .product (
204
+ for image , interpolation , max_size , antialias in itertools .product (
205
205
make_images (),
206
- [
207
- F .InterpolationMode .BILINEAR ,
208
- F .InterpolationMode .NEAREST ,
209
- ],
206
+ [F .InterpolationMode .BILINEAR , F .InterpolationMode .NEAREST ], # interpolation
207
+ [None , 34 ], # max_size
208
+ [False , True ], # antialias
210
209
):
210
+
211
+ if antialias and interpolation == F .InterpolationMode .NEAREST :
212
+ continue
213
+
211
214
height , width = image .shape [- 2 :]
212
215
for size in [
213
216
(height , width ),
214
217
(int (height * 0.75 ), int (width * 1.25 )),
215
218
]:
216
- yield SampleInput (image , size = size , interpolation = interpolation )
219
+ if max_size is not None :
220
+ size = [size [0 ]]
221
+ yield SampleInput (image , size = size , interpolation = interpolation , max_size = max_size , antialias = antialias )
217
222
218
223
219
224
@register_kernel_info_from_sample_inputs_fn
220
225
def resize_bounding_box ():
221
- for bounding_box in make_bounding_boxes ():
226
+ for bounding_box , max_size in itertools .product (
227
+ make_bounding_boxes (),
228
+ [None , 34 ], # max_size
229
+ ):
222
230
height , width = bounding_box .image_size
223
231
for size in [
224
232
(height , width ),
225
233
(int (height * 0.75 ), int (width * 1.25 )),
226
234
]:
235
+ if max_size is not None :
236
+ size = [size [0 ]]
227
237
yield SampleInput (bounding_box , size = size , image_size = bounding_box .image_size )
228
238
229
239
240
+ @register_kernel_info_from_sample_inputs_fn
241
+ def resize_segmentation_mask ():
242
+ for mask , max_size in itertools .product (
243
+ make_segmentation_masks (),
244
+ [None , 34 ], # max_size
245
+ ):
246
+ height , width = mask .shape [- 2 :]
247
+ for size in [
248
+ (height , width ),
249
+ (int (height * 0.75 ), int (width * 1.25 )),
250
+ ]:
251
+ if max_size is not None :
252
+ size = [size [0 ]]
253
+ yield SampleInput (mask , size = size , max_size = max_size )
254
+
255
+
230
256
@register_kernel_info_from_sample_inputs_fn
231
257
def affine_image_tensor ():
232
258
for image , angle , translate , scale , shear in itertools .product (
@@ -284,6 +310,22 @@ def affine_segmentation_mask():
284
310
)
285
311
286
312
313
+ @register_kernel_info_from_sample_inputs_fn
314
+ def rotate_image_tensor ():
315
+ for image , angle , expand , center , fill in itertools .product (
316
+ make_images (extra_dims = ((), (4 ,))),
317
+ [- 87 , 15 , 90 ], # angle
318
+ [True , False ], # expand
319
+ [None , [12 , 23 ]], # center
320
+ [None , [128 ]], # fill
321
+ ):
322
+ if center is not None and expand :
323
+ # Skip warning: The provided center argument is ignored if expand is True
324
+ continue
325
+
326
+ yield SampleInput (image , angle = angle , expand = expand , center = center , fill = fill )
327
+
328
+
287
329
@register_kernel_info_from_sample_inputs_fn
288
330
def rotate_bounding_box ():
289
331
for bounding_box , angle , expand , center in itertools .product (
0 commit comments