> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/developer-documentation/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/developer-documentation/platform/temporal-context/example-car-make-and-model.md).

# Example: Make and Model Insights from Car Drive-Bys

Name the make, model and color of every car entering and leaving a drive-through, with one VLM call per car

A drive-through camera sees every car for several seconds, on its way in and on its way out. In this example you build a Pop that detects and tracks vehicles on every frame, picks the clearest view of each car, and asks a vision-language model for its make, model and color — once per car, not once per frame. A custom VLM ability with a JSON response schema makes every answer come back as the same three fields, and the tracks tell which cars are entering and which are leaving.

The example video shows ten cars: five drive up the lane by the pickup window into the drive-through, five come back down the other side of the island on their way out. Its camera angle is deliberately a hard one: the menu board and the planted island hide the cars on their way out, cars enter and leave through the edges of the frame half cut off, and most of the time a car is seen from above or from behind. Most frames of a car are poor views of it, which is exactly what the relevancy algorithm is there to see past.

The complete, runnable example is in the Python SDK repository, under [`examples/temporal_context`](https://github.com/eyepop-ai/eyepop-sdk-python/tree/main/examples/temporal_context), together with the video. The steps below build it piece by piece.

<figure><img src="https://1956543008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2tRktyRCGgE1tPlAfT4h%2Fuploads%2Fgit-blob-47ea91787e4eada290e7535cc3fcf790c2c75d99%2Ftemporal-context-drive-through.webp?alt=media" alt="The example video, played at twice its speed: ten cars, five driving in by the pickup window and five leaving on the far side of the island"><figcaption><p>The example video at 2× speed. The video and every car in it are generated.</p></figcaption></figure>

### Before you start

* Python SDK **3.24.0** or newer, and an [API key](https://docs.eyepop.ai/developer-documentation/api-keys.md) in `EYEPOP_API_KEY`.
* The [EyePop CLI](https://docs.eyepop.ai/developer-documentation/cli.md), signed in, to look up your account.
* The example code and video:

```bash
git clone https://github.com/eyepop-ai/eyepop-sdk-python.git
cd eyepop-sdk-python/examples/temporal_context
pip install "eyepop>=3.24.0"
```

### Step 1: Find your account and namespace

A custom ability belongs to an account and is named under one of its namespaces. The CLI lists both:

```bash
eyepop get accounts --format text
eyepop get accounts <account-uuid>
```

The second command prints the account's `namespaces`. The ability you create next is called `<namespace>.describe.vehicle-make-model`.

### Step 2: Create the make-and-model ability

A [VLM ability](https://docs.eyepop.ai/developer-documentation/platform/abilities/user-defined-vlm-tasks.md) is a prompt, a backing model and image settings. A **response schema** constrains the model's answer to a JSON object of the shape you define, and the parsed object comes back on the prediction's `details`. Here, three required strings:

```python
from openapi_pydantic import Schema

RESPONSE_SCHEMA = Schema.model_validate({
    "type": "object",
    "properties": {
        "make": {"type": "string", "description": "Manufacturer, e.g. Toyota"},
        "model": {"type": "string", "description": "Model name, e.g. Corolla"},
        "color": {"type": "string", "description": "Main body color, e.g. silver"},
    },
    "required": ["make", "model", "color"],
    "additionalProperties": False,
})
```

The prompt says what to look at and what to do when the image is not enough. Since the ability always runs on one cropped vehicle, seen from a camera above the lane, it can say so:

```python
PROMPT = """You see one vehicle, cropped from a camera mounted above a drive-through lane, so it
may be seen from above, from the front or from behind. Identify its manufacturer (make), its
model name and its main body color. Use every clue: the badge, the grille, the lights and the
shape of the body. A pickup truck, with an open cargo bed, is never an SUV. Name the model line
as precisely as you can, the way a dealer would, for example Tacoma, Ram 1500, Civic or RAV4.
Name the most likely model even when the vehicle is seen from behind, and answer "unknown" only
when the image shows too little of the vehicle to tell."""
```

Create the ability in an ability group, then publish it. Publishing gives it the alias `<namespace>.describe.vehicle-make-model` and tags it `latest`:

```python
from eyepop import EyePopSdk
from eyepop.data.types.vlm import InferRuntimeConfig, VlmAbilityCreate, VlmAbilityGroupCreate

alias = f"{namespace}.describe.vehicle-make-model"
ability = VlmAbilityCreate(
    name=alias,
    description="Names the make, model and color of one cropped vehicle",
    text_prompt=PROMPT,
    response_schema=RESPONSE_SCHEMA,
    config=InferRuntimeConfig(image_size=512, max_new_tokens=100),
    is_public=False,
)

with EyePopSdk.dataEndpoint(account_id=account_uuid) as endpoint:
    group = endpoint.create_vlm_ability_group(VlmAbilityGroupCreate(
        name=alias, description=ability.description, default_alias_name=alias,
    ))
    created = endpoint.create_vlm_ability(create=ability, vlm_ability_group_uuid=group.uuid)
    endpoint.publish_vlm_ability(vlm_ability_uuid=created.uuid, alias_name=alias)
```

In the repository this is `create_make_model_ability.py`, which also reuses the group when you run it again:

```bash
python create_make_model_ability.py --account <account-uuid> --namespace <namespace>
```

The ability leaves out `model`, so it runs on `qwen3`, EyePop's own VLM. Each selection is one cropped image, so a remote model can answer it too: set `model=VlmModel.gemini_4_argon` or `VlmModel.gpt_6_astra` (import `VlmModel` from `eyepop.data.types`) for a slower answer billed per call, which ignores `max_new_tokens`. See [Choosing a model](https://docs.eyepop.ai/developer-documentation/platform/abilities/user-defined-vlm-tasks.md#choosing-a-model).

It prints the alias to use in the Pop, `<namespace>.describe.vehicle-make-model:latest`.

### Step 3: Detect and track vehicles

The efficient side of the Pop runs on every frame. `eyepop.vehicle.medium:latest` finds vehicles, and a `tracking` component gives each one a `trackId` that holds while it crosses the lane:

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

InferenceComponent(
    ability="eyepop.vehicle.medium:latest",
    objectAreaThreshold=0.01,
    forward=CropForward(
        targets=[TrackingComponent(
            agnostic=True,
            classHysteresis=True,
            maxAgeSeconds=2.0,
            forward=...,  # the selection, next
        )],
    ),
)
```

* `objectAreaThreshold=0.01` ignores anything smaller than 1% of the frame, such as cars parked far in the background, so they never become tracks.
* `agnostic=True` keeps a pickup in one track even when the detector calls it a `car` on some frames and a `truck` on others. Without it, each label gets a track of its own, and the same vehicle is selected twice.
* `classHysteresis=True` holds a track's label steady while the detector's label flickers, so a pickup stays a `truck` from frame to frame.
* `maxAgeSeconds=2.0` keeps a car's track for two seconds after the detector last saw it, so a car hidden for a moment by the menu board or the island comes out of it under the same `trackId`.

Cars move along a lane, so trajectory tracking is enough; no re-identification model is needed.

### Step 4: Select the clearest view of each car

The tracking component forwards through `select_crop`, built with `SelectForward`. Without a relevancy model, the most relevant detection is the most confident, largest one that is not cut off by the edge of the frame — the car seen up close and whole:

```python
TrackingComponent(
    agnostic=True,
    classHysteresis=True,
    maxAgeSeconds=2.0,
    forward=SelectForward(
        minTrackLengthSeconds=2.0,
        intervalSeconds=10.0,
        targets=[InferenceComponent(ability=f"{alias}:latest")],
    ),
)
```

* `minTrackLengthSeconds=2.0` ignores anything in view for less than two seconds: a car that only clips the frame, or the remains of a track that broke up as its car drove out of view.
* `intervalSeconds=10.0` reports a car still waiting at the order board after ten seconds, and again later only if a better view turned up. Without it, a car would be named only once it drove off.

See [Select Operators](https://docs.eyepop.ai/developer-documentation/platform/temporal-context/select-operators.md) for exactly how relevance and timing work.

<figure><img src="https://1956543008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2tRktyRCGgE1tPlAfT4h%2Fuploads%2Fgit-blob-787fe8912ea5f1bed3bcfca7561a54d1631d403f%2Ftemporal-context-drive-through-selections.jpg?alt=media" alt="Ten cars from the example video, each cropped from the frame the select operator chose"><figcaption><p>The ten selections from the example video, one per car: what the VLM gets to see. The video and every car in it are generated.</p></figcaption></figure>

### Step 5: Read the answers, and which way each car went

Live predictions arrive for every frame. The VLM's answers arrive later, as selected predictions, each about one car on the past frame that was selected. The structured answer is the `details` of the selected car.

The live predictions are the temporal context on your side too. Each one places every tracked car, so remembering where a track was first and last seen tells which way the car drove: up the frame is away from the camera, into the drive-through; down the frame is on the way out.

```python
def tracked(objects):
    for obj in objects or []:
        if "trackId" in obj:
            yield obj
        yield from tracked(obj.get("objects"))

first_y, last_y = {}, {}
with EyePopSdk.sync_worker(pop=pop) as endpoint:
    job = endpoint.upload("media/drive_through.mp4")
    while result := job.predict():
        if not result.get("selected"):
            # a live prediction, one per frame: remember where each track is
            for obj in tracked(result.get("objects")):
                center = obj["y"] + obj["height"] / 2
                first_y.setdefault(obj["trackId"], center)
                last_y[obj["trackId"]] = center
            continue
        car = result["objects"][0]
        answer = car["details"][0]
        direction = "entering" if last_y[car["trackId"]] < first_y[car["trackId"]] else "exiting"
        print(f"{result['seconds']:7.2f}s  car #{car['trackId']}  {direction}  "
              f"{answer['make']} {answer['model']} ({answer['color']})")
```

A car selected more than once — first at the interval, then with a better view — shares its `trackId` across its selections, so the latest answer replaces the earlier one.

### Run the example

```bash
python drive_through_make_model.py --ability <namespace>.describe.vehicle-make-model:latest
```

It prints one line per selection as it arrives, then how many frames were analyzed live against how many VLM calls it took:

```
   2.33s  car #3   exiting   Chevrolet Silverado 1500 (black)
   1.96s  car #2   entering  Toyota Camry (silver)
  13.33s  car #6   exiting   Subaru Outback (silver)
  12.71s  car #4   entering  Ford F-150 (red)
  22.96s  car #8   exiting   BMW 3 Series (white)
  22.67s  car #7   entering  Honda CR-V (white)
  33.42s  car #11  entering  Tesla Model 3 (Blue)
  34.25s  car #12  exiting   Volkswagen Golf (red)
  44.75s  car #16  exiting   Mazda CX-5 (red)
  43.79s  car #15  entering  Jeep Wrangler (green)

1165 frames analyzed live; 10 VLM calls named 10 cars, 5 entering and 5 exiting.
```

Ten VLM calls instead of 1,165: one per car, each on the view the operator judged best. The lines come in the order the selections are ready, not by time: a car's selection is due when its track ends, and an entering car's track lasts longer than that of the car leaving beside it.

Point `--video` at an `rtsp://` camera instead of the file to run the same Pop on a live drive-through lane; nothing else changes.

### Next steps

* [Example: Best Face-ID Vector from Walk-Bys](https://docs.eyepop.ai/developer-documentation/platform/temporal-context/example-face-id-from-walk-bys.md) — the same pattern with a relevancy model
* [Select Operators](https://docs.eyepop.ai/developer-documentation/platform/temporal-context/select-operators.md) — relevance, timing, and selected predictions in full
* [User defined VLM tasks](https://docs.eyepop.ai/developer-documentation/platform/abilities/user-defined-vlm-tasks.md) — prompts, image size and cost of a VLM ability
* [Sources and Options](https://docs.eyepop.ai/developer-documentation/platform/sources-and-options.md) — live cameras, uploads and frame rates
