捷徑

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 給定。

舉例來說,對於 2 個分別具有 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, optional) – 要使用的 fold。應介於 1 到 3 之間。

  • train (bool, optional) – 若為 True,則從訓練集 (train split) 建立資料集,否則從測試集 (test split) 建立。

  • transform (callable, optional) – 接收 TxHxWxC 影片並返回轉換後版本的函數/轉換。

  • output_format (str, optional) – 輸出影片 tensors (在 transforms 之前) 的格式。可以是 “THWC” (預設) 或 “TCHW”。

返回值:

一個包含以下條目的 3-tuple

  • 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) – 索引

返回值:

範例與元資料,可選擇性地透過各自的 transforms 轉換。

返回類型:

(任何)

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學課程

取得針對初學者和進階開發者的深入教學課程

檢視教學課程

資源

尋找開發資源並獲得問題解答

檢視資源