快捷方式

SBU

class torchvision.datasets.SBU(root: ~typing.Union[str, ~pathlib.Path], transform: ~typing.Optional[~typing.Callable] = None, target_transform: ~typing.Optional[~typing.Callable] = None, download: bool = True, loader: ~typing.Callable[[str], ~typing.Any] = <function default_loader>)[source]

SBU Caption Photo 資料集。

引數:
  • root (str 或 pathlib.Path) – 資料集根目錄,其中包含 tarball SBUCaptionedPhotoDataset.tar.gz

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

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

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

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

特殊成員:

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

index (int) – 索引

返回:

(image, target),其中 target 是照片的圖片說明。

返回型別:

元組

文件

檢視 PyTorch 的全面開發者文件

檢視文件

教程

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

檢視教程

資源

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

檢視資源