cutcutcodec.core.analysis.video.quality.vmaf

cutcutcodec.core.analysis.video.quality.vmaf(dis: Tensor, ref: Tensor, *, _model=None, **kwargs) Tensor[source]

Compute the Video Multi-Method Assessment Fusion of 2 images.

Parameters

dis, refarraylike

The 2 images to be compared, of shape ([*batch], height, width, channels=3). The frames are assumed to be in YUV (y’pbpr) in range [0, 1]. Gamut and EOTF must be standard rgb.

threadsint, optional

Defines the number of threads. The value -1 means that the function uses as many calculation threads as there are cores. The default value (0) allows the same behavior as (-1) if the function is called in the main thread, otherwise (1) to avoid nested threads. Any other positive value corresponds to the number of threads used.

Returns

vmafarraylike

The learned perceptual image patch similarity of each image.

Notes

This static function does not require the installation of vmaf.

Examples

>>> import numpy as np
>>> from cutcutcodec.core.analysis.video.quality import vmaf
>>> np.random.seed(0)
>>> ref = np.random.random((720, 1080, 3))  # It could also be a torch array list...
>>> ref[..., 1:3] -= 0.5  # because pbpr in [-0.5, 0.5]
>>> dis = 0.8 * ref + 0.2 * np.random.randn((720, 1080, 3))
>>> vmaf(dis, ref).round(1)
>>>