DTD¶
- class torchvision.datasets.DTD(root: ~typing.Union[str, ~pathlib.Path], split: str = 'train', partition: int = 1, transform: ~typing.Optional[~typing.Callable] = None, target_transform: ~typing.Optional[~typing.Callable] = None, download: bool = False, loader: ~typing.Callable[[~typing.Union[str, ~pathlib.Path]], ~typing.Any] = <function default_loader>)[source]¶
-
- 引數:
root (str or
pathlib.Path) – 資料集的根目錄。split (string, optional) – 資料集劃分,支援
"train"(預設),"val",或"test"。partition (int, optional) –
資料集劃分。應為
1 <= partition <= 10。預設為1。注意
劃分只改變每張影像屬於哪個子集。因此,無論選擇哪個劃分,組合所有子集都會得到所有影像。
transform (callable, optional) – 一個函式/變換,接受 PIL 影像或 torch.Tensor(取決於給定的載入器),並返回變換後的版本。例如,
transforms.RandomCroptarget_transform (callable, optional) – 一個函式/變換,接受目標並對其進行變換。
download (bool, optional) – 如果為 True,則從網際網路下載資料集並將其放在根目錄中。如果資料集已經下載,則不會再次下載。預設為 False。
loader (callable, optional) – 一個給定影像路徑載入影像的函式。預設情況下,它使用 PIL 作為影像載入器,但使用者也可以傳入
torchvision.io.decode_image直接將影像資料解碼為張量。
- 特殊成員: