# autonomousvision/sdfstudio architecture

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

- Interactive diagram: https://gitdiagram.com/autonomousvision/sdfstudio
- Repository: https://github.com/autonomousvision/sdfstudio

## Overview

##### Main Components Overview
The system architecture should be divided into these primary components:

a. Core Framework Components:
- Data Pipeline
- Model Architecture
- Training Pipeline
- Visualization/Viewer System
- Export/Rendering System

##### Detailed Component Breakdown

a. Data Pipeline Layer:
- DataManagers (nerfstudio/data/datamanagers/)
- DataParsers (nerfstudio/data/dataparsers/)
- Dataset Processors (scripts/datasets/)

b. Model Architecture Layer:
- Components for:
- Fields (nerfstudio/fields/)
- Field Components (nerfstudio/field_components/)
- Model Components (nerfstudio/model_components/)
- Different Model Implementations (nerfstudio/models/)

c. Training Pipeline Layer:
- Show:
- Training Engine (nerfstudio/engine/)
- Optimizers
- Schedulers
- Callbacks

d. Viewer System:
- Represent:
- Server Component (nerfstudio/viewer/server/)
- Web Application (nerfstudio/viewer/app/)
- WebSocket Communication
- State Management

##### Interaction Flows

- Data flow from raw input through processing to training
- Training pipeline interaction with models
- Model output to visualization
- Export pipeline flow

##### Specific Implementation Details

- Surface reconstruction methods (UniSurf, VolSDF, NeuS)
- Scene representations (MLPs, Tri-plane, Multi-res feature grids)
- Sampling strategies (surface-guided, voxel-surface guided)
- Monocular cues integration
- Geometry regularization

##### External Dependencies

Integration with:
- PyTorch
- tiny-cuda-nn
- nerfstudio base components
- Visualization libraries

##### Configuration System

Represent:
- Config management (nerfstudio/configs/)
- CLI interface
- Parameter management

##### Processing/Model Layer in the middle

Key Guidelines:
- Both data flow and control flow
- Maintain appropriate abstraction level while preserving important implementation details
- Modular nature of the framework
- Unified architecture that allows method interchangeability

Remember to:
- Annotations for important configuration options
- Version control and experiment tracking integration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style definitions
    classDef data fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef model fill:#90EE90,stroke:#333,stroke-width:2px
    classDef training fill:#FFB347,stroke:#333,stroke-width:2px
    classDef viewer fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef export fill:#FF6961,stroke:#333,stroke-width:2px
    classDef config fill:#F0E68C,stroke:#333,stroke-width:2px

    %% Data Pipeline Layer
    subgraph DataLayer["Data Pipeline Layer"]
        DataManagers["Data Managers"]
        DataParsers["Data Parsers"]
        DatasetProc["Dataset Processors"]
        SceneBox["Scene Box Management"]
    end

    %% Model Architecture Layer
    subgraph ModelLayer["Model Architecture Layer"]
        Fields["Fields"]
        FieldComp["Field Components"]
        ModelComp["Model Components"]
        Models["Model Implementations"]
        
        subgraph SurfaceReconstruction["Surface Reconstruction Methods"]
            UniSurf["UniSurf"]
            VolSDF["VolSDF"]
            NeuS["NeuS"]
        end
    end

    %% Training Pipeline Layer
    subgraph TrainingLayer["Training Pipeline Layer"]
        TrainEngine["Training Engine"]
        Optimizers["Optimizers"]
        Schedulers["Schedulers"]
        Callbacks["Callbacks"]
    end

    %% Viewer System Layer
    subgraph ViewerLayer["Viewer System Layer"]
        Server["Server Component"]
        WebApp["Web Application"]
        StateManagement["State Management"]
        ViewerUtils["Viewer Utils"]
    end

    %% Export System Layer
    subgraph ExportLayer["Export/Rendering Layer"]
        ExporterUtils["Exporter Utils"]
        TextureUtils["Texture Utils"]
        TSDFUtils["TSDF Utils"]
    end

    %% Configuration System
    subgraph ConfigSystem["Configuration System"]
        ConfigMgmt["Config Management"]
        BaseConfig["Base Config"]
        MethodConfig["Method Configs"]
    end

    %% Camera System
    subgraph CameraSystem["Camera System"]
        CameraMgmt["Camera Management"]
        CameraPaths["Camera Paths"]
        CameraUtils["Camera Utils"]
    end

    %% Relationships
    DataLayer --> ModelLayer
    ModelLayer --> TrainingLayer
    TrainingLayer --> ViewerLayer
    ModelLayer --> ExportLayer
    ConfigSystem --> ModelLayer
    ConfigSystem --> TrainingLayer
    CameraSystem --> ModelLayer
    CameraSystem --> ViewerLayer

    %% Click events
    click DataManagers "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/data/datamanagers/"
    click DataParsers "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/data/dataparsers/"
    click DatasetProc "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/data/datasets/"
    click SceneBox "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/data/scene_box.py"
    click Fields "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/fields/"
    click FieldComp "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/field_components/"
    click ModelComp "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/model_components/"
    click Models "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/models/"
    click TrainEngine "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/engine/trainer.py"
    click Optimizers "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/engine/optimizers.py"
    click Schedulers "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/engine/schedulers.py"
    click Callbacks "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/engine/callbacks.py"
    click Server "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/viewer/server/"
    click WebApp "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/viewer/app/"
    click StateManagement "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/viewer/server/state/"
    click ViewerUtils "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/viewer/server/viewer_utils.py"
    click ExporterUtils "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/exporter/exporter_utils.py"
    click TextureUtils "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/exporter/texture_utils.py"
    click TSDFUtils "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/exporter/tsdf_utils.py"
    click ConfigMgmt "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/configs/"
    click BaseConfig "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/configs/base_config.py"
    click MethodConfig "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/configs/method_configs.py"
    click UniSurf "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/models/unisurf.py"
    click VolSDF "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/models/volsdf.py"
    click NeuS "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/models/neus.py"
    click CameraMgmt "https://github.com/autonomousvision/sdfstudio/tree/master/nerfstudio/cameras/"
    click CameraPaths "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/cameras/camera_paths.py"
    click CameraUtils "https://github.com/autonomousvision/sdfstudio/blob/master/nerfstudio/cameras/camera_utils.py"

    %% Style Applications
    class DataManagers,DataParsers,DatasetProc,SceneBox data
    class Fields,FieldComp,ModelComp,Models,UniSurf,VolSDF,NeuS model
    class TrainEngine,Optimizers,Schedulers,Callbacks training
    class Server,WebApp,StateManagement,ViewerUtils viewer
    class ExporterUtils,TextureUtils,TSDFUtils export
    class ConfigMgmt,BaseConfig,MethodConfig config
```
