NeuroDrive-Vision ๐๐ก is an AI-powered lane detection and road perception system engineered to replicate the core vision intelligence of autonomous vehicles.
It brings together the precision of classical computer vision and the robustness of modern modular architecture, enabling both real-time performance and research-grade extensibility.
The goal of NeuroDrive-Vision is not just to detect lanes โ but to perceive the road like a driver would, using a structured vision pipeline that interprets motion, geometry, and perspective in a consistent, explainable way.
Each stage of the system works as an intelligent, pluggable module that you can enhance, swap, or train for different environments (urban roads, highways, or race tracks).
This makes the framework perfect for:
- ๐ฌ Research & prototyping of autonomous driving perception stacks
- ๐๏ธ Real-time applications for road boundary detection
- ๐งฉ Educational demonstrations in AI, OpenCV, and perception systems
| ๐ก Feature | ๐งพ Description |
|---|---|
| โ๏ธ End-to-End Pipeline | From raw frame to annotated lane overlay โ each step modularized and independently testable. |
| ๐งฉ Adaptive ROI Mapping | Automatically adjusts to different video resolutions and camera perspectives. |
| ๐ง Exponential Smoothing (EMA) | Maintains lane stability by learning temporal motion between frames. |
| ๐ Real-Time Performance | Optimized OpenCV operations achieve 30โ60 FPS on modern CPUs. |
| ๐ Dual Interface Support | Command-Line (CLI) for automation and Gradio Web App for live visual demos. |
| ๐ฆ Dockerized Deployment | Build once, deploy anywhere โ consistent behavior across environments. |
| ๐งฐ Research-Grade Modularity | Every component is decoupled, documented, and open for fine-tuning or replacement. |
- ๐งฉ Python 3.11+ for modern type-safe design
- ๐งฎ NumPy for high-speed numerical computation
- ๐๏ธ OpenCV for robust image transformation and edge processing
- ๐ป Gradio for web-based visualization and user interaction
- ๐งฑ Docker for deployment and scalability
๐ง Developed with โค๏ธ by mwasifanwar
๐ A vision system that learns, adapts, and drives.
The architecture of NeuroDrive-Vision is designed for clarity, extensibility, and real-time flow. Each module performs a focused task and hands off its output to the next โ resulting in a clean and efficient processing pipeline.
๐ฆ 1. Frontend Layer
- ๐ฅ๏ธ CLI Interface: Enables headless operation for batch video processing and automation.
- ๐ Gradio Web Demo: Provides a user-friendly browser interface for real-time experimentation.
- ๐ฌ Both interfaces invoke the same backend pipeline ensuring identical detection logic.
โ๏ธ 2. Core Processing Layer
- ๐งฉ The heart of the system, where all computer vision operations happen.
- Comprised of modular stages:
- ๐ฃ Edge Detection (Canny Algorithm) โ Extracts fine boundaries and gradients from raw frames.
- ๐ข Region of Interest (ROI) Extraction โ Masks irrelevant regions, focusing on lane-relevant areas.
- ๐ก Probabilistic Hough Transform โ Converts edge data into line candidates using polar coordinates.
- ๐ต Line Grouping & Averaging โ Filters and merges left/right lane boundaries.
- ๐ Exponential Smoothing (EMA) โ Stabilizes detection across time for a fluid driving experience.
๐งฐ 3. Shared Utilities & Configuration
- ๐งพ Config Manager โ Stores and handles parameters (thresholds, kernel sizes, ROI shapes, etc.).
- ๐พ Input/Output Helpers โ Manage frame capture, video writing, and batch processing.
- โ๏ธ Tracker Module (EMA-based) โ Tracks lane continuity between consecutive frames.
- ๐งฎ Math & Geometry Utilities โ Support transformations and vector calculations.
๐ฆ 4. Output & Visualization
- ๐ฅ Annotated video frames with smooth blue lane overlays.
- ๐ Optional visualization of each processing stage (edges, ROI, smoothed lanes).
- ๐ Displayed interactively via Gradio or saved locally.
| ๐ข Step | ๐ง Process | ๐ฏ Output |
|---|---|---|
| 1๏ธโฃ | Raw frame input via OpenCV | RGB frame |
| 2๏ธโฃ | Canny Edge Detection | Binary edge map |
| 3๏ธโฃ | Region of Interest Extraction | Masked edge image |
| 4๏ธโฃ | Hough Transform | Line segments |
| 5๏ธโฃ | Line Averaging & Filtering | Merged lane candidates |
| 6๏ธโฃ | Exponential Smoothing | Stable, smoothed lanes |
| 7๏ธโฃ | Overlay Rendering | Annotated driving frame |
๐ฌ "Each module in the NeuroDrive pipeline is designed to think like a neuron โ specialized, fast, and connected."
- ๐ง Parallelizable โ Future GPU or TensorRT integration ready.
- ๐งฉ Plug-and-Play Modules โ Swap Canny with Sobel, or add a DNN-based lane segmentation head.
- ๐ Bidirectional Data Flow โ Supports feedback loops for model fine-tuning and adaptive thresholds.
- ๐งฐ Layer Independence โ Frontend, core, and utilities operate independently with defined interfaces.
โจ In essence:
The Architecture is built for clarity, speed, and innovation โ enabling researchers, developers, and enthusiasts to extend the system into a full-scale perception module for self-driving vehicles.
NeuroDrive-Vision isnโt just a basic lane detector โ itโs a complete AI perception framework โ๏ธ designed for performance, adaptability, and real-world scalability.
Every feature is built with a clear purpose: to bridge the gap between academic research and production-grade autonomous systems.
โEach component is independent yet perfectly synchronized.โ
- Every stage โ from edge detection to smoothing โ exists as a self-contained module.
- Developers can easily modify, replace, or extend parts of the pipeline without breaking the system.
- Ideal for experimentation, allowing quick swaps (e.g., Canny โ Sobel โ Deep CNN lanes).
๐น Benefits:
- Easy debugging and testing per stage.
- Seamless integration for AI/ML add-ons.
- Encourages clean and scalable architecture.
โA vision system that adjusts to the road like a human eye.โ
- The Region of Interest (ROI) dynamically scales with input frame dimensions.
- Automatically aligns to different camera positions and angles โ from dashboard cams to drones.
- Guarantees the algorithm focuses only on lane-relevant zones, filtering out sky, mountains, or irrelevant objects.
๐ฏ Benefits:
- Works across any camera setup or road width.
- Reduces computation and false positives.
- Improves efficiency on embedded systems (Jetson, Pi, etc.).
โBecause roads move fast, but your detection shouldnโt flicker.โ
- Implements an Exponential Moving Average (EMA) smoother for both left and right lane coordinates.
- Reduces noise and frame-to-frame jitter caused by sensor variations or uneven edges.
- Mimics temporal prediction used in real autonomous vehicles for lane persistence.
๐ง Benefits:
- Delivers buttery-smooth line motion even on shaky footage.
- Helps maintain consistent visual alignment.
- Future-ready for integration with Kalman Filters or LSTM-based tracking.
โPower for engineers, simplicity for users.โ
- ๐ป Command-Line Interface (CLI): Automate and batch-process videos with flexible argument controls.
- ๐ Gradio Web Demo: Experiment interactively, visualize outputs, and compare results live.
- Both use the same backend logic, ensuring identical performance and results.
โจ Benefits:
- Developer-friendly automation via CLI.
- Non-technical users can explore the model visually.
- Excellent for demos, research papers, and workshops.
โOptimized to see, think, and respond โ instantly.โ
- Built with pure NumPy and OpenCV vectorized operations for speed.
- Capable of processing 30โ60 FPS on standard hardware.
- Efficient memory management ensures no dropped frames or lag.
๐ Benefits:
- Ideal for real-time applications like robotics or ADAS prototypes.
- No external dependencies on GPUs or heavy models.
- Runs on laptops, Raspberry Pi, or embedded ARM devices.
The NeuroDrive-Vision repository is organized to maintain clarity, scalability, and modularity.
Each folder serves a well-defined purpose โ from pipeline logic to front-end interaction, ensuring seamless development, testing, and deployment.
Click to view directory tree
neurodrive-vision/ โโ ๐ src/ # ๐ง Core source code for processing & orchestration โ โโ โ๏ธ config.py # Configuration dataclasses and tunable parameters โ โโ ๐ pipeline.py # Main orchestrator handling frame-by-frame logic โ โโ ๐งฐ utils.py # Shared helper functions (math, blending, etc.) โ โโ ๐พ io.py # Input/output utilities for videos & images โ โโ ๐ฏ tracker.py # EMA-based lane tracker and smoother โ โโ ๐ vision/ # Vision processing submodules โ โโ ๐๏ธ edges.py # Canny edge detection module โ โโ ๐บ๏ธ roi.py # Dynamic Region-of-Interest (ROI) extraction โ โโ ๐ hough.py # Probabilistic Hough transform logic โ โโ ๐ lines.py # Line grouping, filtering, and averaging โ โโ ๐ smoothing.py # Exponential lane smoothing algorithm โ โโ ๐ apps/ # ๐ป Interfaces for different usage modes โ โโ ๐งพ cli.py # Command-line interface (batch mode) โ โโ ๐ gradio_app.py # Web interface (Gradio demo dashboard) โ โโ ๐ assets/ # ๐งฉ Visual and data assets โ โโ ๐ figures/ # ๐ Documentation figures & output samples โ โ โโ ๐งฌ architecture.png # Complete system architecture diagram โ โ โโ ๐ฃ roi_mask_demo.png # ROI region visualization โ โ โโ โช canny_edges_full.png # Full-frame edge detection result โ โ โโ ๐ข canny_edges_roi.png # ROI-filtered Canny result โ โ โโ ๐ต lane_overlay_result.png # Final lane overlay output โ โโ ๐๏ธ sample_video.mp4 # Example driving video for testing โ โโ ๐ tests/ # ๐งช Unit testing modules โ โโ ๐งฉ test_edges.py # Unit test for edge detection validation โ โโ ๐ requirements.txt # ๐ฆ Python dependencies โโ ๐ณ Dockerfile # ๐งฑ Docker image for containerized deployment โโ ๐งพ README.md # ๐ Project documentation
โ๏ธ Installation
๐ช Quick Setup โ Get started in under a minute!
Clone the repository and install dependencies:
git clone https://github.com/mwasifanwar/neurodrive-vision.git
cd neurodrive-vision
python -m venv .venv
.venv\Scripts\activate
source .venv/bin/activate
pip install -r requirements.txt
Every stage of NeuroDrive-Visionโs processing pipeline produces a meaningful transformation in how the system perceives the road.
These visuals are stored in the assets/figures/ folder โ each representing a critical step from raw frame to fully annotated output.
They not only help debug and analyze the perception pipeline but also provide a transparent view of the modelโs visual reasoning process.
| ๐งฉ Stage | ๐ Description | ๐ผ๏ธ Sample Output |
|---|---|---|
| ๐ฃ ROI Mask | The Region of Interest isolates only the driving-relevant area (a triangular mask that focuses on the lane zone). Everything outside this region is darkened, ensuring efficient and accurate lane detection. | |
| โช Canny Edges | The raw edge map generated using the Canny Edge Detector โ highlights all strong gradients and lane boundaries. This serves as the foundation for subsequent lane extraction. | |
| ๐ข Masked Edges (Canny + ROI) | The intersection of Canny edges with the ROI mask. This focuses computation only on edges inside the defined lane region, eliminating irrelevant patterns (trees, sky, etc.). | |
| ๐ต Final Overlay | The final composited frame. The detected lane lines (left and right) are drawn in blue with smooth transitions using the EMA-based smoothing algorithm, resulting in stable and visually pleasing motion. |
All processed visualization examples are saved under:
๐ assets/ โโ ๐ figures/ โ โโ roi_mask_demo.png # Step 1 - ROI visualization โ โโ canny_edges_full.png # Step 2 - Full edge map โ โโ canny_edges_roi.png # Step 3 - ROI-filtered edge result โ โโ lane_overlay_result.png # Step 4 - Final detected lane overlay
NeuroDrive-Vision is built with a fully modular and configurable core, allowing you to fine-tune every stage of the perception pipeline with ease.
All parameters are organized inside src/config.py ๐งฉ โ designed using Python dataclasses for clarity and type safety.
Each configuration block controls a specific part of the pipeline, ensuring that developers and researchers can quickly experiment with different thresholds, filters, and visual effects.
| ๐ง Category | โ๏ธ Parameters | ๐ง Description |
|---|---|---|
| ๐ฉถ Canny | blur_kernel, low_thresh, high_thresh |
Controls Gaussian blur size and edge detection thresholds for refining sensitivity to road boundaries. |
| ๐ Hough Transform | rho, theta, threshold, min_line_len, max_line_gap |
Adjusts line detection precision using polar coordinates; fine-tune for lane segment smoothness and continuity. |
| ๐บ๏ธ Region of Interest (ROI) | bottom_left, top_mid, bottom_right |
Defines the triangular field of view where lanes are expected โ adaptive to video resolution. |
| ๐ Smoothing (EMA) | ema_alpha |
Controls how smoothly lane positions evolve across frames โ higher = faster response, lower = more stable. |
| ๐จ Drawing Settings | line_color, line_thickness, blend_alpha |
Customizes lane overlay aesthetics including color (BGR), thickness, and transparency blending ratio. |
NeuroDrive-Vision is not a static project โ itโs an evolving AI research platform ๐ง , designed to keep growing alongside advancements in autonomous perception and computer vision.
The roadmap focuses on transforming it from a classical CV-based system into a hybrid AI perception framework that seamlessly merges geometry, deep learning, and temporal intelligence.
โTo bridge the gap between classical computer vision and deep learning โ creating a scalable, interpretable, and real-time perception system for next-generation autonomous driving.โ
| ๐ Feature | ๐ก Purpose & Description |
|---|---|
| ๐ฉ YOLOv8 / SegFormer Integration | Integrate modern deep-learning-based segmentation models for pixel-level lane understanding. This enhancement will enable robust lane detection in complex environments (rain, glare, snow, or night driving). |
| ๐งฎ Kalman Filter Tracking | Introduce state-space tracking and prediction to enhance temporal lane stability. This addition will allow predictive lane behavior even when edges are temporarily obscured by vehicles or road artifacts. |
| ๐ Curvature Estimation Module | Implement a lane curvature and slope analysis algorithm to calculate real-time bending angles of roads, ideal for adaptive steering simulations and robotics control systems. |
| โก FastAPI Microservice Deployment | Package the detection pipeline as a RESTful API powered by FastAPI, enabling real-time streaming, mobile integration, and deployment in autonomous simulation environments (CARLA, Webots, etc.). |
| ๐ค ROS2 (Robot Operating System) Compatibility | Build ROS2 nodes for plug-and-play integration with robotics systems, ensuring seamless synchronization with camera feeds, IMU sensors, and LiDAR data for holistic road understanding. |
The long-term vision for NeuroDrive-Vision goes beyond simple lane tracking โ aiming to evolve into a full-scale AI Driving Perception Suite featuring:
- ๐งญ Multi-Lane Tracking with probabilistic lane identity association
- ๐งฑ 3D Lane Reconstruction using stereo depth or LiDAR fusion
- ๐ง Reinforcement Learning-Based Control Feedback Loops
- โ๏ธ Cloud-Synced Dataset Labeling for Model Retraining
- ๐ Self-Calibrating Parameter Optimization Engine
These planned enhancements will transform NeuroDrive-Vision from a research tool into a real-world deployable perception backbone, capable of powering:
- ๐ Autonomous Driving Simulators (CARLA, AirSim)
- ๐ค Robotic Navigation Systems
- ๐ง AI-Powered Traffic Analysis Tools
- ๐ฐ๏ธ Smart-City Vision Applications
Muhammad Wasif
AI/ML Developer @ Effixly AI
โญ *"A machine that can see the road is not just detecting pixels โ > itโs learning to understand purpose, motion, and possibility."*




