<table class="fo-notebook-links" align="left">
    <td>
        <a target="_blank" href="https://colab.research.google.com/github/voxel51/fiftyone/blob/main/docs/source/getting_started/annotation/02_setup_splits.ipynb">
            <img src="https://cdn.voxel51.com/colab-logo-256px.png"> &nbsp; Run in Google Colab
        </a>
    </td>
    <td>
        <a target="_blank" href="https://github.com/voxel51/fiftyone/blob/main/docs/source/getting_started/annotation/02_setup_splits.ipynb">
            <img src="https://cdn.voxel51.com/github-logo-256px.png"> &nbsp; View source on GitHub
        </a>
    </td>
    <td>
        <a target="_blank" href="https://raw.githubusercontent.com/voxel51/fiftyone/main/docs/source/getting_started/annotation/02_setup_splits.ipynb" download>
            <img src="https://cdn.voxel51.com/cloud-icon-256px.png"> &nbsp; Download notebook
        </a>
    </td>
</table>

# Step 2: Setup Data Splits

Before iterating on annotations, you need proper data splits. Without them, you’ll contaminate your evaluation and build a model that only looks good on paper.

This step uses the **quickstart-groups** dataset (KITTI multimodal data with left/right cameras and point clouds) and creates:

- **Test set (15%)** - Frozen. Never used for selection or training. Final evaluation only.
- **Validation set (15%)** - For iteration decisions. Used to evaluate between training rounds.
- **Golden QA set (5%)** - Small, heavily reviewed. Detects label drift.
- **Pool (65%)** - Active learning pool. All new labels come from here.

> **Critical:** Splits are created at the **group level** (scene), not sample level. This ensures the same scene stays together across all slices (left, right, pcd), preventing data leakage.

## Load or Create the Dataset

We clone `quickstart-groups` to a persistent working dataset. This keeps your annotations separate from the zoo dataset.

## Understand the Grouped Structure

The `quickstart-groups` dataset is a **grouped dataset** from KITTI:

| Slice   | Content             | Purpose                    |
|---------|---------------------|----------------------------|
| `left`  | Left camera images  | 2D detection annotation    |
| `right` | Right camera images | Stereo pair (optional use) |
| `pcd`   | Point cloud data    | 3D cuboid annotation       |

Each **group** represents one scene/frame with synchronized data across all sensors.

## Create Splits at the Group Level

**Why group-level splits?**

If we split at the sample level, the same scene could end up in both train and test (just different slices). This causes data leakage - the model “sees” scenes at training time that appear in evaluation.

By splitting at the **group level**, we ensure:

- All slices from the same scene stay together
- No information leaks between splits

## Launch the App

Explore your grouped dataset in the App. Notice:

- The **group mode** shows synchronized samples
- Use the **slice selector** to switch between left, right, and pcd
- Filter by split tags to see each partition

## Summary

You created four data splits with clear purposes:

- Test (frozen), Val (iteration), Golden (QA), Pool (labeling source)
- **Splits are at the group level** - same scene = same split across all slices

**Artifacts:**

- `annotation_tutorial` dataset (persistent clone of quickstart-groups)
- Split tags: `split:test`, `split:val`, `split:golden`, `split:pool`
- Saved views: `test_set`, `val_set`, `golden_qa`, `pool`
- `annotation_status` field for tracking progress

**Next:** Step 3 - Smart Sample Selection
