>_ Jorge Uc / projects← All projects
~/projects/realtime-video // VIDEO ANALYTICS
◆ Computer visionDeepStreamDashCamNet

From video frames to actionable signals.

AI-Powered Tailgating Detection explores dashcam-based vehicle proximity monitoring. A custom DeepStream pipeline detects vehicles using DashCamNet, overlays detections on video and applies a geometric rule to flag frames that may suggest close following.

ANNOTATED VIDEO / DASHCAMNETRECORDED OUTPUT · NOT LIVE
RESOLUTION720p1280 × 720
FRAME RATE59.94FPS · video metadata
FRAMES2,406Source / output
DURATION40.14sApproximate recording length
01 / PROJECT CONTEXT

Can a dashcam highlight possible close-following events?

In a fleet-safety analytics scenario, manually reviewing every video frame is impractical. This project investigates how object detection and simple visual rules can produce a per-frame signal for later review.

01PERCEPTION

Detect vehicles

Identify cars in a forward-facing dashcam stream using a pretrained detection model.

DASHCAMNET / NVINFER
02INTERPRETATION

Extract a signal

Use bounding-box geometry to mark frames in which a detected vehicle appears large and low in the image.

FRAME-LEVEL HEURISTIC
03EXPLAINABILITY

Keep the evidence visible

Produce an annotated recording and a clear account of what the rule can—and cannot—establish.

VIDEO / DOCUMENTATION
02 / SYSTEM ARCHITECTURE

One stream. Two outputs.

DeepStream and GStreamer connect video decoding, model inference and metadata inspection. The pipeline yields an annotated recording and a frame-level indicator for potential proximity events.

> pipeline.deepstreamSIMPLIFIED ARCHITECTURE
01 / INPUT

Dashcam stream

H.264 video input

02 / DECODE

GStreamer

Parser, decoder, stream mux

03 / INFERENCE

DashCamNet

Vehicle bounding boxes via nvinfer

04 / METADATA

Pad probe

Inspect objects and evaluate the rule

05 / OUTPUT

Video + flags

OSD annotations and 0/1 frame signals

Core components: filesrc → h264parse → nvv4l2decoder → nvstreammux → nvinfer → nvdsosd → nvvideoconvert → encoder

OUTPUT A / VISUAL

Annotated video

Bounding boxes and object labels make the model’s detections inspectable in the recorded output.

OUTPUT B / STRUCTURED

Per-frame flags

A custom metadata probe maps one or more detected objects into a single binary decision for each frame.

03 / DECISION RULE

Turning bounding boxes into a binary event.

The project uses an explicit, interpretable rule. It does not estimate physical distance or time-to-collision.

> src/tailgating.pyGEOMETRIC HEURISTIC
# Potential close-following visual cue
potential_tailgating = (
    box.width > 0.30 * frame_width
    and
    (box.top + box.height) > 0.90 * frame_height
)

For each frame: 1 if any detected car satisfies the rule; otherwise 0. Multiple cars do not produce multiple flags for the same frame.

HOW TO READ IT
> 30%

The car’s bounding box is wider than 30% of the frame.

> 90%

The bottom of its box extends below 90% of the frame height.

0 / 1

One potential-event indicator per frame.

Important distinction. A large, low-positioned vehicle may be visually close, but perspective, camera placement and object scale affect this cue. The flag is a screening heuristic—not proof of unsafe tailgating, a measured following distance or a collision-risk prediction.
04 / VIDEO EVIDENCE

See the same drive, before and after inference.

Compare the original dashcam recording with the annotated result. Both files are local assets of this portfolio page; playback is independent, and the synchronization control can align them.

> video.compare
01 / SOURCEassessment_stream.mp4
Original forward-facing dashcam feed, without detection overlays.
02 / ANNOTATED OUTPUTcarros.mp4
Recorded result with car detection boxes and labels rendered over the stream.

Video files: ../assets/projects/realtime-video/. If playback fails, check file names, MP4 browser compatibility and local server paths.

05 / ENGINEERING

What went into the project.

The work combines a GPU-oriented video pipeline, a transparent event rule and reproducible offline inspection tools.

01 / VIDEO PIPELINE

GStreamer integration

Connect decoding, batching, inference, overlays and video output as a single processing chain.

02 / PRETRAINED MODEL

DashCamNet configuration

Use the TAO-pretrained DashCamNet model for dashcam-perspective object detection.

03 / METADATA

Custom pad probe

Read detected object metadata and apply per-frame decision logic.

04 / VIDEO INSPECTION

FFmpeg / ffprobe

Inspect resolution, duration, frame rate and frame counts for source and output.

05 / ANALYSIS

Event summaries

Support frame-flag analysis and contiguous-event summaries when an authentic inference log is available.

06 / REPRODUCIBILITY

Tests and documentation

Separate offline tests and reporting from GPU inference requirements and model assets.

06 / EVIDENCE & LIMITATIONS

What the available evidence supports.

The video comparison and file metadata document the recorded output. They do not by themselves establish real-time throughput, model accuracy or deployment readiness.

✓ VIDEO METADATA

Matching recordings

Both recordings are documented as 1280 × 720, 59.94 FPS, 2,406 frames and approximately 40.14 seconds.

✓ VISUAL EVIDENCE

Annotated detections

The supplied output video displays car bounding boxes and labels over the dashcam footage.

◇ IMPLEMENTATION SCOPE

GPU runtime requirements

Running the inference pipeline requires a compatible Linux, DeepStream, GStreamer and PyDS environment plus the model weights.

◇ NOT ESTABLISHED

Safety performance

No validated tailgating precision, recall, physical-distance accuracy or end-to-end real-time benchmark is claimed.

Reproducibility note. The public repository documents a reconstructed pipeline and supporting offline tools. The GPU inference path requires a compatible DeepStream environment. Training materials and pretrained model assets remain subject to their respective licenses.
07 / PERSONAL RETROSPECTIVE

What I learned building a video AI pipeline.

Beyond running a detector, this project taught me to connect low-level video processing with interpretable application logic—and to distinguish an impressive visualization from a validated safety metric.

BEYOND THE BOUNDING BOX

A detection is not yet a decision. The interesting engineering work begins when model output becomes structured metadata, a clearly defined rule and evidence that another person can inspect.

01 / VIDEO SYSTEMS

Video AI is a pipeline, not a single model

I learned how decoding, GPU inference, metadata access, overlays and encoding must cooperate. A correct detector alone does not make a functioning video application.

DeepStreamGStreamerH.264
02 / MODEL INTEGRATION

Pretrained models still need careful integration

Using DashCamNet required understanding model configuration, input processing and how detections become available to the rest of the pipeline.

TAO ToolkitDashCamNetnvinfer
03 / INTERPRETABLE LOGIC

Simple heuristics can be useful—if their limits are explicit

Converting object boxes into one flag per frame made the task understandable and testable, while showing why visual proximity should not be confused with measured following distance.

Bounding boxesMetadataRules
04 / EVIDENCE & DEPLOYMENT

Document what was actually verified

I learned to separate recorded demo evidence and offline tooling from claims that would require fresh GPU runs, benchmark measurements and real-world validation.

TestingFFprobeReproducibility
KEY TAKEAWAY

Useful computer vision systems need more than visible detections.

They need a reliable processing flow, a well-defined interpretation of model outputs, transparent limitations and a path to meaningful evaluation.

08 / RESOURCES

Explore the implementation.

Project documentation describes the pipeline, model dependencies, offline inspection utilities and the limits of the available evidence.

PROJECT REPOSITORY

Source code & documentation

DeepStream pipeline source, tailgating rule, tests, setup guidance and technical report.

View Repository ↗