Detect vehicles
Identify cars in a forward-facing dashcam stream using a pretrained detection model.
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.
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.
Identify cars in a forward-facing dashcam stream using a pretrained detection model.
Use bounding-box geometry to mark frames in which a detected vehicle appears large and low in the image.
Produce an annotated recording and a clear account of what the rule can—and cannot—establish.
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.
H.264 video input
Parser, decoder, stream mux
Vehicle bounding boxes via nvinfer
Inspect objects and evaluate the rule
OSD annotations and 0/1 frame signals
Core components: filesrc → h264parse → nvv4l2decoder → nvstreammux → nvinfer → nvdsosd → nvvideoconvert → encoder
Bounding boxes and object labels make the model’s detections inspectable in the recorded output.
A custom metadata probe maps one or more detected objects into a single binary decision for each frame.
The project uses an explicit, interpretable rule. It does not estimate physical distance or time-to-collision.
# 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.
The car’s bounding box is wider than 30% of the frame.
The bottom of its box extends below 90% of the frame height.
One potential-event indicator per frame.
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 files: ../assets/projects/realtime-video/. If playback fails, check file names, MP4 browser compatibility and local server paths.
The work combines a GPU-oriented video pipeline, a transparent event rule and reproducible offline inspection tools.
Connect decoding, batching, inference, overlays and video output as a single processing chain.
Use the TAO-pretrained DashCamNet model for dashcam-perspective object detection.
Read detected object metadata and apply per-frame decision logic.
Inspect resolution, duration, frame rate and frame counts for source and output.
Support frame-flag analysis and contiguous-event summaries when an authentic inference log is available.
Separate offline tests and reporting from GPU inference requirements and model assets.
The video comparison and file metadata document the recorded output. They do not by themselves establish real-time throughput, model accuracy or deployment readiness.
Both recordings are documented as 1280 × 720, 59.94 FPS, 2,406 frames and approximately 40.14 seconds.
The supplied output video displays car bounding boxes and labels over the dashcam footage.
Running the inference pipeline requires a compatible Linux, DeepStream, GStreamer and PyDS environment plus the model weights.
No validated tailgating precision, recall, physical-distance accuracy or end-to-end real-time benchmark is claimed.
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.
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.
I learned how decoding, GPU inference, metadata access, overlays and encoding must cooperate. A correct detector alone does not make a functioning video application.
Using DashCamNet required understanding model configuration, input processing and how detections become available to the rest of the pipeline.
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.
I learned to separate recorded demo evidence and offline tooling from claims that would require fresh GPU runs, benchmark measurements and real-world validation.
They need a reliable processing flow, a well-defined interpretation of model outputs, transparent limitations and a path to meaningful evaluation.
Project documentation describes the pipeline, model dependencies, offline inspection utilities and the limits of the available evidence.
DeepStream pipeline source, tailgating rule, tests, setup guidance and technical report.
View Repository ↗Learn more about the technologies used in this case study.
DeepStream documentation ↗DashCamNet model ↗