快捷方式

StanfordCars

class torchvision.datasets.StanfordCars(root: ~typing.Union[str, ~pathlib.Path], split: str = 'train', transform: ~typing.Optional[~typing.Callable] = None, target_transform: ~typing.Optional[~typing.Callable] = None, download: bool = False, loader: ~typing.Callable[[str], ~typing.Any] = <function default_loader>)[原始碼]

Stanford Cars 資料集

Cars 資料集包含 16,185 張影像,共 196 類汽車。資料被分為 8,144 張訓練影像和 8,041 張測試影像,其中每個類別大致以 50-50 的比例劃分。

原始 URL 是 https://ai.stanford.edu/~jkrause/cars/car_dataset.html,但該資料集已不再線上可用。

注意

此類需要 scipy 來載入 .mat 格式的目標檔案。

引數:
  • root (str 或 pathlib.Path) – 資料集根目錄

  • split (string, optional) – 資料集分割,支援 "train"(預設)或 "test"

  • transform (callable, optional) – 一個函式/轉換,接受 PIL 影像或 torch.Tensor(取決於給定的載入器),並返回轉換後的版本。例如 transforms.RandomCrop

  • target_transform (callable, optional) – 一個函式/轉換,接受目標並對其進行轉換。

  • download (bool, optional) – 此引數用於向後相容,但它不會下載資料集,因為原始 URL 已不再可用。

  • loader (callable, optional) – 給定影像路徑的載入函式。預設使用 PIL 作為影像載入器,但使用者也可以傳入 torchvision.io.decode_image 以將影像資料直接解碼為張量。

特殊成員:

__getitem__(idx: int) Tuple[Any, Any][原始碼]

返回給定索引對應的 pil_image 和 class_id

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源