Shortcuts

飞行椅子

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

FlyingChairs 光流数据集。

您还需要从数据集页面下载FlyingChairs_train_val.txt文件。

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

root
    FlyingChairs
        data
            00001_flow.flo
            00001_img1.ppm
            00001_img2.ppm
            ...
        FlyingChairs_train_val.txt
Parameters:
  • root (str 或 pathlib.Path) – FlyingChairs 数据集的根目录。

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

  • transforms (callable, optional) – 一个函数/变换,接收 img1, img2, flow, valid_flow_mask 并返回一个变换后的版本。 valid_flow_mask 是为了与其他数据集保持一致,这些数据集返回一个内置的有效掩码,例如 KittiFlow

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) 的三元组。 流是一个形状为 (2, H, W) 的 numpy 数组,图像是 PIL 图像。 如果 split="val",则 flow 为 None。 如果在 transforms 参数中生成了有效的流掩码, 则返回一个包含 (img1, img2, flow, valid_flow_mask) 的四元组。

Return type:

tuple