torchvideo.tools¶
Tools¶
-
torchvideo.tools.
show_video
(frames, fps=30, ndarray_format='THWC')[source]¶ Show
frames
as a video in Jupyter, or in a PyGame window usingmoviepy
.- Parameters
frames (
Union
[Tensor
,ndarray
,List
[Image
]]) –One of:
torch.Tensor
with layoutCTHW
.numpy.ndarray
of layoutTHWC
orCTHW
, if the latter, then setndarray_format
toCTHW
. The array should have anp.uint8
dtype and range[0, 255]
.a list of
PIL.Image.Image
.
fps (optional) – Frame rate of video
ndarray_format – ‘CTHW’ or ‘THWC’ depending on layout of ndarray.
- Returns
ImageSequenceClip displayed.
-
torchvideo.tools.
convert_to_clip
(frames, fps=30, ndarray_format='THWC')[source]¶ Convert
frames
to amoviepy
ImageSequenceClip
.- Parameters
frames –
One of:
torch.Tensor
with layoutCTHW
.numpy.ndarray
of layoutTHWC
orCTHW
, if the latter, then setndarray_format
toCTHW
. The array should have anp.uint8
dtype and range[0, 255]
.a list of
PIL.Image.Image
.
fps (optional) – Frame rate of video
ndarray_format – ‘CTHW’ or ‘THWC’ depending on layout of ndarray.
- Returns
ImageSequenceClip