class_docstr: Egocentric classification video clip-based dataset for
  `DoMSEV <https://www.verlab.dcc.ufmg.br/semantic-hyperlapse/cvpr2018-dataset/>`_
  stored as an encoded video (with frame-level labels).
  
  This dataset handles the loading, decoding, and configurable clip
  sampling for the videos.
class_docstr_tok: ["Egocentric","classification","video","clip-based","dataset","for","`","DoMSEV","<","https",":","\/\/www.verlab.dcc.ufmg.br\/semantic-hyperlapse\/cvpr2018-dataset\/",">","`","_","stored","as","an","encoded","video","(","with","frame-level","labels",")",".","This","dataset","handles","the","loading",",","decoding",",","and","configurable","clip","sampling","for","the","videos","."]
docstr: Args:
      video_data_manifest_file_path (str):
          The path to a json file outlining the available video data for the
          associated videos.  File must be a csv (w/header) with columns:
          ``{[f.name for f in dataclass_fields(EncodedVideoInfo)]}``
  
          To generate this file from a directory of video frames, see helper
          functions in module: ``pytorchvideo.data.domsev.utils``
  
      video_info_file_path (str):
          Path or URI to manifest with basic metadata of each video.
          File must be a csv (w/header) with columns:
          ``{[f.name for f in dataclass_fields(VideoInfo)]}``
  
      labels_file_path (str):
          Path or URI to manifest with annotations for each video.
          File must be a csv (w/header) with columns:
          ``{[f.name for f in dataclass_fields(LabelData)]}``
  
      clip_sampler (Callable[[Dict[str, Video], Dict[str, List[LabelData]]],
          List[VideoClipInfo]]):
          Defines how clips should be sampled from each video. See the clip
          sampling documentation for more information.
  
      dataset_type (VideoDatasetType): The data format in which dataset
          video data is stored (e.g. video frames, encoded video etc).
  
      frames_per_second (int): The FPS of the stored videos. (NOTE:
          this is variable and may be different than the original FPS
          reported on the DoMSEV dataset website -- it depends on the
          preprocessed subsampling and frame extraction).
  
      transform (Optional[Callable[[Dict[str, Any]], Any]]):
          This callable is evaluated on the clip output before the clip is returned.
          It can be used for user-defined preprocessing and augmentations to the clips.
          The clip output format is described in __next__().
  
      frame_filter (Optional[Callable[[List[int]], List[int]]]):
          This callable is evaluated on the set of available frame indices to be
          included in a sampled clip. This can be used to subselect frames within
          a clip to be loaded.
  
      multithreaded_io (bool):
          Boolean to control whether io operations are performed across multiple
          threads.
docstr_tok: ["Args",":","video_data_manifest_file_path","(","str",")",":","The","path","to","a","json","file","outlining","the","available","video","data","for","the","associated","videos",".","File","must","be","a","csv","(","w\/header",")","with","columns",":","``","{","[","f.name","for","f","in","dataclass_fields","(","EncodedVideoInfo",")","]","}","``","To","generate","this","file","from","a","directory","of","video","frames",",","see","helper","functions","in","module",":","``","pytorchvideo.data.domsev.utils","``","video_info_file_path","(","str",")",":","Path","or","URI","to","manifest","with","basic","metadata","of","each","video",".","File","must","be","a","csv","(","w\/header",")","with","columns",":","``","{","[","f.name","for","f","in","dataclass_fields","(","VideoInfo",")","]","}","``","labels_file_path","(","str",")",":","Path","or","URI","to","manifest","with","annotations","for","each","video",".","File","must","be","a","csv","(","w\/header",")","with","columns",":","``","{","[","f.name","for","f","in","dataclass_fields","(","LabelData",")","]","}","``","clip_sampler","(","Callable","[","[","Dict","[","str",",","Video","]",",","Dict","[","str",",","List","[","LabelData","]","]","]",",","List","[","VideoClipInfo","]","]",")",":","Defines","how","clips","should","be","sampled","from","each","video",".","See","the","clip","sampling","documentation","for","more","information",".","dataset_type","(","VideoDatasetType",")",":","The","data","format","in","which","dataset","video","data","is","stored","(","e.g",".","video","frames",",","encoded","video","etc",")",".","frames_per_second","(","int",")",":","The","FPS","of","the","stored","videos",".","(","NOTE",":","this","is","variable","and","may","be","different","than","the","original","FPS","reported","on","the","DoMSEV","dataset","website","--","it","depends","on","the","preprocessed","subsampling","and","frame","extraction",")",".","transform","(","Optional","[","Callable","[","[","Dict","[","str",",","Any","]","]",",","Any","]","]",")",":","This","callable","is","evaluated","on","the","clip","output","before","the","clip","is","returned",".","It","can","be","used","for","user-defined","preprocessing","and","augmentations","to","the","clips",".","The","clip","output","format","is","described","in","__next__","(",")",".","frame_filter","(","Optional","[","Callable","[","[","List","[","int","]","]",",","List","[","int","]","]","]",")",":","This","callable","is","evaluated","on","the","set","of","available","frame","indices","to","be","included","in","a","sampled","clip",".","This","can","be","used","to","subselect","frames","within","a","clip","to","be","loaded",".","multithreaded_io","(","bool",")",":","Boolean","to","control","whether","io","operations","are","performed","across","multiple","threads","."]
code: def __init__(
      self,
      video_data_manifest_file_path: str,
      video_info_file_path: str,
      labels_file_path: str,
      clip_sampler: Callable[
          [Dict[str, Video], Dict[str, List[LabelData]]],
          List[VideoClipInfo],
      ],
      dataset_type: VideoDatasetType = VideoDatasetType.Frame,
      frames_per_second: int = 1,
      transform: Optional[Callable[[Dict[str, Any]], Any]] = None,
      frame_filter: Optional[Callable[[List[int]], List[int]]] = None,
      multithreaded_io: bool = False,
  ) -> None:
      """
      Args:
          video_data_manifest_file_path (str):
              The path to a json file outlining the available video data for the
              associated videos.  File must be a csv (w/header) with columns:
              ``{[f.name for f in dataclass_fields(EncodedVideoInfo)]}``
  
              To generate this file from a directory of video frames, see helper
              functions in module: ``pytorchvideo.data.domsev.utils``
  
          video_info_file_path (str):
              Path or URI to manifest with basic metadata of each video.
              File must be a csv (w/header) with columns:
              ``{[f.name for f in dataclass_fields(VideoInfo)]}``
  
          labels_file_path (str):
              Path or URI to manifest with annotations for each video.
              File must be a csv (w/header) with columns:
              ``{[f.name for f in dataclass_fields(LabelData)]}``
  
          clip_sampler (Callable[[Dict[str, Video], Dict[str, List[LabelData]]],
              List[VideoClipInfo]]):
              Defines how clips should be sampled from each video. See the clip
              sampling documentation for more information.
  
          dataset_type (VideoDatasetType): The data format in which dataset
              video data is stored (e.g. video frames, encoded video etc).
  
          frames_per_second (int): The FPS of the stored videos. (NOTE:
              this is variable and may be different than the original FPS
              reported on the DoMSEV dataset website -- it depends on the
              preprocessed subsampling and frame extraction).
  
          transform (Optional[Callable[[Dict[str, Any]], Any]]):
              This callable is evaluated on the clip output before the clip is returned.
              It can be used for user-defined preprocessing and augmentations to the clips.
              The clip output format is described in __next__().
  
          frame_filter (Optional[Callable[[List[int]], List[int]]]):
              This callable is evaluated on the set of available frame indices to be
              included in a sampled clip. This can be used to subselect frames within
              a clip to be loaded.
  
          multithreaded_io (bool):
              Boolean to control whether io operations are performed across multiple
              threads.
      """
      assert video_info_file_path
      assert labels_file_path
      assert video_data_manifest_file_path
  
      # Populate video and metadata data providers
      self._videos: Dict[str, Video] = VideoDataset._load_videos(
          video_data_manifest_file_path,
          video_info_file_path,
          multithreaded_io,
          dataset_type,
      )
  
      self._labels_per_video: Dict[
          str, List[LabelData]
      ] = load_dataclass_dict_from_csv(
          labels_file_path, LabelData, "video_id", list_per_key=True
      )
  
      # Sample datapoints
      self._clips: List[VideoClipInfo] = clip_sampler(
          self._videos, self._labels_per_video
      )
  
      self._frames_per_second = frames_per_second
      self._user_transform = transform
      self._transform = self._transform_clip
      self._frame_filter = frame_filter
  
imports: import logging
  import math
  import random
  import time
  from dataclasses import dataclass
  from enum import Enum
  from typing import Any, Callable, Dict, List, Optional, Tuple
  import numpy
  import torch
  from iopath.common.file_io import g_pathmgr
  from PIL import Image
  from pytorchvideo.data.dataset_manifest_utils import ImageDataset, ImageFrameInfo, VideoClipInfo, VideoDataset, VideoDatasetType
  from pytorchvideo.data.utils import DataclassFieldCaster, load_dataclass_dict_from_csv
  from pytorchvideo.data.video import Video
label_desc: Use image node_id 1 to create a new DomsevVideoDataset object from inherited base classes: torch.utils.data with example: obj = DomsevVideoDataset(video_data_manifest_file_path, video_info_file_path, labels_file_path, clip_sampler, dataset_type, frames_per_second, transform, frame_filter, multithreaded_io)