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 |
|
For the VLM element itself (gvagenai) and the results shown for every VLM pipeline, see also the
GenAI Use Case.
Prerequisites#
Start ViPPET with the
gpuprofile (orgpu-wslunder WSL) to run the GPU variants. TheCPU_GPUvariant of CV-Triggered VLM always runs the VLM on GPU.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) andOpenGVLab/InternVL2-2B(INT4).
Download the input video. Both pipelines use a sample clip (
dangerous_traffic.mp4andcrosswalk.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:
Video branch:
videoconvert ! fakesink name=default_output_sink. ViPPET replaces this sink with the output selected for the run (saved video or live preview).VLM branch: a leaky
queuewithmax-size-buffers=1drops frames while the VLM is busy, so a slow VLM never slows down the video branch.gvagenaisamples the frames, sends them to the VLM together with the prompt, andgvametapublishwrites one JSON Lines record per answer.gvafpscountersits at the end of this branch, so the reported FPS is the rate of the VLM branch.
GVAGenAI configuration#
Parameter |
Default |
Description |
|---|---|---|
model |
|
Vision-language model that analyzes the frames. |
device |
|
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 |
|
Generation settings of the VLM, as a comma-separated |
frame-rate |
|
Frames per second sampled from the video for the VLM. |
chunk-size |
|
Sampled frames sent to the VLM in one request. One answer is produced per chunk. |
metrics |
|
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#
Open Pipelines, select Alerting VLM and the variant to run.
In Pipeline options, keep Keep pipeline output on, or turn on Enable live preview. Metadata JSON is on by default for VLM pipelines.
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#
gvadetectwithyolo26n(INT8) on CPU detects objects in every frame ofcrosswalk.mp4.A
teesplits the stream into the main branch and the trigger branch.Main branch:
gvawatermarkdraws the detections,gvafpscountermeasures the throughput, and a secondteefeeds:fakesink name=default_output_sink, replaced by the output selected for the run,a recording branch that encodes the annotated video with
openh264enctovideos/output/cv_triggered_vlm.mp4in the shared folder.
Trigger branch: a leaky
queuefeeds the Proximity Trigger element (gvaproximitytrigger_py). It passes a frame only when acarand apersonare close to each other, see Proximity Trigger element.The passed frame is scaled to
796x448RGB, andgvagenaiwithOpenGVLab/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.
gvametaconvertandgvametapublishwrite the answer as JSON Lines, andjpegencwithmultifilesinksaves every analyzed frame asimages/output/vlm_frame_NNNNN.jpegin 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 |
|
|
Label of the first object class, as reported by the detection model. |
class-b |
|
|
Label of the second object class. |
distance |
|
|
Maximum distance in pixels between the box centers of the two objects. |
frames |
|
|
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.