Slide along the long edge, with the short edge as crop size. And resie to the desired size.
| 317 | |
| 318 | |
| 319 | class KineticsRandomCropResizeVideo: |
| 320 | """ |
| 321 | Slide along the long edge, with the short edge as crop size. And resie to the desired size. |
| 322 | """ |
| 323 | |
| 324 | def __init__( |
| 325 | self, |
| 326 | size, |
| 327 | interpolation_mode="bilinear", |
| 328 | ): |
| 329 | if isinstance(size, tuple): |
| 330 | if len(size) != 2: |
| 331 | raise ValueError( |
| 332 | f"size should be tuple (height, width), instead got {size}" |
| 333 | ) |
| 334 | self.size = size |
| 335 | else: |
| 336 | self.size = (size, size) |
| 337 | |
| 338 | self.interpolation_mode = interpolation_mode |
| 339 | |
| 340 | def __call__(self, clip): |
| 341 | clip_random_crop = random_shift_crop(clip) |
| 342 | clip_resize = resize(clip_random_crop, self.size, self.interpolation_mode) |
| 343 | return clip_resize |
| 344 | |
| 345 | |
| 346 | class CenterCropVideo: |
nothing calls this directly
no outgoing calls
no test coverage detected