VOCSegmentation¶
- class torchvision.datasets.VOCSegmentation(root: Union[str, Path], year: str = '2012', image_set: str = 'train', download: bool = False, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)[源代码]¶
Pascal VOC 分割数据集。
- 参数:
root (str 或
pathlib.Path
) – VOC 数据集的根目录。year (字符串, 可选) – 数据集年份,支持
"2007"
至"2012"
。image_set (字符串, 可选) – 选择要使用的 image_set,
"train"
、"trainval"
或"val"
。如果year=="2007"
,还可以是"test"
。download (bool, 可选) – 如果为 true,将从互联网下载数据集并将其放入根目录。如果数据集已下载,则不会再次下载。
transform (callable, 可选) – 一个函数/转换,它接收 PIL 图像并返回转换后的版本。例如,
transforms.RandomCrop
target_transform (可调用对象, 可选) – 一个函数/变换,接受目标并对其进行变换。
transforms (callable, optional) – 接受输入样本及其目标并返回转换后版本的函数/转换。
- 特殊成员: