USPS¶
- class torchvision.datasets.USPS(root: Union[str, Path], train: bool = True, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[source]¶
USPS 資料集。資料格式為:[label [index:value ]*256 n] * num_lines,其中
label在[1, 10]中。每個畫素的值在[-1, 1]中。在此我們將label轉換為[0, 9],並將畫素值轉換為[0, 255]。- 引數:
root (str 或
pathlib.Path) – 資料集根目錄,用於儲存``USPS`` 資料檔案。train (bool, optional) – 若為 True,則從
usps.bz2建立資料集;否則從usps.t.bz2建立。transform (callable, optional) – 一個函式/轉換,接收 PIL 影像並返回轉換後的版本。例如,
transforms.RandomCroptarget_transform (callable, optional) – 一個函式/轉換,接收目標並對其進行轉換。
download (bool, optional) – 若為 true,則從網際網路下載資料集並將其放入 root 目錄。如果資料集已下載,則不再下載。
- 特殊成員: