torchvideo.tools¶
Tools¶
-
torchvideo.tools.show_video(frames, fps=30, ndarray_format='THWC')[source]¶ Show
framesas a video in Jupyter, or in a PyGame window usingmoviepy.- Parameters
frames (
Union[Tensor,ndarray,List[Image]]) –One of:
torch.Tensorwith layoutCTHW.numpy.ndarrayof layoutTHWCorCTHW, if the latter, then setndarray_formattoCTHW. The array should have anp.uint8dtype 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
framesto amoviepyImageSequenceClip.- Parameters
frames –
One of:
torch.Tensorwith layoutCTHW.numpy.ndarrayof layoutTHWCorCTHW, if the latter, then setndarray_formattoCTHW. The array should have anp.uint8dtype 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