Video Decoders#

Decoders type#

class eztorch.datasets.decoders.DecoderType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Frame decoders#

Used to decode videos stored as frames.

class eztorch.datasets.decoders.GeneralFrameVideo(num_threads_io=0, num_threads_decode=0, transform=None)[source]#

GeneralFrameVideo is an abstract class for accessing clips stored as frames.

Parameters:
  • num_threads_io (

    Default:, optional) – Controls whether parallelizable io operations are performed across multiple threads.
    Default: 0

  • num_threads_decode (

    Default:, optional) – Controls whether parallelizable decode operations are performed across multiple threads.
    Default: 0

  • transform (

    Default:, optional) – The transform to apply to the frames.
    Default: None

class eztorch.datasets.decoders.FrameVideo(video_path, duration, fps, frame_filter=None, time_difference_prob=0.0, video_frame_to_path_fn=<function get_video_to_frame_path_fn.<locals>.fn>, video_frame_paths=None, num_threads_io=0, num_threads_decode=0, transform=None, decode_float=False)[source]#

FrameVideo is an abstractions for accessing clips based on their start and end time for a video where each frame is stored as an image.

Parameters:
  • video_path (

    Default:) – The path of the video.

  • duration (

    Default:) – The duration of the video in seconds.

  • fps (

    Default:) – The target fps for the video. This is needed to link the frames to a second timestamp in the video.

  • frame_filter (

    Default:, optional) – Function to subsample frames in a clip before loading. If None, no subsampling is performed
    Default: None

  • video_frame_to_path_fn (

    Default:, optional) – A function that maps from the video path and a frame index integer to the file path where the frame is located.
    Default: <function get_video_to_frame_path_fn.<locals>.fn>

  • video_frame_paths (

    Default:, optional) – List of frame paths for each index of a video.
    Default: None

  • num_threads_io (

    Default:, optional) – Controls whether parallelizable io operations are performed across multiple threads.
    Default: 0

  • num_threads_decode (

    Default:, optional) – Controls whether parallelizable decode operations are performed across multiple threads.
    Default: 0

  • transform (

    Default:, optional) – The transform to apply to the frames.
    Default: None

  • decode_float (

    Default:, optional) – Whether to decode the clip as float.
    Default: False

class eztorch.datasets.decoders.FrameSoccerNetVideo(video_path, half_path, duration, fps_video, fps, num_frames, transform=None, video_frame_to_path_fn=<function get_video_to_frame_path_fn.<locals>.fn>, time_difference_prob=0.0, num_threads_io=0, num_threads_decode=0, num_decode=1, num_decode_time_diff=2, mask_ratio=0.0, mask_tube=2, min_clip_duration=0, decode_float=False)[source]#

FrameSoccerNetVideo is an abstractions for accessing clips based on their start and end time for a video where each frame is stored as an image.

Parameters:
  • video_path (

    Default:) – The path of the video.

  • half_path (

    Default:) – The path of the half.

  • duration (

    Default:) – The duration of the video in seconds.

  • fps_video (

    Default:) – The fps of the video.

  • fps (

    Default:) – The target fps for the video. This is needed to link the frames to a second timestamp in the video.

  • num_frames (

    Default:) – The number of frames of the video.

  • transform (

    Default:, optional) – The transform to apply to the frames.
    Default: None

  • video_frame_to_path_fn (

    Default:, optional) – A function that maps from the video path and a frame index integer to the file path where the frame is located.
    Default: <function get_video_to_frame_path_fn.<locals>.fn>

  • time_difference_prob (

    Default:, optional) – Probability to apply time difference.
    Default: 0.0

  • num_threads_io (

    Default:, optional) – Controls whether parallelizable io operations are performed across multiple threads.
    Default: 0

  • num_threads_decode (

    Default:, optional) – Controls whether parallelizable decode operations are performed across multiple threads.
    Default: 0

  • num_decode (

    Default:, optional) – Number of decode to perform. If > 1, the videos decoded are stored in a list.
    Default: 1

  • num_decode_time_diff (

    Default:, optional) – Number of time difference decode to perform. If > 1, the videos decoded are stored in a list.
    Default: 2

  • mask_ratio (

    Default:, optional) – Masking ratio for the video.
    Default: 0.0

  • mask_ratio – Sequence tube size for masking the video.

  • min_clip_duration (

    Default:, optional) – The minimum duration of a clip.
    Default: 0

  • decode_float (

    Default:, optional) – Whether to decode the clip as float.
    Default: False

class eztorch.datasets.decoders.FrameSpotVideo(video_path, num_frames, transform=None, video_frame_to_path_fn=<function get_video_to_frame_path_fn.<locals>.fn>, num_threads_io=0, num_threads_decode=0, num_decode=1, mask_ratio=0.0, mask_tube=2, min_clip_duration=0, decode_float=False)[source]#

FrameSpotVideo is an abstractions for accessing clips based on their start and end time for a video where each frame is stored as an image.

Parameters:
  • video_path (

    Default:) – The path of the video.

  • num_frames (

    Default:) – The number of frames of the video.

  • transform (

    Default:, optional) – The transform to apply to the frames.
    Default: None

  • video_frame_to_path_fn (

    Default:, optional) – A function that maps from the video path and a frame index integer to the file path where the frame is located.
    Default: <function get_video_to_frame_path_fn.<locals>.fn>

  • num_threads_io (

    Default:, optional) – Controls whether parallelizable io operations are performed across multiple threads.
    Default: 0

  • num_threads_decode (

    Default:, optional) – Controls whether parallelizable decode operations are performed across multiple threads.
    Default: 0

  • num_decode (

    Default:, optional) – Number of decode to perform. If > 1, the videos decoded are stored in a list.
    Default: 1

  • mask_ratio (

    Default:, optional) – Masking ratio for the video.
    Default: 0.0

  • mask_ratio – Sequence tube size for masking the video.

  • min_clip_duration (

    Default:, optional) – The minimum duration of a clip.
    Default: 0

  • decode_float (

    Default:, optional) – Whether to decode the clip as float.
    Default: False

Dumb decoders#

Used to simulate video decoding, return randomly generated tensors.

class eztorch.datasets.decoders.DumbSoccerNetVideo(video_path, half_path, duration, fps_video, fps, num_frames, min_clip_duration, num_decode, **kwargs)[source]#

DumbSoccerNetVideo is an abstractions for accessing clips based on their start and end time for a video where each frame is randomly generated.

Parameters:
  • video_path (

    Default:) – The path of the video.

  • half_path (

    Default:) – The path of the half.

  • duration (

    Default:) – The duration of the video in seconds.

  • fps_video (

    Default:) – The fps of the video.

  • fps (

    Default:) – The target fps for the video. This is needed to link the frames to a second timestamp in the video.

  • num_frames (

    Default:) – The number of frames of the video.

  • min_clip_duration (

    Default:) – The minimum duration of a clip.

  • num_decode (

    Default:) – Number of duplicate output clip.

class eztorch.datasets.decoders.DumbSpotVideo(video_path, fps, num_frames, num_decode=1, min_clip_duration=0, **kwargs)[source]#

DumbSpotVideo is an abstractions for accessing clips based on their start and end time for a video where each frame is randomly generated.

Parameters:
  • video_path (

    Default:) – The path of the video.

  • fps (

    Default:) – The target fps for the video. This is needed to link the frames to a second timestamp in the video.

  • num_frames (

    Default:) – The number of frames of the video.

  • min_clip_duration (

    Default:, optional) – The minimum duration of a clip.
    Default: 0

  • num_decode (

    Default:, optional) – Number of duplicate output clip.
    Default: 1