MCPcopy Create free account
hub / github.com/CompVis/zigma / KineticsRandomCropResizeVideo

Class KineticsRandomCropResizeVideo

datasets/video_utils.py:319–343  ·  view source on GitHub ↗

Slide along the long edge, with the short edge as crop size. And resie to the desired size.

Source from the content-addressed store, hash-verified

317
318
319class 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
346class CenterCropVideo:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected