快捷方式

HMDB51

class torchvision.datasets.HMDB51(root: Union[str, Path], annotation_path: str, frames_per_clip: int, step_between_clips: int = 1, frame_rate: Optional[int] = None, fold: int = 1, train: bool = True, transform: Optional[Callable] = None, _precomputed_metadata: Optional[dict[str, Any]] = None, num_workers: int = 1, _video_width: int = 0, _video_height: int = 0, _video_min_dimension: int = 0, _audio_samples: int = 0, output_format: str = 'THWC')[原始碼]

HMDB51 資料集。

HMDB51 是一個動作識別影片資料集。該資料集將每個影片視為一系列固定大小的影片片段,由 frames_per_clip 指定,其中每個片段之間的幀步長由 step_between_clips 給出。

舉個例子,對於 10 幀和 15 幀的 2 個影片,如果 frames_per_clip=5step_between_clips=5,則資料集大小將是 (2 + 3) = 5,其中前兩個元素來自影片 1,後三個元素來自影片 2。請注意,我們會丟棄不包含正好 frames_per_clip 個元素的剪輯,因此影片中的並非所有幀都可能存在。

在內部,它使用 VideoClips 物件來處理剪輯建立。

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

  • annotation_path (str) – 包含拆分檔案的資料夾路徑。

  • frames_per_clip (int) – 一個片段中的幀數。

  • step_between_clips (int) – 每個片段之間的幀數。

  • fold (int, 可選) – 使用哪個摺疊。應在 1 到 3 之間。

  • train (bool, 可選) – 如果為 True,則從訓練集建立資料集,否則從 測試 集建立。

  • transform (callable, 可選) – 一個函式/轉換,它接收 TxHxWxC 影片並返回轉換後的版本。

  • output_format (str, 可選) – 輸出影片張量(轉換前)的格式。可以是“THWC”(預設)或“TCHW”。

返回:

一個 3 元組,包含以下條目:

  • video (Tensor[T, H, W, C] 或 Tensor[T, C, H, W]): T 個影片幀

  • audio(Tensor[K, L]): 音訊幀,其中 K 是通道數,L 是取樣點數

  • label (int): 影片剪輯的類別

返回型別:

元組

特殊成員:

__getitem__(idx: int) tuple[torch.Tensor, torch.Tensor, int][原始碼]
引數:

index (int) – 索引

返回:

樣本和元資料,可透過相應的變換進行可選變換。

返回型別:

(Any)

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

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

檢視教程

資源

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

檢視資源