Shortcuts

WIDERFace

class torchvision.datasets.WIDERFace(root: Union[str, Path], split: str = 'train', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[source]

WIDERFace 数据集。

Parameters:
  • root (str 或 pathlib.Path) –

    图像和注释下载到的根目录。 如果 download=False,则期望以下文件夹结构:

    
        └── widerface
            ├── wider_face_split ('wider_face_split.zip' 如果压缩)
            ├── WIDER_train ('WIDER_train.zip' 如果压缩)
            ├── WIDER_val ('WIDER_val.zip' 如果压缩)
            └── WIDER_test ('WIDER_test.zip' 如果压缩)
    

  • split (string) – 要使用的数据集分割。可选值为 {train, val, test}。 默认为 train

  • transform (callable, optional) – 一个函数/变换,接收一个PIL图像并返回一个变换后的版本。例如,transforms.RandomCrop

  • target_transform (callable, optional) – 一个函数/转换,它接收目标并对其进行转换。

  • 下载 (bool, 可选) –

    如果为真,则从互联网下载数据集并将其放入根目录。如果数据集已经下载,则不会再次下载。

    警告

    要下载数据集,需要gdown

Special-members:

__getitem__(index: int) Tuple[Any, Any][source]
Parameters:

index (int) – 索引

Returns:

(image, target) 其中 target 是图像中所有人脸的注释字典。 对于测试集,target=None。

Return type:

tuple