Shortcuts

flow_to_image

torchvision.utils.flow_to_image(flow: Tensor) Tensor[source]

Converts a flow to an RGB image.

Parameters:

flow (Tensor) – Flow of shape (N, 2, H, W) or (2, H, W) and dtype torch.float.

Returns:

Image Tensor of dtype uint8 where each color corresponds

to a given flow direction. Shape is (N, 3, H, W) or (3, H, W) depending on the input.

Return type:

img (Tensor)

Examples using flow_to_image:

Optical Flow: Predicting movement with the RAFT model

Optical Flow: Predicting movement with the RAFT model

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources