<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/05_annotation_3d.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/05_annotation_3d.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/05_annotation_3d.ipynb" download>
            <img src="https://cdn.voxel51.com/cloud-icon-256px.png"> &nbsp; Download notebook
        </a>
    </td>
</table>

# Step 5: 3D Annotation

Now we annotate 3D cuboids on the point cloud slice. This step covers:

1. Setting up a 3D annotation schema
2. Using the 3D annotation tools (cuboids, transform controls)
3. Understanding the annotation plane concept
4. Viewing 3D labels projected onto 2D camera images

> **Tip:** Complete Step 4 (2D annotation) first. Having 2D labels as reference helps with 3D annotation consistency.

## Define Your 3D Schema

For 3D cuboids, we use a subset of KITTI classes - focusing on objects that have clear 3D extent in point clouds.

## 3D Annotation in the App

### Getting to the 3D View

1. Launch the App with your batch
2. Click a sample to open the modal
3. **Select the \`\`pcd\`\` slice** from the slice dropdown
4. The 3D visualizer will load the point cloud

### 3D Navigation

- **Rotate**: Left-click and drag
- **Pan**: Right-click and drag (or Shift + left-click)
- **Zoom**: Scroll wheel
- **Preset views**: Press `1`, `2`, `3`, `4` for top/right/front/annotation-plane views

## Creating 3D Cuboids

### Enter Annotate Mode

1. Click the **Annotate** tab (pencil icon)
2. Click **Schema** -> **New Field** -> name it `human_cuboids`
3. Set type to **Detections** and add the classes above

### Understanding the Annotation Plane

The **annotation plane** is a virtual surface that determines where your clicks place vertices. By default, it’s the XY plane (ground level).

- **Moving the plane**: Reposition to place vertices at different heights
- **Why it matters**: Cuboid corners snap to this plane when you click

### Drawing a Cuboid

1. Click the **Cuboid** tool in the left toolbar
2. Click to place the **first corner** on the annotation plane
3. Click to place the **opposite corner** (defines the base rectangle)
4. The cuboid is created with a default height
5. Select a class from the dropdown

### Transform Controls

After creating a cuboid, use transform controls to refine it:

| Control         | What it does                             |
|-----------------|------------------------------------------|
| **Translation** | Move along X/Y/Z axes or XY/XZ/YZ planes |
| **Rotation**    | Rotate around X/Y/Z axes                 |
| **Scaling**     | Resize along X/Y/Z axes                  |

Click on a cuboid to select it, then use the transform handles.

## Camera Projections

One of FiftyOne’s key 3D features is **camera projections**:

### Point Cloud Projections

- Flatten the 3D view to 2D planes (top-down, side views)
- Useful for accurate positioning

### 2D Image Projections

- See the camera images in the 3D viewer dropdown
- Your 3D cuboids are **projected onto the 2D images in real-time**
- This helps verify that your 3D labels align with the 2D scene

To use camera projections:

1. Look for the **projection dropdown** in the 3D viewer
2. Select a camera (e.g., `left`)
3. See your cuboids rendered on the 2D image

> **Note:** Camera projections require camera intrinsics/extrinsics to be defined in the dataset. The KITTI data in quickstart-groups should have these.

## Annotation Guidelines for 3D

### Positioning

- Center the cuboid on the point cloud cluster representing the object
- The base should touch the ground plane
- Include all points belonging to the object

### Orientation

- Align the cuboid’s longest axis with the object’s heading direction
- For vehicles, the front should point in the driving direction

### Sizing

- Tightly fit the cuboid to the point cloud extent
- Don’t include points from other objects or ground

### Consistency with 2D

- Objects labeled in 2D should also be labeled in 3D (if visible in point cloud)
- Use the same class for the same object across both modalities

---

## Fast-Forward Option

If you want to skip manual 3D labeling, set `FAST_FORWARD = True` below.

## QA Checks for 3D

## Summary

You annotated 3D cuboids on the point cloud slice:

- Defined a 3D schema (subset of KITTI classes)
- Used the annotation plane and transform controls
- Verified alignment using camera projections
- Ran QA checks for coverage and cross-modality consistency

**Artifacts:**

- `human_cuboids` field with 3D cuboid annotations
- `annotated_3d:v0` tag on point cloud samples with labels

**Key Concept:** The 3D→2D camera projections let you verify that your 3D labels align with the 2D scene. This cross-modal validation is a key differentiator for multimodal annotation workflows.

**Next:** Step 6 - Train + Evaluate
