# bostondiditeam/mv3d architecture

> Architecture diagram of the GitHub repository bostondiditeam/mv3d, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bostondiditeam/mv3d
- Repository: https://github.com/bostondiditeam/mv3d

## Overview

##### Main System Components
- Data Ingestion Layer
- Raw KITTI/didi dataset on disk (binary .bin, .png, calibration files)
- ROS‐bag converter tools under utils/bag_to_kitti (Python + catkin nodes)
- Calibration notebooks/scripts under utils/calibration
- Preprocessing Layer
- Lidar preprocessing C libraries (src/lidar_data_preprocess/Python_to_C_Interface)
- Python wrappers and generators (data.py, createTopMaps.py, etc.)
- Output: NumPy blobs (top view, front view), RGB images, ground truth labels
- Model Training Layer
- Python training script (src/train.py)
- MV3D network definition (src/mv3d_net.py, src/model.py)
- Configuration (src/config.py, src/net/configuration.py)
- Custom TensorFlow ops in C++/CUDA (.so files built via make.sh and src/net/lib/setup.py)
- External submodule code under external_modules/didi-competition
- Inference & Tracking Layer
- Prediction script (src/tracking.py, src/task.py, src/mv3d.py)
- Tracklet generation (src/tracklets/*.py)
- Output: XML tracklet files, IoU and precision‐recall CSVs
- Utilities & Visualization
- ROS visualization nodes under utils/ROSviz
- Data‐analysis notebooks under src/play_demo.ipynb, src/test/*.ipynb
- Additional toolboxes under utils (augmentation, bag_to_kitti, split_bags, etc.)
- Environment & Build
- Conda environment files (environment_cpu.yml)
- Build scripts: make.sh, clear.sh, pythonpath.sh, CMakeLists.txt files for C++/ROS
- Python versions: 3.5+ for core code, 2.7 for ROS scripts
- CUDA / TensorFlow‐GPU for custom ops

##### Relationships & Data Flow
- Visualization tools subscribe to prediction outputs for real‐time ROS display

##### Architectural Patterns & Design Principles
- Layered pipeline: clearly separate data ingestion, preprocessing, model training, inference, and visualization
- Modular codebase:
- Python modules (src/, utils/)
- C++/CUDA modules (src/net/lib, src/lidar_data_preprocess)
- Submodules (external competition code, UKF C++ libs)
- Configuration‐driven: central config.py files govern dataset paths, model hyperparameters, CUDA architectures
- Custom TensorFlow operations built as shared libraries (ROI pooling, NMS) loaded at runtime
- ROS integration for live visualization and bag‐to‐dataset conversion

##### Technologies & Frameworks to Annotate
- Python 3.5+, TensorFlow-GPU (>1.0)
- CUDA Toolkit, CMake, Cython
- ROS (catkin) for bag conversion and ROSviz
- NumPy, OpenCV (implicit in image I/O), pyKitti
- Eigen library for UKF C++ code

##### Be Detailed but Focused
- Every logical component (ROS tools, UKF filters, tracklet scripts) without getting lost in file‐level minutiae
- Essential directories as modules, not every source file

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Data Ingestion Layer"
        rawdata["Raw KITTI/Didi Datasets"]:::data
        bag["ROS-bag Converter Tools"]:::python
        calib["Calibration Scripts/Notebooks"]:::python
    end

    subgraph "Preprocessing Layer"
        cpre["Lidar C Preprocessing Library"]:::cpp
        imggen["Lidar Image Generators"]:::python
        converters["Npy Converters"]:::python
        wrappers["Preprocessing Wrappers"]:::python
    end

    subgraph "Model Training Layer"
        train["Training Script (train.py)"]:::python
        netdef["MV3D Network Definitions"]:::python
        config["Configuration Files"]:::python
        customops["Custom TensorFlow Ops"]:::cuda
        externalmod["External Competition Submodule"]:::external
    end

    subgraph "Inference & Tracking Layer"
        inference["Inference Scripts"]:::python
        tracklets["Tracklet Generation & Evaluation"]:::python
    end

    subgraph "Utilities & Visualization Layer"
        rosvis["ROS Visualization Nodes"]:::python
        notebooks["Data Analysis Notebooks"]:::python
    end

    subgraph "Environment & Build"
        env["Conda Environment File"]:::data
        scripts["Build & Helper Scripts"]:::python
        cmake["CMake & Makefiles"]:::cpp
    end

    rawdata --> bag
    rawdata --> cpre
    rawdata --> calib
    bag --> rawdata
    calib --> cpre

    cpre --> imggen
    imggen --> converters
    converters --> wrappers
    wrappers --> train

    train --> netdef
    train --> config
    train --> customops
    customops -.-> train
    train --> externalmod

    netdef --> inference
    inference --> tracklets

    tracklets --> rosvis
    tracklets --> notebooks

    scripts -.-> customops
    cmake -.-> customops
    env -.-> train

    click rawdata "https://github.com/bostondiditeam/mv3d/tree/master/src/lidar_data_preprocess/raw/kitti"
    click bag "https://github.com/bostondiditeam/mv3d/tree/master/utils/bag_to_kitti"
    click calib "https://github.com/bostondiditeam/mv3d/tree/master/utils/calibration"
    click cpre "https://github.com/bostondiditeam/mv3d/tree/master/src/lidar_data_preprocess/Python_to_C_Interface"
    click imggen "https://github.com/bostondiditeam/mv3d/tree/master/src/lidar_data_preprocess/lidar_image_generator"
    click converters "https://github.com/bostondiditeam/mv3d/tree/master/src/lidar_data_preprocess/npyConverter"
    click wrappers "https://github.com/bostondiditeam/mv3d/blob/master/src/data.py"
    click train "https://github.com/bostondiditeam/mv3d/blob/master/src/train.py"
    click netdef "https://github.com/bostondiditeam/mv3d/blob/master/src/mv3d_net.py"
    click config "https://github.com/bostondiditeam/mv3d/blob/master/src/config.py"
    click customops "https://github.com/bostondiditeam/mv3d/tree/master/src/net/lib"
    click externalmod "https://github.com/bostondiditeam/mv3d/tree/master/external_modules/didi-competition"
    click inference "https://github.com/bostondiditeam/mv3d/blob/master/src/tracking.py"
    click tracklets "https://github.com/bostondiditeam/mv3d/tree/master/src/tracklets"
    click rosvis "https://github.com/bostondiditeam/mv3d/tree/master/utils/ROSviz"
    click notebooks "https://github.com/bostondiditeam/mv3d/blob/master/src/test/play_demo.ipynb"
    click env "https://github.com/bostondiditeam/mv3d/blob/master/environment_cpu.yml"
    click scripts "https://github.com/bostondiditeam/mv3d/blob/master/make.sh"
    click cmake "https://github.com/bostondiditeam/mv3d/blob/master/src/lidar_data_preprocess/CMakeLists.txt"

    classDef python fill:#ffcc00,stroke:#333,stroke-width:1px;
    classDef cpp fill:#00ccff,stroke:#333,stroke-width:1px;
    classDef data fill:#ccffcc,stroke:#333,stroke-width:1px;
    classDef cuda fill:#ff99cc,stroke:#333,stroke-width:1px;
    classDef external fill:#dddddd,stroke:#333,stroke-width:1px;
```
