# pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle architecture

> Architecture diagram of the GitHub repository pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle
- Repository: https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle

## Overview

##### Project type and purpose
- This is a vision-based machine-learning pipeline for 6-DoF pose estimation of cars from single images. It combines object detection (YOLOv3) with two regression stages: one for 3D coordinates (x,y,z) and one for yaw/pitch/roll.

##### Key components (from file tree and README)
- Data ingestion: raw images (images/) and Kaggle dataset.
- Preprocessing & utility functions: camera_utils.py, dataset.py, utils.py, batch_norm.py.
- Object detector: car_extractor.py wraps a pretrained YOLOv3 model (downloaded into trained_models/).
- Yaw/pitch/roll regressor: yaw_pred.py implements two-step angle estimation (classification into 8 bins + regression), applies camera matrix math from camera_utils.py.
- Orchestration notebooks:
- Car Position Estimation – Full pipeline.ipynb – runs detection, then coordinate and angle predictors end-to-end.
- Car-Yaw-Prediction.ipynb – trains or fine-tunes the yaw model.
- Models directory: trained_models/ (YOLO weights, pos_predictor.joblib, yaw model).
- Dependencies: Python, Jupyter, OpenCV, PyTorch/TensorFlow (for YOLO), scikit-learn, joblib, numpy.

##### High-level architectural pattern
- A linear, staged pipeline (sequence pattern), with clearly decoupled modules: detection → feature extraction → two parallel regressors → geometric projection.

##### Important architectural patterns & principles
- Modularity: separate detection, coordinate regression, angle regression.
- Reusability: utility scripts (camera_utils, utils) shared across stages.
- Data-flow clarity: linear pipeline with clear inputs/outputs between stages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Inference Pipeline"
        DStore["Raw Images / Kaggle Dataset"]:::storage
        Preprocess["Image Loader & Utils"]:::processing
        Detector["YOLOv3 Car Extractor"]:::detector
        Feature["Bounding Box → Feature Vector"]:::transformer
        Reg3D["3D-Position Model (pos_pred.py)"]:::regressor
        RegAng["Yaw/Pitch/Roll Model (yaw_pred.py)"]:::regressor
        Projection["2D Projection via camera_utils.py"]:::projection
        Viewer["Results Viewer"]:::notebook

        DStore -->|".jpg"| Preprocess
        Preprocess -->|"images array"| Detector
        Detector -->|"boxes"| Feature
        Feature -->|"features"| Reg3D
        Feature -->|"features"| RegAng
        Reg3D -->|"x,y,z"| Projection
        RegAng -->|"θl bins+residuals"| Projection
        Projection -->|"overlay images"| Viewer
    end

    subgraph "Training Pipeline"
        NotebookPos["Car Position Estimation Notebook"]:::notebook
        NotebookYaw["Car-Yaw-Prediction Notebook"]:::notebook
        ModelStore["trained_models/"]:::modelstore

        NotebookPos -->|"train pos_predictor.joblib"| ModelStore
        NotebookYaw -->|"train yaw model"| ModelStore
    end

    subgraph "Configuration"
        Req["requirements.txt"]:::config
        Dep["External Dependencies"]:::external
        Req --> Dep
    end

    classDef storage fill:#8FBC8F,stroke:#333,stroke-width:1px
    classDef processing fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef detector fill:#FFA500,stroke:#333,stroke-width:1px
    classDef transformer fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef regressor fill:#9370DB,stroke:#333,stroke-width:1px
    classDef projection fill:#FFB6C1,stroke:#333,stroke-width:1px
    classDef notebook fill:#F0E68C,stroke:#333,stroke-width:1px
    classDef modelstore fill:#A9A9A9,stroke:#333,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#E0FFFF,stroke:#333,stroke-width:1px

    click DStore "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/tree/main/images/"
    click Preprocess "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/dataset.py"
    click Preprocess "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/utils.py"
    click Preprocess "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/batch_norm.py"
    click Detector "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/car_extractor.py"
    click Feature "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/models.py"
    click Reg3D "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/pos_pred.py"
    click RegAng "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/yaw_pred.py"
    click Projection "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/camera_utils.py"
    click NotebookPos "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/Car Position Estimation – Full pipeline.ipynb"
    click NotebookYaw "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/Car-Yaw-Prediction.ipynb"
    click Req "https://github.com/pallavimitra/vision-based-absolute-pose-estimation-of-autonomous-vehicle/blob/main/requirements.txt"
```
