# Image-to-video comparison

> Pairwise A/B comparison of two candidate videos against a reference image.

Image-to-video comparison (`i2v_comparison`) is a purpose-built task type for evaluating generated video against the source image it was conditioned on. Each datapoint pairs **exactly one reference image** with **exactly two candidate videos**, and annotators pick the video that better matches the reference. The reference image is shown alongside both videos.

## When to use it

- Ranking image-to-video model outputs by fidelity to the conditioning image
- Comparing two generations from the same prompt frame
- Preference data for image-to-video model training and evaluation

For same-modality pairs — two images, two videos, or two audio clips — use plain [comparison](/docs/task-types/comparison) instead; it accepts an optional `reference` item too.

## Datapoint shape

```json
{
  "media": {
    "reference": [{ "url": "dp://5ce7b1a94f28/prompt.png", "type": "image" }],
    "candidates": [
      { "url": "dp://b6a1cd3f1234/gen_a.mp4", "type": "video" },
      { "url": "dp://c8f3ae9b5678/gen_b.mp4", "type": "video" }
    ]
  }
}
```

<ParamTable
  title="media"
  params={[
    { name: "reference", type: "array", required: true, description: "Exactly one item, which must be an image. Shown for context; not voted on." },
    { name: "candidates", type: "array", required: true, description: "Exactly two items, both of which must be videos. These are the A/B options annotators choose between." }
  ]}
/>

Each item is a `{ url, type }` object: `url` is a `dp://` reference from `POST /media` (or a public `https://` URL). `type` is optional — it's inferred from the uploaded media, or from the URL's file extension. Supply it explicitly only when a public URL has no extension to infer from.

## Result shape

Results use the same A/B shape as [comparison](/docs/task-types/comparison):

```json
{
  "datapoint_index": 0,
  "votes": { "A": 8, "B": 2 },
  "total_responses": 10,
  "consensus": "A",
  "confidence": 0.8,
  "agreement_rate": 0.8,
  "weighted_votes": { "A": 7.3, "B": 1.6 },
  "weighted_consensus": "A",
  "weighted_confidence": 0.82,
  "media": [
    {
      "media_id": "5ce7b1a9-4f28-4c1a-8b7e-2d3f4a5b6c7d",
      "type": "image",
      "role": "reference",
      "label": null,
      "url": "/media/v2/5ce7b1a9-4f28-4c1a-8b7e-2d3f4a5b6c7d?sig=...",
      "thumbnail_url": "/media/v2/5ce7b1a9-4f28-4c1a-8b7e-2d3f4a5b6c7d?preview=1&sig=..."
    },
    {
      "media_id": "b6a1cd3f-1234-4a2b-9c8d-0e1f2a3b4c5d",
      "type": "video",
      "role": "candidates",
      "label": null,
      "url": "/media/v2/b6a1cd3f-1234-4a2b-9c8d-0e1f2a3b4c5d?sig=...",
      "thumbnail_url": "/media/v2/b6a1cd3f-1234-4a2b-9c8d-0e1f2a3b4c5d?preview=1&sig=..."
    },
    {
      "media_id": "c8f3ae9b-5678-4d3e-8f9a-1b2c3d4e5f60",
      "type": "video",
      "role": "candidates",
      "label": null,
      "url": "/media/v2/c8f3ae9b-5678-4d3e-8f9a-1b2c3d4e5f60?sig=...",
      "thumbnail_url": "/media/v2/c8f3ae9b-5678-4d3e-8f9a-1b2c3d4e5f60?preview=1&sig=..."
    }
  ]
}
```

<ParamTable
  params={[
    { name: "votes", type: "{ A: int, B: int }", description: "Vote count per candidate video." },
    { name: "total_responses", type: "int", description: "Total annotator responses received." },
    { name: "consensus", type: '"A" | "B" | "tie" | null', description: "The winning video, or `tie` on exact match, or null if no responses yet." },
    { name: "confidence", type: "float", description: "Winning votes / total, rounded to 3 decimals." },
    { name: "agreement_rate", type: "float", description: "Same as confidence for comparison tasks." },
    { name: "weighted_votes", type: "{ A: float, B: float }", description: "Vote totals where each response is weighted by a platform-computed reliability score instead of counted as 1. Rounded to 3 decimals." },
    { name: "weighted_consensus", type: '"A" | "B" | "tie" | null', description: "Winner by `weighted_votes`, or null when there are no eligible responses." },
    { name: "weighted_confidence", type: "float | null", description: "Winning weighted votes / total weighted votes, rounded to 3 decimals, or null when there are no eligible responses." },
    { name: "media", type: "array", description: "The datapoint's media items — the reference image and both candidate videos — so you can tie each vote key back to the asset it refers to. See the fields below." }
  ]}
/>

Each entry in the `media` array describes one media item on the datapoint:

<ParamTable
  title="media[]"
  params={[
    { name: "media_id", type: "string", description: "Stable identifier for the media item." },
    { name: "type", type: '"video" | "image"', description: "The media item's type — `video` for candidates, `image` for the reference." },
    { name: "role", type: '"candidates" | "reference"', description: "Where the item sits on the datapoint — `candidates` are the two voted-on videos; `reference` is the context-only source image." },
    { name: "label", type: "string | null", description: "A per-item vote key, present only for task types that store one on the media. i2v candidates don't carry one here, so this is `null` for every entry, reference included — map candidates back to `A`/`B` by submission order instead (see the note below)." },
    { name: "url", type: "string", description: "Signed, relative proxy URL for the media; valid for roughly one hour." },
    { name: "thumbnail_url", type: "string", description: "Signed, relative preview URL; valid for roughly one hour." }
  ]}
/>

<DocCallout type="note" title="Mapping A and B back to your assets">
`A` and `B` are fixed at job creation: **`A` is the first candidate video you submitted, `B` is the second.** Only the on-screen order is shuffled per annotator, so neither position bias nor the shuffle changes which asset a key refers to.

Rows from `GET /jobs/{id}/responses` carry only the bare vote key (`"A"` or `"B"`) — they don't tell you which video that was. To map a key to an actual file, use the `media` array on each `GET /jobs/{id}/results` row: filter `role === "candidates"` (the entries appear in the order you submitted them — first is `A`, second is `B`) and read each item's `media_id` and signed `url`. The `reference` entry is the source image.
</DocCallout>

<DocCallout type="note" title="Reading result fields">
Results may include additional fields beyond those listed here, and any field can be `null` before a datapoint has received responses. Read fields by name rather than assuming a fixed shape.
</DocCallout>

Multi-dimension scoring works the same way as comparison: replace `instruction` with `dimensions` to ask several questions about the same pair, and results include a combined `weighted_score` and per-dimension breakdowns.

## Example request

<CodeTabs>
  <CodeTab lang="curl" label="curl">
```bash
curl -X POST https://api.trydatapoint.com/data-labelling/v1/jobs \
  -H "X-API-Key: $DATAPOINT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "i2v-fidelity-v1",
    "instruction": "Which video better matches the reference image?",
    "task_type": "i2v_comparison",
    "max_responses_per_datapoint": 15,
    "datapoints": [
      {
        "media": {
          "reference": [{ "url": "dp://5ce7b1a94f28/prompt.png", "type": "image" }],
          "candidates": [
            { "url": "dp://b6a1cd3f1234/gen_a.mp4", "type": "video" },
            { "url": "dp://c8f3ae9b5678/gen_b.mp4", "type": "video" }
          ]
        }
      }
    ]
  }'
```
  </CodeTab>
  <CodeTab lang="python" label="Python">
```python
requests.post(
    "https://api.trydatapoint.com/data-labelling/v1/jobs",
    headers={"X-API-Key": key},
    json={
        "name": "i2v-fidelity-v1",
        "instruction": "Which video better matches the reference image?",
        "task_type": "i2v_comparison",
        "max_responses_per_datapoint": 15,
        "datapoints": [
            {
                "media": {
                    "reference": [{"url": "dp://5ce7b1a94f28/prompt.png", "type": "image"}],
                    "candidates": [
                        {"url": "dp://b6a1cd3f1234/gen_a.mp4", "type": "video"},
                        {"url": "dp://c8f3ae9b5678/gen_b.mp4", "type": "video"},
                    ],
                }
            }
        ],
    },
)
```
  </CodeTab>
</CodeTabs>

## Common errors

| Status | Cause |
|---|---|
| `422` | `media` is not a JSON object (it must be an object with `reference` and `candidates`). |
| `400` | `reference` does not contain exactly one item. |
| `400` | `candidates` does not contain exactly two items. |
| `400` | The reference item is not an image. |
| `400` | A candidate item is not a video. |
| `422` | `max_responses_per_datapoint` outside [1, 10000], or a required top-level field is missing or malformed. |

## Next

- [Comparison](/docs/task-types/comparison): same-modality A/B comparison
- [Media handling](/docs/media): supported formats and `dp://` references
- [API Reference: Jobs](/docs/api/jobs): every job endpoint
