Shortcuts

KittiFlow

class torchvision.datasets.KittiFlow(root: Union[str, Path], split: str = 'train', transforms: Optional[Callable] = None)[source]

KITTI 数据集用于光流(2015年)。

数据集预期具有以下结构:

root
    KittiFlow
        testing
            image_2
        training
            image_2
            flow_occ
Parameters:
  • root (str 或 pathlib.Path) – KittiFlow 数据集的根目录。

  • split (string, optional) – 数据集的分割,可以是“train”(默认)或“test”

  • transforms (callable, optional) – 一个函数/变换,接收 img1, img2, flow, valid_flow_mask 并返回一个变换后的版本。

Special-members:

__getitem__(index: int) Union[Tuple[Image, Image, Optional[ndarray], Optional[ndarray]], Tuple[Image, Image, Optional[ndarray]]][source]

返回给定索引处的示例。

Parameters:

index (int) – 要检索的示例的索引

Returns:

一个包含 (img1, img2, flow, valid_flow_mask) 的4元组, 其中 valid_flow_mask 是一个形状为 (H, W) 的numpy布尔掩码, 指示哪些流值是有效的。流是一个形状为 (2, H, W) 的numpy数组, 图像是PIL图像。如果 split="test",则 flowvalid_flow_mask 为 None。

Return type:

tuple