快捷方式

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

HMDB51 資料集。

HMDB51 是一個動作識別影片資料集。該資料集將每個影片視為一個由固定大小影片片段組成的集合,大小由 frames_per_clip 指定,每個片段之間的幀步長由 step_between_clips 指定。

舉例來說,對於分別包含 10 幀和 15 幀的兩個影片,如果 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,則從訓練集建立資料集,否則從 test 分割建立資料集。

  • 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): 影片片段的類別

返回型別:

tuple

特殊成員:

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

index (int) – 索引

返回值:

樣本和元資料,可選地由相應的轉換進行轉換。

返回型別:

(Any)

文件

訪問 PyTorch 全面的開發者文件

檢視文件

教程

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

檢視教程

資源

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

檢視資源