flow_to_image¶ torchvision.utils.flow_to_image(flow: Tensor) → Tensor[source]¶ 将流转换为RGB图像。 Parameters: flow (Tensor) – 形状为 (N, 2, H, W) 或 (2, H, W) 且数据类型为 torch.float 的流。 Returns: 图像张量的数据类型为uint8,其中每种颜色对应给定的流动方向。形状为(N, 3, H, W)或(3, H, W),取决于输入。 Return type: img (张量) 使用 flow_to_image 的示例: 光流:使用RAFT模型预测运动 Optical Flow: Predicting movement with the RAFT model