MNIST¶
- class torchvision.datasets.MNIST(root: Union[str, Path], train: bool = True, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[source]¶
MNIST 資料集。
- 參數:
root (str 或
pathlib.Path
) – 資料集的根目錄,其中存在MNIST/raw/train-images-idx3-ubyte
和MNIST/raw/t10k-images-idx3-ubyte
。train (bool, optional) – 如果為 True,則從
train-images-idx3-ubyte
建立資料集,否則從t10k-images-idx3-ubyte
建立。download (bool, optional) – 若為 True,則從網際網路下載資料集並將其放置在根目錄中。如果資料集已下載,則不會再次下載。
transform (callable, optional) – 一個函數/轉換,它接收 PIL 影像並返回一個轉換後的版本。例如,
transforms.RandomCrop
target_transform (callable, optional) – 一個函數/轉換,它接收目標並轉換它。
- 特殊成員: