Shortcuts

GTSRB

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

German Traffic Sign Recognition Benchmark (GTSRB) 数据集。

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

  • split (string, optional) – 数据集的分割,支持 "train"(默认),或 "test"

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

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

  • 下载 (bool, 可选) – 如果为True,则从互联网下载数据集并将其放在根目录中。如果数据集已经下载,则不会再次下载。

Special-members:

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

index (int) – 索引

Returns:

样本和元数据,可选择通过各自的转换进行转换。

Return type:

(任何)