flow_to_image¶ torchvision.utils.flow_to_image(flow: Tensor) → Tensor[source]¶ 将光流转换为 RGB 图像。 参数: flow (Tensor) – 形状为 (N, 2, H, W) 或 (2, H, W) 且 dtype 为 torch.float 的光流。 返回: dtype 为 uint8 的图像 Tensor,其中每种颜色对应于给定的光流方向。形状取决于输入,为 (N, 3, H, W) 或 (3, H, W)。 返回类型: img (Tensor) 使用 flow_to_image 的示例 光流:使用 RAFT 模型预测运动 光流:使用 RAFT 模型预测运动