cutcutcodec.core.nn.dataaug.video

Video Data Augmentations.

Classes

Transcoder([encoders, quality])

Encode and Decode the video with lossly compression.

Functions

interlace(video)

Simulate an interlaced video.

Details

class cutcutcodec.core.nn.dataaug.video.Transcoder(encoders: Iterable[str] | str = None, quality: tuple[Real, Real] | Real = (0.5, 0.9))[source]

Encode and Decode the video with lossly compression.

Attributes

encoderslist[str]

The encoders list (readonly).

Initialise a random transcoder.

Parameters

encoderslist[str] or str, optional

The encoders used, By default [“libx264”, “libx265”, “libvx-vp9”, “libsvtav1”]. Only these encoders are supported.

qualitytuple[float, float] of float

The qualities bounds 0 lossless, 1 worse.

cutcutcodec.core.nn.dataaug.video.interlace(video: Tensor) Tensor[source]

Simulate an interlaced video.

Examples

>>> import torch
>>> from cutcutcodec.core.nn.dataaug.video import interlace
>>> video = torch.empty(5, 5, 12)
>>> video[:, :, 0:3] = 1.0
>>> video[:, :, 3:6] = 2.0
>>> video[:, :, 6:9] = 3.0
>>> video[:, :, 9:12] = 4.0
>>> video = interlace(video)
>>> video[:, :, 6]
tensor([[3., 3., 3., 3., 3.],
        [2., 2., 2., 2., 2.],
        [3., 3., 3., 3., 3.],
        [2., 2., 2., 2., 2.],
        [3., 3., 3., 3., 3.]])
>>>