快捷方式

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>)[source]

Stanford Cars 資料集

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

原始網址是 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 (可呼叫物件, 可選) – 一個函式/變換,接受目標並對其進行變換。

  • download (bool, optional) – 此引數是為了向後相容而存在的,但它不會下載資料集,因為原始網址已不再可用。

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

特殊成員:

__getitem__(idx: int) tuple[Any, Any][source]

返回給定索引的 pil_image 和 class_id

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

為初學者和高階開發者提供深入的教程

檢視教程

資源

查詢開發資源並讓您的問題得到解答

檢視資源