UCF101¶
- class torchvision.datasets.UCF101(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]¶
UCF101 資料集。
UCF101 是一個動作辨識影片資料集。此資料集將每個影片視為固定大小的影片片段集合,由
frames_per_clip
指定,其中每個片段之間的影格步長由step_between_clips
給定。資料集本身可以從資料集網站下載;annotation_path
應該指向的註釋可以從 這裡 下載。舉例來說,對於分別有 10 個和 15 個影格的 2 個影片,如果
frames_per_clip=5
且step_between_clips=5
,則資料集大小將為 (2 + 3) = 5,其中前兩個元素來自影片 1,後三個元素來自影片 2。請注意,我們會捨棄不完全具有frames_per_clip
個元素的片段,因此影片中並非所有影格都可能存在。在內部,它使用 VideoClips 物件來處理片段建立。
- 參數:
root (str 或
pathlib.Path
) – UCF101 資料集的根目錄。annotation_path (str) – 包含分割檔案的資料夾路徑;有關這些檔案的下載說明,請參閱上面的文件字串
frames_per_clip (int) – 一個片段中的影格數量。
step_between_clips (int, optional) – 每個片段之間的影格數量。
fold (int, optional) – 要使用的 fold (摺疊)。應該介於 1 和 3 之間。
train (bool, optional) – 如果
True
,則從訓練分割建立資料集,否則從test
分割建立資料集。transform (callable, optional) – 接受 TxHxWxC 影片並返回轉換版本的函數/轉換。
output_format (str, optional) – 輸出影片張量的格式 (在轉換之前)。可以是 “THWC”(預設)或 “TCHW”。
- 回傳:
一個包含以下條目的 3 元組
video (Tensor[T, H, W, C] 或 Tensor[T, C, H, W]): T 個影片影格
audio(Tensor[K, L]): 音訊影格,其中 K 是頻道數量,L 是點的數量
label (int): 影片片段的類別
- 回傳類型:
- 特殊成員: