捷徑

Caltech101

class torchvision.datasets.Caltech101(root: Union[str, Path], target_type: Union[List[str], str] = 'category', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[原始碼]

Caltech 101 資料集。

警告

此類別需要 scipy 才能從 .mat 格式載入目標檔案。

參數:
  • root (str 或 pathlib.Path) – 資料集的根目錄,目錄 caltech101 存在於此,若 download 設為 True,則會儲存至此目錄。

  • target_type (stringlist, optional) – 目標的類型,categoryannotation。也可以是一個列表,輸出包含所有指定目標類型的元組。category 代表目標類別,annotation 是一個手動產生的輪廓點列表。預設為 category

  • transform (callable, optional) – 一個函數/轉換,接受 PIL 圖像並返回轉換後的版本。例如,transforms.RandomCrop

  • target_transform (callable, optional) – 一個函數/轉換,接受目標並轉換它。

  • download (bool, optional) –

    如果為 true,則從網際網路下載資料集並將其放入根目錄。如果已下載資料集,則不會再次下載。

    警告

    要下載資料集,需要安裝 gdown

Special-members:

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

index (int) – 索引

Returns:

(image, target),其中 target 的類型由 target_type 指定。

Return type:

tuple

文件

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources