Skip to content
FastVideo
Esc
↑↓navigate↵open⌘Jpreview
On this page

types

fastvideo.eval.types.MetricResult

MetricResult(name: str, score: float | None, details: dict[str, Any] = dict())

Standard result container returned by all metrics.

score is None when the metric was skipped (e.g. missing required input). Check details["skipped"] for the reason.

Source
@dataclass
class MetricResult:
    """Standard result container returned by all metrics.
``score`` is ``None`` when the metric was skipped (e.g. missing
required input).  Check ``details["skipped"]`` for the reason.
"""
name: str
score: float | None
details: dict&#91;str, Any&#93; = field(default_factory=dict)</code></pre></details>

fastvideo.eval.types.EvalResults

EvalResults(samples: list[dict[str, MetricResult]] | None = None, corpus: dict[str, MetricResult] | None = None)

Return type for :meth:Evaluator.evaluate with samples=....

Behaves like a list[dict[str, MetricResult]] — one dict per input sample, in input order — so existing iteration and indexing keeps working. The corpus attribute carries set-metric results (FAD, IS, …) that are properties of the whole input set, not of any individual sample. Empty dict when no set metric ran.

Source
class EvalResults(list):
    """Return type for :meth:`Evaluator.evaluate` with ``samples=...``.
Behaves like a ``list&#91;dict&#91;str, MetricResult&#93;&#93;`` — one dict per
input sample, in input order — so existing iteration and indexing
keeps working. The ``corpus`` attribute carries set-metric results
(FAD, IS, …) that are properties of the whole input set, not of
any individual sample. Empty dict when no set metric ran.
&quot;&quot;&quot;

def __init__(
    self,
    samples: list&#91;dict&#91;str, MetricResult&#93;&#93; | None = None,
    corpus: dict&#91;str, MetricResult&#93; | None = None,
) -&gt; None:
    super().__init__(samples or &#91;&#93;)
    self.corpus: dict&#91;str, MetricResult&#93; = corpus or &#123;&#125;</code></pre></details>

fastvideo.eval.types.Video

Video(source: Any, fps: float | None = None, frames: Any = None, audio: Any = None, audio_sr: int | None = None)

Path-backed media handle. The :class:VideoPool populates frames (and optionally audio) before the metric loop sees the sample.

Source
@dataclass
class Video:
    """Path-backed media handle. The :class:`VideoPool` populates
    ``frames`` (and optionally ``audio``) before the metric loop sees
    the sample.
    """
source: Any
fps: float | None = None
frames: Any = None
audio: Any = None
audio_sr: int | None = None

def has_frames(self) -&gt; bool:
    return self.frames is not None

def has_audio(self) -&gt; bool:
    return self.audio is not None

def __post_init__(self) -&gt; None:
    if isinstance(self.source, Path):
        self.source = str(self.source)</code></pre></details>

fastvideo.eval.types.Video.has_frames

has_frames() -> bool
Source
def has_frames(self) -> bool:
    return self.frames is not None

fastvideo.eval.types.Video.has_audio

has_audio() -> bool
Source
def has_audio(self) -> bool:
    return self.audio is not None

Was this page helpful?