> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/platform/pop/pop-examples.md). Agents can also search and read this documentation through its [MCP server](https://docs.eyepop.ai/~gitbook/mcp).

# Examples

Worked Pop pipelines, from a single ability to multi-stage chains

Each example below is a complete Pop. Pass one to a worker session and it runs against every [source](https://docs.eyepop.ai/platform/sources-and-options.md) you submit. For the attributes these examples use, see [Components](https://docs.eyepop.ai/platform/pop/pop-components.md) and [Forwarding](https://docs.eyepop.ai/platform/pop/pop-forwarding.md); for the abilities they name, [Abilities](https://docs.eyepop.ai/platform/abilities.md).

{% tabs %}
{% tab title="Python" %}

```python
from eyepop import EyePopSdk

with EyePopSdk.sync_worker(pop=pop) as endpoint:
    result = endpoint.upload("street.jpg").predict()
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { EyePop } from '@eyepop.ai/eyepop'

const endpoint = await EyePop.workerEndpoint({ pop }).connect()
```

{% endtab %}
{% endtabs %}

### One ability

The simplest Pop runs a single ability over the whole frame.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import Pop, InferenceComponent

pop = Pop(components=[
    InferenceComponent(ability="eyepop.person:latest"),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        { type: PopComponentType.INFERENCE, ability: 'eyepop.person:latest' },
    ],
}
```

{% endtab %}
{% endtabs %}

### Keep only some classes

A broad ability narrowed to the classes you care about. `classes` drops everything else before the results are returned; see [Restricting to classes](https://docs.eyepop.ai/platform/pop/pop-components/inference.md#restricting-to-classes).

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import Pop, InferenceComponent

pop = Pop(components=[
    InferenceComponent(ability="eyepop.common-objects:latest", classes=["person", "car"]),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.common-objects:latest',
            classes: ['person', 'car'],
        },
    ],
}
```

{% endtab %}
{% endtabs %}

### Detect, crop, then read

The canonical chain: find vehicles, crop each one, find the plate inside it, crop that, and run OCR on the result. Nothing round-trips to your code between stages.

`orientationTargetAngle` straightens the cropped plate before OCR, which is what makes angled plates readable. `topK` keeps only the best plate per vehicle.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import Pop, InferenceComponent, CropForward

pop = Pop(components=[
    InferenceComponent(
        ability="eyepop.vehicle:latest",
        categoryName="vehicles",
        confidenceThreshold=0.8,
        forward=CropForward(
            includeClasses=["car", "truck"],
            targets=[
                InferenceComponent(
                    ability="eyepop.vehicle.license-plate:latest",
                    topK=1,
                    forward=CropForward(
                        orientationTargetAngle=0.0,
                        boxPadding=0.1,
                        targets=[
                            InferenceComponent(
                                ability="eyepop.text.recognize.landscape:latest",
                                categoryName="license-plate",
                            ),
                        ],
                    ),
                ),
            ],
        ),
    ),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { ForwardOperatorType, PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.vehicle:latest',
            categoryName: 'vehicles',
            confidenceThreshold: 0.8,
            forward: {
                operator: {
                    type: ForwardOperatorType.CROP,
                    includeClasses: ['car', 'truck'],
                },
                targets: [
                    {
                        type: PopComponentType.INFERENCE,
                        ability: 'eyepop.vehicle.license-plate:latest',
                        topK: 1,
                        forward: {
                            operator: {
                                type: ForwardOperatorType.CROP,
                                crop: { orientationTargetAngle: 0.0, boxPadding: 0.1 },
                            },
                            targets: [
                                {
                                    type: PopComponentType.INFERENCE,
                                    ability: 'eyepop.text.recognize.landscape:latest',
                                    categoryName: 'license-plate',
                                },
                            ],
                        },
                    },
                ],
            },
        },
    ],
}
```

{% endtab %}
{% endtabs %}

### Track people across frames

Tracking hangs off the detector whose objects it should follow. Naming a re-identification ability adds appearance matching, so a person who is briefly occluded keeps their `trackId` instead of becoming a new object.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import (
    Pop, InferenceComponent, TrackingComponent, CropForward, MotionModel,
)

pop = Pop(components=[
    InferenceComponent(
        ability="eyepop.person:latest",
        categoryName="people",
        forward=CropForward(targets=[
            TrackingComponent(
                reidModel="eyepop.person.reid:latest",
                maxAgeSeconds=5.0,
                motionModel=MotionModel.CONSTANT_VELOCITY,
                simThreshold=0.6,
            ),
        ]),
    ),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { ForwardOperatorType, MotionModel, PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.person:latest',
            categoryName: 'people',
            forward: {
                operator: { type: ForwardOperatorType.CROP },
                targets: [
                    {
                        type: PopComponentType.TRACKING,
                        reidModel: 'eyepop.person.reid:latest',
                        maxAgeSeconds: 5.0,
                        motionModel: MotionModel.CONSTANT_VELOCITY,
                        simThreshold: 0.6,
                    },
                ],
            },
        },
    ],
}
```

{% endtab %}
{% endtabs %}

### Hide a stage the caller never asked for

Facial expression analysis needs a face detector in front of it, but the caller wants expressions attached to people — not a separate list of face boxes. Marking the face detector `hidden` keeps its output out of the response while still feeding the stage below it, and because it produces object detections, the expression results attach to the enclosing person.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import Pop, InferenceComponent, CropForward

pop = Pop(components=[
    InferenceComponent(
        ability="eyepop.person:latest",
        categoryName="people",
        forward=CropForward(targets=[
            InferenceComponent(
                ability="eyepop.person.face.short-range:latest",
                hidden=True,
                forward=CropForward(targets=[
                    InferenceComponent(ability="eyepop.expression:latest"),
                ]),
            ),
        ]),
    ),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { ForwardOperatorType, PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.person:latest',
            categoryName: 'people',
            forward: {
                operator: { type: ForwardOperatorType.CROP },
                targets: [
                    {
                        type: PopComponentType.INFERENCE,
                        ability: 'eyepop.person.face.short-range:latest',
                        hidden: true,
                        forward: {
                            operator: { type: ForwardOperatorType.CROP },
                            targets: [
                                {
                                    type: PopComponentType.INFERENCE,
                                    ability: 'eyepop.expression:latest',
                                },
                            ],
                        },
                    },
                ],
            },
        },
    ],
}
```

{% endtab %}
{% endtabs %}

### Segment, then trace an outline

A segmentation mask is a per-pixel result. A contour finder turns it into a polygon your application can draw or measure. The finder takes a `full` forward, because it works on the mask the segmenter produced rather than on a new crop.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import (
    Pop, InferenceComponent, ContourFinderComponent, ContourType,
    CropForward, FullForward,
)

pop = Pop(components=[
    InferenceComponent(
        ability="eyepop.person:latest",
        forward=CropForward(targets=[
            InferenceComponent(
                ability="eyepop.person.segment:latest",
                forward=FullForward(targets=[
                    ContourFinderComponent(contourType=ContourType.POLYGON),
                ]),
            ),
        ]),
    ),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { ContourType, ForwardOperatorType, PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.person:latest',
            forward: {
                operator: { type: ForwardOperatorType.CROP },
                targets: [
                    {
                        type: PopComponentType.INFERENCE,
                        ability: 'eyepop.person.segment:latest',
                        forward: {
                            operator: { type: ForwardOperatorType.FULL },
                            targets: [
                                {
                                    type: PopComponentType.CONTOUR_FINDER,
                                    contourType: ContourType.POLYGON,
                                },
                            ],
                        },
                    },
                ],
            },
        },
    ],
}
```

{% endtab %}
{% endtabs %}

### Count objects inside one mask

When a segmenter returns a single mask covering many touching objects, a component finder splits it into separate sub-objects. `erode` shrinks the mask first, breaking the thin bridges between objects that are really separate — here by a kernel 20% of the mask's own size. See [How `erode` and `dilate` reshape the mask](https://docs.eyepop.ai/platform/pop/pop-components/mask-operations.md#how-erode-and-dilate-reshape-the-mask) for combining it with `dilate`.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import (
    Pop, InferenceComponent, ComponentFinderComponent, FullForward,
)

pop = Pop(components=[
    InferenceComponent(
        abilityUuid="066ae8f1fc0174138000cb8bcfaaaaaa",
        categoryName="colonies",
        forward=FullForward(targets=[
            ComponentFinderComponent(
                componentClassLabel="colony",
                erode=0.2,
                keepSource=False,
            ),
        ]),
    ),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { ForwardOperatorType, PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            abilityUuid: '066ae8f1fc0174138000cb8bcfaaaaaa',
            categoryName: 'colonies',
            forward: {
                operator: { type: ForwardOperatorType.FULL },
                targets: [
                    {
                        type: PopComponentType.COMPONENT_FINDER,
                        componentClassLabel: 'colony',
                        erode: 0.2,
                        keepSource: false,
                    },
                ],
            },
        },
    ],
}
```

{% endtab %}
{% endtabs %}

### Find anything, then ask about it

An [open-vocabulary](https://docs.eyepop.ai/platform/abilities/open-vocabulary.md) detector takes its target through `params.prompts` rather than a fixed label set, and an open-vocabulary classifier downstream answers a question about each crop. The classifier's prompts are the candidate answers; `label` keeps the reported class short.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import Pop, InferenceComponent, CropForward

pop = Pop(components=[
    InferenceComponent(
        ability="eyepop.sam3.detect:latest",
        categoryName="forklifts",
        params={"prompts": [{"prompt": "forklift"}]},
        forward=CropForward(targets=[
            InferenceComponent(
                ability="eyepop.siglip2.classify:latest",
                params={"prompts": [
                    {"prompt": "a forklift carrying a load", "label": "loaded"},
                    {"prompt": "a forklift with empty forks", "label": "empty"},
                ]},
                topKClasses=1,
            ),
        ]),
    ),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { ForwardOperatorType, PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.sam3.detect:latest',
            categoryName: 'forklifts',
            params: { prompts: [{ prompt: 'forklift' }] },
            forward: {
                operator: { type: ForwardOperatorType.CROP },
                targets: [
                    {
                        type: PopComponentType.INFERENCE,
                        ability: 'eyepop.siglip2.classify:latest',
                        params: {
                            prompts: [
                                { prompt: 'a forklift carrying a load', label: 'loaded' },
                                { prompt: 'a forklift with empty forks', label: 'empty' },
                            ],
                        },
                        topKClasses: 1,
                    },
                ],
            },
        },
    ],
}
```

{% endtab %}
{% endtabs %}

For a question that needs reasoning or reading, swap the classifier for a VLM such as `eyepop.qwen3.classify:latest`: slower, but able to answer what a contrastive classifier cannot. See [Which one to pick](https://docs.eyepop.ai/platform/abilities/open-vocabulary.md#which-one-to-pick).

### Run two analyses side by side

Top-level components run in parallel on the full frame. Use this when a Pop needs two unrelated answers about the same media rather than a chain.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import Pop, InferenceComponent, CropForward

pop = Pop(components=[
    InferenceComponent(
        ability="eyepop.person:latest",
        categoryName="people",
        forward=CropForward(targets=[
            InferenceComponent(ability="eyepop.person.2d-body-points:latest"),
        ]),
    ),
    InferenceComponent(
        ability="eyepop.text:latest",
        categoryName="signage",
    ),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { ForwardOperatorType, PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.person:latest',
            categoryName: 'people',
            forward: {
                operator: { type: ForwardOperatorType.CROP },
                targets: [
                    {
                        type: PopComponentType.INFERENCE,
                        ability: 'eyepop.person.2d-body-points:latest',
                    },
                ],
            },
        },
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.text:latest',
            categoryName: 'signage',
        },
    ],
}
```

{% endtab %}
{% endtabs %}

### Always return something

`crop_with_full_fallback` runs the downstream stage on each detection when the parent found objects, and on the whole frame when it found none — so media that defeats the first stage still produces an answer.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop.worker.worker_types import Pop, InferenceComponent, CropForward

pop = Pop(components=[
    InferenceComponent(
        ability="eyepop.person:latest",
        forward=CropForward(
            is_full_fallback=True,
            targets=[
                InferenceComponent(
                    ability="eyepop.clipv2.classify:latest",
                    params={"prompts": [
                        {"prompt": "a person indoors", "label": "indoors"},
                        {"prompt": "a person outdoors", "label": "outdoors"},
                    ]},
                ),
            ],
        ),
    ),
])
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { ForwardOperatorType, PopComponentType } from '@eyepop.ai/eyepop'

const pop = {
    components: [
        {
            type: PopComponentType.INFERENCE,
            ability: 'eyepop.person:latest',
            forward: {
                operator: { type: ForwardOperatorType.CROP_WITH_FULL_FALLBACK },
                targets: [
                    {
                        type: PopComponentType.INFERENCE,
                        ability: 'eyepop.clipv2.classify:latest',
                        params: {
                            prompts: [
                                { prompt: 'a person indoors', label: 'indoors' },
                                { prompt: 'a person outdoors', label: 'outdoors' },
                            ],
                        },
                    },
                ],
            },
        },
    ],
}
```

{% endtab %}
{% endtabs %}

### Next steps

* [Components](https://docs.eyepop.ai/platform/pop/pop-components.md) — every component type and attribute
* [Forwarding](https://docs.eyepop.ai/platform/pop/pop-forwarding.md) — how components chain
* [Sources and Options](https://docs.eyepop.ai/platform/sources-and-options.md) — what you can submit to a Pop, and the settings that shape processing
* [Composable Pops for Python](https://docs.eyepop.ai/sdks/python/composable-pops.md) and [for Node](https://docs.eyepop.ai/sdks/node/composable-pops.md) — constructing these Pops in each language


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eyepop.ai/platform/pop/pop-examples.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
