VLM Alerting Use Case#

The VLM Alerting use case combines video analytics with a vision-language model (VLM) that answers a safety question about the scene, for example whether a road user behaves dangerously. ViPPET shows every answer live, next to the output video, so you can check both the quality of the answers and the cost of running the VLM on your hardware.

This guide walks you through two predefined pipelines, both tagged GenAi and Safety and Security:

Pipeline

When the VLM runs

Variants

Alerting VLM

On every chunk of frames sampled at a fixed rate

CPU, GPU

CV-Triggered VLM

Only on frames where object detection finds a car close to a person

CPU_GPU

For the VLM element itself (gvagenai) and the results shown for every VLM pipeline, see also the GenAI Use Case.

Prerequisites#

  1. Start ViPPET with the gpu profile (or gpu-wsl under WSL) to run the GPU variants. The CPU_GPU variant of CV-Triggered VLM always runs the VLM on GPU.

  2. Install the models required by the pipeline. If a model is missing, the pipeline editor opens a dialog that installs all required models in one step:

    • Alerting VLM: google/gemma-3-4b-it (INT4).

    • CV-Triggered VLM: yolo26n (INT8) and OpenGVLab/InternVL2-2B (INT4).

  3. Download the input video. Both pipelines use a sample clip (dangerous_traffic.mp4 and crosswalk.mp4). If the clip is not available yet, the pipeline editor lists it with a Download button. See Videos.

Note

A VLM on CPU needs several gigabytes of memory per stream. A density test of the CPU variant of Alerting VLM can run the pipeline server out of memory and make later runs fail, see Troubleshooting.

Alerting VLM pipeline#

Alerting VLM pipeline workflow#

The pipeline decodes the dangerous_traffic.mp4 clip once and splits it with a tee into two branches:

  1. Video branch: videoconvert ! fakesink name=default_output_sink. ViPPET replaces this sink with the output selected for the run (saved video or live preview).

  2. VLM branch: a leaky queue with max-size-buffers=1 drops frames while the VLM is busy, so a slow VLM never slows down the video branch. gvagenai samples the frames, sends them to the VLM together with the prompt, and gvametapublish writes one JSON Lines record per answer. gvafpscounter sits at the end of this branch, so the reported FPS is the rate of the VLM branch.

GVAGenAI configuration#

Parameter

Default

Description

model

google/gemma-3-4b-it (INT4)

Vision-language model that analyzes the frames.

device

CPU / GPU

Set by the selected variant.

prompt

See below

Question sent to the VLM with every chunk of frames. Keep the Answer Yes or No instruction, because alerts are detected from the first word of the answer.

generation-config

max_new_tokens=128

Generation settings of the VLM, as a comma-separated key=value list.

frame-rate

1

Frames per second sampled from the video for the VLM.

chunk-size

4

Sampled frames sent to the VLM in one request. One answer is produced per chunk.

metrics

true

Adds generation metrics to every answer and enables the VLM metrics chart.

Default prompt:

Can you see any dangerous behavior by road users on the road? Answer Yes or No, and briefly describe the event.

Alerts in the UI#

  1. Open Pipelines, select Alerting VLM and the variant to run.

  2. In Pipeline options, keep Keep pipeline output on, or turn on Enable live preview. Metadata JSON is on by default for VLM pipelines.

  3. Click Run pipeline.

The Video captions panel below the output video lists the VLM answers, newest first. Each entry shows the time of the event, a VLM badge, the prompt and the answer. An answer that starts with Yes is an alert: the entry is highlighted in red and its badge turns red. The list stays visible after the run ends.

Alert highlighting applies to the variants of the Alerting VLM pipeline, including variants you save from it. In other VLM pipelines, the answers are listed without highlighting.

CV-Triggered VLM pipeline#

Running a VLM on every sampled frame is expensive. In the CV-Triggered VLM pipeline, a light object detection model runs on every frame, and the VLM runs only when the detections show a situation worth checking: a car close to a person.

CV-Triggered VLM pipeline workflow#

  1. gvadetect with yolo26n (INT8) on CPU detects objects in every frame of crosswalk.mp4.

  2. A tee splits the stream into the main branch and the trigger branch.

  3. Main branch: gvawatermark draws the detections, gvafpscounter measures the throughput, and a second tee feeds:

    • fakesink name=default_output_sink, replaced by the output selected for the run,

    • a recording branch that encodes the annotated video with openh264enc to videos/output/cv_triggered_vlm.mp4 in the shared folder.

  4. Trigger branch: a leaky queue feeds the Proximity Trigger element (gvaproximitytrigger_py). It passes a frame only when a car and a person are close to each other, see Proximity Trigger element.

  5. The passed frame is scaled to 796x448 RGB, and gvagenai with OpenGVLab/InternVL2-2B (INT4) on GPU answers one question per frame (chunk-size=1):

    Does the car hit a person? Reply with Yes or No, then a period, then one sentence describing what the car and the person are doing.
    
  6. gvametaconvert and gvametapublish write the answer as JSON Lines, and jpegenc with multifilesink saves every analyzed frame as images/output/vlm_frame_NNNNN.jpeg in the shared folder.

The FPS of this pipeline is measured on the main branch, so it shows the detection throughput. The VLM cost appears in the VLM metrics chart and in the device utilization.

Proximity Trigger element#

gvaproximitytrigger_py is a custom Python GStreamer element shipped with ViPPET in vippet/gst_plugins/python/proximity_trigger.py. In Simple View, it is shown as the Proximity Trigger node.

For each frame, the element reads the detections, computes the distance between the box centers of every class-a object and every class-b object, and compares the shortest one with distance. When the objects are close in frames consecutive frames, it passes that one frame downstream and starts counting again. All other frames are dropped, so the VLM branch stays idle while nothing happens.

Parameter

CV-Triggered VLM

Element default

Description

class-a

car

person

Label of the first object class, as reported by the detection model.

class-b

person

bicycle

Label of the second object class.

distance

600

600

Maximum distance in pixels between the box centers of the two objects.

frames

2

2

Consecutive frames in which the objects must be close before a frame is passed.

Every fired trigger appears in the Video captions panel with a Trigger badge, for example Trigger fired at 3.40s: car near person (412 px ≤ 600 px) for 2 consecutive frames, followed by the VLM answer for that frame.

To adapt the pipeline to another scenario, change the detection model, the two classes and the prompt together, and save the result as a new variant. The element works with any detection model whose labels match class-a and class-b. To add your own custom element, see the custom GStreamer plugins README.

Interpreting the results#

While the pipeline runs and after it ends, the test panel shows:

  • Video captions: the trigger events and VLM answers described above.

  • Metadata JSON: the JSON Lines records written by gvametapublish, streamed live.

  • VLM Total Latency Over Time: a chart of the time each VLM request takes. The chart tooltip also shows the time to first token (TTFT) and the time per output token (TPOT).

  • FPS and device utilization: the throughput of the measured branch and the load of CPU, GPU and NPU.

See Step 4 of the GenAI Use Case for details on these views.

To compare hardware, run the same pipeline with different variants, or save a variant with the VLM on another device, and compare the VLM latency together with the answers. A faster VLM answers more chunks or triggers in the same time; a VLM slower than the trigger rate skips triggers, because the leaky queue drops the frames that arrive while it is busy.