# adityagupta000/floorplan architecture

> Architecture diagram of the GitHub repository adityagupta000/floorplan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adityagupta000/floorplan
- Repository: https://github.com/adityagupta000/floorplan

## Overview

FloorPlan3D turns an uploaded architectural plan into a semantic mask, builds a colored OBJ model, then previews and exports it. The main runtime spans a step-based Next.js interface and a Flask API; segmentation uses a ResNet50–U-Net with rotation-based test-time augmentation. The README also documents a separate training workflow and dataset preparation, preserved here as supporting capabilities. Edges across UI stages and the API are documented in the README; backend calls and model construction are visible in excerpts. The frontend-to-API wiring is not shown in sampled source.

Main entry points: [`backend/app.py`](https://github.com/adityagupta000/floorplan/blob/main/backend/app.py) (Flask API), [`frontend/components/processing-workflow.tsx`](https://github.com/adityagupta000/floorplan/blob/main/frontend/components/processing-workflow.tsx) (Workflow controller), [`frontend/app/page.tsx`](https://github.com/adityagupta000/floorplan/blob/main/frontend/app/page.tsx) (Landing page), [`frontend/components/workflow/upload-step.tsx`](https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/upload-step.tsx) (Plan upload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_home["Landing page<br/>[page.tsx]"]
  node_workflow["Workflow controller"]
  node_upload["Plan upload<br/>[upload-step.tsx]"]
  node_segmentui["Segmentation step<br/>[segment-step.tsx]"]
  node_generateui["Model generation step<br/>[generate-step.tsx]"]
  node_viewer["3D preview"]
  node_downloadui["OBJ download<br/>[download-step.tsx]"]
end

subgraph group_api["Conversion API"]
  node_api["Flask API<br/>[app.py]"]
  node_uploads[("Uploaded plans<br/>[app.py]")]
  node_masks[("Segmentation masks<br/>[app.py]")]
  node_geometry["OBJ geometry<br/>[obj_generator.py]"]
  node_outputs[("Generated OBJ files<br/>[app.py]")]
end

subgraph group_ml["Segmentation model"]
  node_inference["Inference and TTA<br/>[inference.py]"]
  node_network["ResNet50 U-Net<br/>[model.py]"]
end

subgraph group_training["Training data"]
  node_dataset["Dataset masks<br/>[xml_to_mask.py]"]
  node_trainingrun["Model training<br/>[train_old.py]"]
  node_metrics["Segmentation evaluation<br/>[confusion.py]"]
end

node_user(("Plan designer"))

node_user -->|"opens"| node_home
node_home -->|"presents"| node_workflow
node_workflow -->|"starts with"| node_upload
node_upload -->|"uploads plan"| node_api
node_api -->|"saves plan"| node_uploads
node_workflow -->|"continues to"| node_segmentui
node_segmentui -->|"requests segmentation"| node_api
node_api -->|"calls inference"| node_inference
node_inference -->|"runs model"| node_network
node_api -->|"saves mask"| node_masks
node_workflow -->|"continues to"| node_generateui
node_generateui -->|"requests generation"| node_api
node_api -->|"calls generator"| node_geometry
node_api -->|"reads mask"| node_masks
node_api -->|"saves OBJ"| node_outputs
node_workflow -->|"previews model"| node_viewer
node_viewer -->|"loads OBJ"| node_outputs
node_workflow -->|"ends with"| node_downloadui
node_downloadui -->|"requests download"| node_api
node_api -->|"sends file"| node_outputs
node_dataset -.->|"provides masks"| node_trainingrun
node_trainingrun -.->|"evaluates predictions"| node_metrics

click node_home "https://github.com/adityagupta000/floorplan/blob/main/frontend/app/page.tsx"
click node_workflow "https://github.com/adityagupta000/floorplan/blob/main/frontend/components/processing-workflow.tsx"
click node_upload "https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/upload-step.tsx"
click node_segmentui "https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/segment-step.tsx"
click node_generateui "https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/generate-step.tsx"
click node_viewer "https://github.com/adityagupta000/floorplan/blob/main/frontend/components/model-3d-viewer.tsx"
click node_downloadui "https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/download-step.tsx"
click node_api "https://github.com/adityagupta000/floorplan/blob/main/backend/app.py"
click node_uploads "https://github.com/adityagupta000/floorplan/blob/main/backend/app.py"
click node_masks "https://github.com/adityagupta000/floorplan/blob/main/backend/app.py"
click node_inference "https://github.com/adityagupta000/floorplan/blob/main/backend/inference.py"
click node_network "https://github.com/adityagupta000/floorplan/blob/main/backend/model.py"
click node_geometry "https://github.com/adityagupta000/floorplan/blob/main/backend/obj_generator.py"
click node_outputs "https://github.com/adityagupta000/floorplan/blob/main/backend/app.py"
click node_dataset "https://github.com/adityagupta000/floorplan/blob/main/training/xml_to_mask.py"
click node_trainingrun "https://github.com/adityagupta000/floorplan/blob/main/training/train_old.py"
click node_metrics "https://github.com/adityagupta000/floorplan/blob/main/training/confusion.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home,node_workflow,node_upload,node_segmentui,node_generateui,node_viewer,node_downloadui toneBlue
class node_api,node_uploads,node_masks,node_geometry,node_outputs toneAmber
class node_inference,node_network toneMint
class node_dataset,node_trainingrun,node_metrics toneRose
class node_user toneIndigo
```

## Components

### Web experience

- [Landing page](https://github.com/adityagupta000/floorplan/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Workflow controller](https://github.com/adityagupta000/floorplan/blob/main/frontend/components/processing-workflow.tsx): `frontend/components/processing-workflow.tsx`
- [Plan upload](https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/upload-step.tsx): `frontend/components/workflow/upload-step.tsx`
- [Segmentation step](https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/segment-step.tsx): `frontend/components/workflow/segment-step.tsx`
- [Model generation step](https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/generate-step.tsx): `frontend/components/workflow/generate-step.tsx`
- [3D preview](https://github.com/adityagupta000/floorplan/blob/main/frontend/components/model-3d-viewer.tsx): `frontend/components/model-3d-viewer.tsx`
- [OBJ download](https://github.com/adityagupta000/floorplan/blob/main/frontend/components/workflow/download-step.tsx): `frontend/components/workflow/download-step.tsx`

### Conversion API

- [Flask API](https://github.com/adityagupta000/floorplan/blob/main/backend/app.py): `backend/app.py`
- [Uploaded plans](https://github.com/adityagupta000/floorplan/blob/main/backend/app.py): `backend/app.py`
- [Segmentation masks](https://github.com/adityagupta000/floorplan/blob/main/backend/app.py): `backend/app.py`
- [OBJ geometry](https://github.com/adityagupta000/floorplan/blob/main/backend/obj_generator.py): `backend/obj_generator.py`
- [Generated OBJ files](https://github.com/adityagupta000/floorplan/blob/main/backend/app.py): `backend/app.py`

### Segmentation model

- [Inference and TTA](https://github.com/adityagupta000/floorplan/blob/main/backend/inference.py): `backend/inference.py`
- [ResNet50 U-Net](https://github.com/adityagupta000/floorplan/blob/main/backend/model.py): `backend/model.py`

### Training data

- [Dataset masks](https://github.com/adityagupta000/floorplan/blob/main/training/xml_to_mask.py): `training/xml_to_mask.py`
- [Model training](https://github.com/adityagupta000/floorplan/blob/main/training/train_old.py): `training/train_old.py`
- [Segmentation evaluation](https://github.com/adityagupta000/floorplan/blob/main/training/confusion.py): `training/confusion.py`

### Other components

- **Plan designer**

## Connections

- Plan designer → Landing page: opens
- Landing page → Workflow controller: presents (evidence: `frontend/app/page.tsx`)
- Workflow controller → Plan upload: starts with
- Plan upload → Flask API: uploads plan
- Flask API → Uploaded plans: saves plan (evidence: `backend/app.py`)
- Workflow controller → Segmentation step: continues to
- Segmentation step → Flask API: requests segmentation
- Flask API → Inference and TTA: calls inference (evidence: `backend/app.py`)
- Inference and TTA → ResNet50 U-Net: runs model (evidence: `backend/inference.py`)
- Flask API → Segmentation masks: saves mask (evidence: `backend/app.py`)
- Workflow controller → Model generation step: continues to
- Model generation step → Flask API: requests generation
- Flask API → OBJ geometry: calls generator (evidence: `backend/app.py`)
- Flask API → Segmentation masks: reads mask (evidence: `backend/app.py`)
- Flask API → Generated OBJ files: saves OBJ (evidence: `backend/app.py`)
- Workflow controller → 3D preview: previews model
- 3D preview → Generated OBJ files: loads OBJ
- Workflow controller → OBJ download: ends with
- OBJ download → Flask API: requests download
- Flask API → Generated OBJ files: sends file (evidence: `backend/app.py`)
- Dataset masks → Model training: provides masks
- Model training → Segmentation evaluation: evaluates predictions
