快捷方式

SUN397

class torchvision.datasets.SUN397(root: ~typing.Union[str, ~pathlib.Path], 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]

SUN397 資料集.

SUN397 或 Scene UNderstanding (SUN) 是一個場景識別資料集,包含 397 個類別和 108,754 張影像。

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

  • transform (可呼叫物件, 可選) – 一個函式/轉換,它接收一個 PIL 影像或 torch.Tensor(取決於給定的載入器),並返回一個轉換後的版本。例如,transforms.RandomCrop

  • target_transform (可呼叫物件, 可選) – 一個函式/轉換,它接收目標並對其進行轉換。

  • download (bool, 可選) – 如果為 true,則從網際網路下載資料集並將其放置在根目錄中。如果資料集已下載,則不會再次下載。

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

特殊成員:

__getitem__(idx: int) Tuple[Any, Any][source]
引數:

index (int) – 索引

返回:

樣本和元資料,可選擇地透過各自的轉換進行轉換。

返回型別:

(Any)

文件

獲取全面的 PyTorch 開發者文件

檢視文件

教程

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

檢視教程

資源

查詢開發資源並獲得解答

檢視資源