At Arya Omnitalk, I worked on an edge computer vision system that processes 30 frames per second from highway cameras, identifies every passing vehicle, tracks its velocity vector across consecutive frames, reads its license plate, and generates an automated fine citation—all within 200 milliseconds. A vehicle cruising at 120 km/h travels 33.3 meters per second. If our edge pipeline incurs even half a second of processing jitter, the vehicle has vanished from the camera's optical focal zone.
This is the engineering story behind VIDES (Video Incident Detection and Enforcement System), the production module I helped build for Highway Traffic Management Systems (HTMS). It is currently active on major Indian expressways, automating over 5,000 challans per month and alerting emergency patrol units to stationary accidents within 15 seconds.
1. The Need for Speed (and Accuracy)
Detecting a car on a sunny day in light traffic is trivial. Detecting a vehicle in pouring monsoon rain, at 2:00 AM, while partially occluded behind a heavy freight container truck at 130 km/h? That is an entirely different engineering challenge:
Truck Shadowing
High-profile trucks hide smaller passenger vehicles for 2–3 seconds. DeepSORT appearance embeddings must maintain consistent track IDs when vehicles emerge from occlusion blind spots.
High-Velocity Shutter Control
At 120 km/h, standard 1/30s consumer exposure speeds smear license plates into illegible white streaks. Gantry hardware required high-speed 1/500s global shutters synchronized with pulsed IR strobes.
Specular Road Reflections
Headlights reflecting off wet asphalt generate phantom vehicle bounding boxes. We deployed temporal median consistency filters across 5 frames to suppress transient false detections.
Nighttime Color Loss
Nighttime 850nm infrared illumination strips color information. Standard OCR pipelines trained on daytime RGB plates fail completely on IR greyscale without specialized domain fine-tuning.
2. The VIDES Pipeline: Edge-Heavy, Cloud-Light
To eliminate the massive bandwidth costs of streaming hundreds of raw 1080p RTSP feeds across cellular uplinks, we architected a split-compute pipeline: heavy compute (YOLOv8 detection, DeepSORT tracking, and speed estimation) runs locally on NVIDIA Jetson Xavier NX edge devices mounted directly to the highway gantry. Only verified violation crops (under 40 KB each) are encrypted and uploaded upstream for OCR and database dispatch.
VIDES Edge-to-Cloud Distributed Processing Pipeline
- STAGE 01 120 FPS Shutter High-speed RTSP feed into Jetson Xavier
- STAGE 02 YOLOv8 TensorRT FP16 inference detecting chassis bounding boxes
- STAGE 03 DeepSORT Track Kalman filter tracking & speed estimation
- STAGE 04 Violation Logic 3-frame confirmation of >120 km/h or stoppage
- STAGE 05 Encrypted Crop 40 KB license plate crop uplink over 4G
- STAGE 06 ANPR & Challan Tesseract OCR + Regional Transport DB sync
3. YOLOv8 + DeepSORT: The Golden Pair
We evaluated four detector architectures before standardizing on YOLOv8. The deciding criterion was not just mAP on validation benchmarks, but sustainable 30 FPS inference within the Xavier NX's 20W power envelope:
| Model Architecture | mAP@0.5 | FPS (Xavier NX) | Model Size | Production Verdict |
|---|---|---|---|---|
| YOLOv5s | 0.88 | 45 FPS | 14 MB | High speed, but missed distant motorcycles |
| YOLOv8m (Selected) | 0.92 | 30 FPS | 52 MB | Optimal trade-off: 30 FPS at 0.92 mAP |
| Faster R-CNN | 0.94 | 8 FPS | 167 MB | Unusable for real-time video stream |
| YOLOv8l | 0.93 | 18 FPS | 83 MB | 1% mAP gain, but cut frame rate in half |
4. Positional Speed Estimation Implementation
Converting 2D pixel displacements into real-world kilometers per hour requires camera calibration and homography projection. To eliminate camera vibration noise, speed is computed across a rolling 5-frame window and requires 3 consecutive violation frames before triggering an ANPR crop:
import numpy as np
from collections import defaultdict
from typing import Optional, Tuple
vehicle_history = defaultdict(list)
PIXEL_METER_RATIO = 0.045 # Calibrated per gantry geometry using known road markings
def calculate_speed(track_id: int, bbox_center: Tuple[int, int], timestamp: float, fps: int = 30) -> Optional[float]:
"""Calculates vehicle speed using positional displacement over time."""
vehicle_history[track_id].append((bbox_center, timestamp))
# Require at least 5 frames to dampen optical sensor jitter
if len(vehicle_history[track_id]) < 5:
return None
prev_pos, prev_time = vehicle_history[track_id][-5]
curr_pos, curr_time = bbox_center, timestamp
# Euclidean pixel displacement converted to meters
dx = curr_pos[0] - prev_pos[0]
dy = curr_pos[1] - prev_pos[1]
pixel_dist = np.sqrt(dx**2 + dy**2)
meter_dist = pixel_dist * PIXEL_METER_RATIO
dt = (curr_time - prev_time) or (5.0 / fps)
speed_kmh = (meter_dist / dt) * 3.6
# Reject physical outliers caused by bounding box re-identification jumps
if speed_kmh > 240.0:
return None
return round(speed_kmh, 1)
def check_violation(track_id: int, speed: Optional[float], speed_limit: float = 120.0) -> bool:
"""Confirms speeding violation only after 3 consecutive frame triggers."""
if speed and speed > speed_limit:
vehicle_history[track_id].append(('violation', speed))
violations = [h for h in vehicle_history[track_id][-3:] if h[0] == 'violation']
if len(violations) >= 3:
return True # 100% verified violation → trigger license plate crop
return False
5. High-Speed ANPR Pipeline at 120 km/h
A false plate read results in wrongful citations. We implemented an adaptive preprocessing pipeline: bilinear scaling, adaptive Gaussian thresholding, morphological noise removal, and affine deskewing:
import cv2
import numpy as np
import pytesseract
import re
from typing import Tuple
def preprocess_plate(crop: np.ndarray) -> np.ndarray:
"""Enhances license plate crop for high-confidence OCR."""
# 1. Normalize dimensions
resized = cv2.resize(crop, (300, 80), interpolation=cv2.INTER_CUBIC)
gray = cv2.cvtColor(resized, cv2.COLOR_BGR2GRAY)
# 2. Adaptive thresholding handles shadows and glare
thresh = cv2.adaptiveThreshold(
gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
cv2.THRESH_BINARY, 11, 2
)
# 3. Morphological opening removes salt-and-pepper noise
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
clean = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel)
return clean
def read_plate(crop: np.ndarray, confidence_threshold: int = 85) -> Tuple[str, bool]:
"""Executes OCR with regex format validation (XX 00 XX 0000)."""
processed = preprocess_plate(crop)
config = '--oem 3 --psm 7 -c tessedit_char_whitelist=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '
result = pytesseract.image_to_data(processed, config=config, output_type=pytesseract.Output.DICT)
text = ' '.join([
result['text'][i] for i in range(len(result['text']))
if int(result['conf'][i]) > confidence_threshold
]).strip()
# Validate against national standard vehicle plate regex pattern
pattern = r'^[A-Z]{2}\s?\d{2}\s?[A-Z]{1,3}\s?\d{4}$'
if re.match(pattern, text.replace(' ', '')):
return text, True
return text, False # Flag for human operator review
6. Edge Optimization: PyTorch to TensorRT FP16
Running raw PyTorch models on the Jetson Xavier yielded only 12 FPS. Converting the model to TensorRT with FP16 quantization delivered a 2.5x speedup, reaching our 30 FPS target at only 20W power consumption:
7. Accident Detection: Saving Lives in 15 Seconds
While speed ticketing captures headlines, the most critical life-safety function is stationary vehicle incident detection. A broken-down car or crash in a live lane at 120 km/h is a lethal hazard.
- Velocity Below 15 km/h Identifies sudden deceleration compared to baseline traffic flow
- Stationary Duration > 10s Eliminates false alarms from stop-and-go congestion
- Live Lane Boundary Confirmation Differentiates dangerous live-lane breakdowns from safe shoulder stops
8. Night Vision & Adverse Weather Engineering
Over 40% of fatal collisions occur between 10:00 PM and 6:00 AM. To maintain high accuracy without ambient street lighting:
Infrared Active Illumination
Pulsed 850nm infrared illuminators flood the lane. We retrained OCR backbones on 50,000 synthetic and captured IR plate crops, achieving 93.1% night OCR precision.
Precipitation Filtering
Rain streaks reflect vehicle headlights. A 5-frame temporal median filter strips transient artifacts. In heavy fog, detection confidence thresholds automatically increase from 0.5 to 0.7.
9. Real-World Impact Across 12 Months
- Client / Deployment
- Arya Omnitalk • Major Indian Expressways & HTMS Corridors
- Stack
- YOLOv8, DeepSORT, TensorRT FP16, PyTesseract, OpenCV, Jetson Xavier NX, RTSP
- Role
- Computer Vision & System Architect