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

Class NormalizeVideo

datasets/video_utils.py:378–400  ·  view source on GitHub ↗

Normalize the video clip by mean subtraction and division by standard deviation Args: mean (3-tuple): pixel RGB mean std (3-tuple): pixel RGB standard deviation inplace (boolean): whether do in-place normalization

Source from the content-addressed store, hash-verified

376
377
378class NormalizeVideo:
379 """
380 Normalize the video clip by mean subtraction and division by standard deviation
381 Args:
382 mean (3-tuple): pixel RGB mean
383 std (3-tuple): pixel RGB standard deviation
384 inplace (boolean): whether do in-place normalization
385 """
386
387 def __init__(self, mean, std, inplace=False):
388 self.mean = mean
389 self.std = std
390 self.inplace = inplace
391
392 def __call__(self, clip):
393 """
394 Args:
395 clip (torch.tensor): video clip must be normalized. Size is (C, T, H, W)
396 """
397 return normalize(clip, self.mean, self.std, self.inplace)
398
399 def __repr__(self) -> str:
400 return f"{self.__class__.__name__}(mean={self.mean}, std={self.std}, inplace={self.inplace})"
401
402
403class ToTensorVideo:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected