data_juicer.ops.mapper.video_resize_resolution_mapper module#

class data_juicer.ops.mapper.video_resize_resolution_mapper.VideoResizeResolutionMapper(min_width: int = 1, max_width: int = 9223372036854775807, min_height: int = 1, max_height: int = 9223372036854775807, force_original_aspect_ratio: str = 'disable', force_divisible_by: Annotated[int, Gt(gt=0)] = 2, *args, **kwargs)[source]#

Bases: Mapper

Mapper to resize videos resolution. We leave the super resolution with deep learning for future works.

__init__(min_width: int = 1, max_width: int = 9223372036854775807, min_height: int = 1, max_height: int = 9223372036854775807, force_original_aspect_ratio: str = 'disable', force_divisible_by: Annotated[int, Gt(gt=0)] = 2, *args, **kwargs)[source]#

Initialization method.

Parameters:
  • min_width – Videos with width less than ‘min_width’ will be mapped to videos with equal or bigger width.

  • max_width – Videos with width more than ‘max_width’ will be mapped to videos with equal of smaller width.

  • min_height – Videos with height less than ‘min_height’ will be mapped to videos with equal or bigger height.

  • max_height – Videos with height more than ‘max_height’ will be mapped to videos with equal or smaller height.

  • force_original_aspect_ratio – Enable decreasing or increasing output video width or height if necessary to keep the original aspect ratio, including [‘disable’, ‘decrease’, ‘increase’].

  • force_divisible_by – Ensures that both the output dimensions, width and height, are divisible by the given integer when used together with force_original_aspect_ratio, must be a positive even number.

  • args – extra args

  • kwargs – extra args

process_single(sample, context=False)[source]#

For sample level, sample –> sample

Parameters:

sample – sample to process

Returns:

processed sample