VideoWrapper#
- class torchaug.transforms.VideoWrapper(transforms, inplace=False, video_format='CTHW')[source]#
Wrap transforms to handle video data.
If the frames should be augmented differently, the transform must handle the leading dimension differently. The video is expected to be in format [C, T, H, W] or [T, C, H, W].
Note
Iterates through transforms and their submodules:
If
inplaceattribute is found, it is set toTrue,inplaceis handled at the wrapper level.If
video_formatattribute is found, it is set toTCHW,video_formatis handled at the wrapper level.
Note
If
video_formatisCTHW, a copy might occur even ifinplaceis set toTrue.Note
If a transform makes a copy, the resulting tensor will not share the same underlying storage even if
inplaceis set toTrue.- Parameters:
transforms (
Union[Sequence[Module],Module]) – A list of transform modules.inplace (
bool, optional) – Whether to perform the transforms inplace.Default:Falsevideo_format (
str, optional) – Format of the video. EitherCTHWorTCHW.Default:'CTHW'- forward(video)[source]#
Apply
transformson the video.Call
Wrapper.forward().- Parameters:
video (
Tensor) – The video to transform.- Return type:
Tensor- Returns:
The transformed video.