Geospatial computer-vision pipeline that detects road and pavement damage from vehicle-mounted camera footage and maps every detection to GPS coordinates.
PaveScan AI turns raw survey footage into actionable road-maintenance data. A camera is mounted on a moving vehicle or bicycle and driven along the roads to be inspected; the system then ingests the captured video, runs a fine-tuned YOLO detector on each frame, and fuses every detection with synchronized GNSS (GPS) data so each defect gets a precise latitude/longitude.
The pipeline supports two capture sources:
- Stereolabs ZED stereo camera (
.svo2recordings) — left-view frames are extracted together with a per-pixel depth map, enabling distance-to-object measurement and depth-aware severity grading. - Standard cameras / image sequences — frames are processed directly, with GPS read either from image EXIF metadata or from a separate GNSS log.
Detections are classified into general roadside assets (e.g. light poles, paint, scratches, dirt/dents, graffiti, VRI markers) and Dutch road-surface defect categories (asphalt cracking, edge damage, ravelling, unevenness, element paving defects, etc.), reflecting a road-asset inventory use case for a Dutch municipal road authority. Results are exported as annotated frames, a compiled video, and CSV/Excel reports.
- Fine-tuned YOLO object detection for road and roadside damage, with a configurable confidence threshold and optional GPU (CUDA) inference.
- Stereo depth integration — extracts depth maps from ZED
.svo2files to compute the real-world distance from camera to each detected object. - GNSS geolocation — matches each frame to the nearest GNSS timestamp and derives per-detection latitude/longitude via bearing-and-distance projection, frame-position interpolation, or pixel-to-GPS scaling.
- Severity / depth-of-damage grading — bounding-box-area-based B/C/D classification for damage severity.
- VRI analytics — counts roadside markers (VRIs) per frame and computes inter-VRI distances using the Haversine formula.
- Reporting — generates annotated frames, an MP4 detection video, and detailed CSV + Excel reports.
- Self-training utility — pseudo-labels unlabeled imagery above a confidence threshold and retrains the model for iterative dataset expansion.
- Frame tooling — SVO frame extraction (with frame-interval sampling), batch renaming, image resizing, and dataset validation helpers.
- Python 3.7+
- Ultralytics YOLO (object detection / training)
- PyTorch (model inference, GPU acceleration)
- OpenCV (frame I/O, drawing, video writing)
- NumPy (depth-map handling)
- pandas / openpyxl (CSV & Excel reporting)
- Pillow (EXIF GPS extraction, image processing)
- Stereolabs ZED SDK (
pyzed) (SVO2 stereo frame + depth extraction)
-
Clone the repository
git clone https://github.com/ube09/PaveScan-AI.git cd PaveScan-AI -
Create a virtual environment (recommended)
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install dependencies
pip install opencv-python numpy ultralytics pandas openpyxl pillow torch
-
Install the ZED SDK (only needed for
.svo2stereo input) Download and install from stereolabs.com/developers, then install the matchingpyzedPython wheel. -
Configure paths. Each script has a Configuration Section near the top — set
MODEL_PATH(e.g.Final_RP_best.ptorFine_tune.pt), the input path (SVO_FILE_PATHorEXTRACTED_FRAMES_DIR),GNSS_FILE_PATH, the output directories, andCONFIDENCE_THRESHOLDas needed. -
Run a pipeline. Typical entry points:
final.py— end-to-end SVO → depth + bearing-based geolocation → reports (GPU-enabled).process.py/Final-road-pole.py— SVO extraction + detection + reporting variants.updated.py— road-surface-class-only detection with pixel-to-GPS conversion and logging.extract.py/frame_extract.py— extract frames from an SVO file.ml.py— pseudo-labeling and model retraining.
python final.py
- Annotated frames in the processed-frames directory
- A compiled MP4 detection video
*.csvand*.xlsxreports containing per-detection coordinates, damage type, severity grade, distance-from-camera, VRI counts, and inter-VRI distances
Usama Bin Ejaz — AI/ML Engineer | Data Scientist | Founder, UBE Labs ("AI that ships.")
- GitHub: github.com/ube09
- Website: usamabinejaz.com