---
title: types
---

<div class="python-reference">
<a id="fastvideo.eval.types-classes"></a>
<a id="fastvideo.eval.types"></a>

<h2 id="fastvideo.eval.types.MetricResult"><code>fastvideo.eval.types.MetricResult</code></h2>
<pre class="doc-signature"><code>MetricResult(name: str, score: float | None, details: dict&#91;str, Any&#93; = dict())</code></pre>
<p>Standard result container returned by all metrics.</p>
<p><code>score</code> is <code>None</code> when the metric was skipped (e.g. missing
required input).  Check <code>details["skipped"]</code> for the reason.</p>

<details><summary>Source</summary><pre><code>@dataclass
class MetricResult:
    &quot;&quot;&quot;Standard result container returned by all metrics.

    ``score`` is ``None`` when the metric was skipped (e.g. missing
    required input).  Check ``details&#91;&quot;skipped&quot;&#93;`` for the reason.
    &quot;&quot;&quot;
    name: str
    score: float | None
    details: dict&#91;str, Any&#93; = field(default_factory=dict)</code></pre></details>
<h2 id="fastvideo.eval.types.EvalResults"><code>fastvideo.eval.types.EvalResults</code></h2>
<pre class="doc-signature"><code>EvalResults(samples: list&#91;dict&#91;str, MetricResult&#93;&#93; | None = None, corpus: dict&#91;str, MetricResult&#93; | None = None)</code></pre>
<p>Return type for :meth:<code>Evaluator.evaluate</code> with <code>samples=...</code>.</p>
<p>Behaves like a <code>list[dict[str, MetricResult]]</code> — one dict per
input sample, in input order — so existing iteration and indexing
keeps working. The <code>corpus</code> 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.</p>

<details><summary>Source</summary><pre><code>class EvalResults(list):
    &quot;&quot;&quot;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>
<h2 id="fastvideo.eval.types.Video"><code>fastvideo.eval.types.Video</code></h2>
<pre class="doc-signature"><code>Video(source: Any, fps: float | None = None, frames: Any = None, audio: Any = None, audio_sr: int | None = None)</code></pre>
<p>Path-backed media handle. The :class:<code>VideoPool</code> populates
<code>frames</code> (and optionally <code>audio</code>) before the metric loop sees
the sample.</p>

<details><summary>Source</summary><pre><code>@dataclass
class Video:
    &quot;&quot;&quot;Path-backed media handle. The :class:`VideoPool` populates
    ``frames`` (and optionally ``audio``) before the metric loop sees
    the sample.
    &quot;&quot;&quot;

    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>
<h3 id="fastvideo.eval.types.Video.has_frames"><code>fastvideo.eval.types.Video.has_frames</code></h3>
<pre class="doc-signature"><code>has_frames() -&gt; bool</code></pre>

<details><summary>Source</summary><pre><code>def has_frames(self) -&gt; bool:
    return self.frames is not None</code></pre></details>
<h3 id="fastvideo.eval.types.Video.has_audio"><code>fastvideo.eval.types.Video.has_audio</code></h3>
<pre class="doc-signature"><code>has_audio() -&gt; bool</code></pre>

<details><summary>Source</summary><pre><code>def has_audio(self) -&gt; bool:
    return self.audio is not None</code></pre></details>
</div>
