dgs.models.dataset.dataset.VideoDataset

class dgs.models.dataset.dataset.VideoDataset(*args: Any, **kwargs: Any)[source]

A dataset containing a single video.

Should support many file formats, but .mp4 works best.

Notes

The torchvision Video-API is in beta status and will most likely change. So make sure everything works before upgrading the version of torchvision.

Params

data_path (FilePath):

The path to the file containing the data for this dataset. Either from within the dataset_path directory, or as absolute path. If you want to combine multiple files to a single (concatenated) dataset, check out the function get_concatenated_dataset() or the paths parameter.

Optional Params

stream (str):

Default DEF_VAL.video_dataset.stream.

num_threads (int):

The number of threads used when loading the video. The default is 0 and lets ffmpeg decide the best configuration. Default DEF_VAL.video_dataset.num_threads.

video_backend (str):

The backend to use when loading the video. Default DEF_VAL.video_dataset.video_backend.

paths (list[FilePath], optional):

A list of file paths to concatenate into a single dataset. Will be ignored by the single dataset.

__init__(config: dict[str, any], path: list[str]) None[source]

Methods

arbitrary_to_ds(a, idx)

Given an index, convert arbitrary data into a State or a list of States.

configure_torch_module(module[, train])

Set compute mode and send model to the device or multiple parallel devices if applicable.

get_image_crops(ds)

Add the image crops and local key-points to a given state.

get_path_in_dataset(path)

Given an arbitrary file- or directory-path, return its absolute path.

terminate()

Terminate this module and all of its submodules.

transform_crop_resize()

Given one single image, with its corresponding bounding boxes and key-points, obtain a cropped image for every bounding box with localized key-points.

transform_resize_image()

Given an image, bboxes, and key-points, resize them with custom modes.

validate_params(validations[, attrib_name])

Given per key validations, validate this module's parameters.

Attributes

device

Get the device of this module.

is_training

Get whether this module is set to training-mode.

module_name

Get the name of the module.

module_type

name

Get the name of the module.

name_safe

Get the escaped name of the module usable in filepaths by replacing spaces and underscores.

precision

Get the (floating point) precision used in multiple parts of this module.

data

Arbitrary data, which will be converted using self.arbitrary_to_ds()

dataset_path

The base path to the dataset.